###The 'Militia' and the 2nd Amendment
The 'Militia' and the 2nd Amendment
The National Guard is part of the 'militia,' but it is not all of it.
Under current law, the 'militia' of the United States literally includes all able-bodied male citizens between the ages of 17 and 45. Even so, the operative clause of the 2nd Amendment is not limited to the 'militia,' but rather explicitly applies to "the people." The mention of 'militia' in the 2nd Amendment is only in its preamble, not in its operative clause. As such, it does not place any limits on the extent of the 2nd Amendment's correct application.
So, the protections intended by the 2nd Amendment aren't secured only (or even mostly) by the National Guard, but rather by a pretty close approximation of everyone.
###The National Guard
The National Guard
While the National Guard is legally part of the 'militia,' its primary purpose is not to protect states against the federal government. The state National Guard units are intended more for defense against foreign invasion or, much more commonly, to respond to major natural disasters and other similar needs. Still, it could theoretically be used to defend a state against the federal government if the federal government became aggressive and the leadership of the state National Guard decided to follow the state rather than the federal government. While it's (thankfully) very rare to have such a need, state-level militias siding with the state against the federal government is not without precedent in the U.S.
###Whose Orders are Followed?
Whose Orders are Followed?
When discussing events of armed resistance against the national government, discussion of who is supposed to legally obey whose orders has only limited usefulness. The whole point of having the 2nd Amendment is to make sure that the people can stop obeying the government if the need arises. Armed insurrection is pretty much always illegal, by definition. Nevertheless, the framers of the U.S. Constitution considered preserving the possibility of such an insurrection if the government became tyrannical to be necessary for maintaining freedom. That they thought this is not particularly surprising, considering that most of them had just participated in such a rebellion several years earlier.
The reality is that, in the event of a crisis to the level of people feeling taking up arms against the government to be necessary, who follows whose orders comes down a lot more to individuals deciding which (if any) side they will join, rather than whose orders they were supposed to 'legally' follow. What is 'legal' becomes questionable when you suddenly have two (or more) governments claiming authority over the same area and those governments have very different opinions of what is legal. The more relevant question then becomes who will the people (and especially the people who are armed) choose to follow and that question will be answered by the particular circumstances surrounding the rebellion rather than by what is legally required.