Click here to Skip to main content
13,089,818 members (47,707 online)
Click here to Skip to main content
Add your own
alternative version


120 bookmarked
Posted 10 Aug 2006

Windows Networking Overview - Part I TCP/IP Networking on Class C Subnets

, 16 Aug 2006
Rate this:
Please Sign up or sign in to vote.
Provides a basic introduction to class C subnets and TCP/IP stack configuration in a Windows 2000/XP environment.


Based upon the votes and the comments I've been receiving so far I need to address something up front in this series. This entire article series is not source code related and if you are expecting source code you won't find it. Comments so far are suggesting that this article does not belong here. I'd like to address that by saying that if you are developer writing code that will work across networks then these articles might be valuable to you. If your systems are not configured properly the best code in the world won't run right. So consider these articles prerequesite articles that should be read before starting a project where your code is intended to work across networks.

I've written a series of articles to provide developers with a broad amount of information that covers general networking topics. In this series I'll be discussing:

I had originally intended this to be a single article but it has grown to be much to large to be a single article. I also think that breaking it up into topics does a better job of granulating the information and makes it easier for readers to ask specific questions that will flow together in the reader comments area. If it's possible I'd like to have the above bulleted list link to all the articles so that readers may jump around from one topic to the other.

I'll be including this information in each relevant section but right up front I'd like to group this information for the convenience of the reader. I'm going to take the approach that you are brand new to networking and need the information presented in a way that flows smoothly from one topic to the next. Please understand this is not a simple topic. Networking is a black art and I mean that seriously. If you intend to fully understand networks and become proficient in them at a basic-working-level you will invest several hours to do so. Expect to make mistakes and expect it to be slow going at first. That's the nature of the topic.

As you read through this feel free to request an article on other topics in networking or feel free to ask me to add to a current section and drive it a bit deeper. I'm open to improving anything you see here and adding more content will just add value to the entire project.

From the top I'd start by reading TCP/IP Networking in Class C Subnets. I'd read it a few times so that you have the core down. I'd immediately move to Command Line Tools - IPCONFIG as it will provide an extra level of visibility to what was discussed in TCP/IP Networking in Class C Subnets. Even though it's the most difficult topic I've written on so far I'd recommend Adding Wireless Routers to Existing Networks next. It will force you to apply everything else I have discussed and it will do so in such a way that you will utterly understand it all by the time you have done it a few times. Even though many people have no need to know about Internet Connection Sharing (ICS) I think it's the next logical choice in progression. It will help you to understand networking landscapes a bit more and drive depth in your basic knowledge. I save the most practical for closest to the end because Sharing Files, Printers and Other Network Resource plagues almost every network I've ever seen. It's the most necessary aspect of networking for users and it can be one of the hardest to troubleshoot. You will need the knowledge gained from all the other articles to troubleshoot any problems you may have in Sharing Files, Printers and other Resources. As a final topic I'll briefly delve into VPN but it's a bit like trying to fit the ocean into a 1 gallon jug. Virtual Private Networking (VPN) is vast and enormous in scope and the security liability is enormous if you screw up.

That just about covers it. Now it's time to dive in. I hope you enjoy the material and feel free to ask further questions in the comments area.


I've spent the last 8 years of my life fighting Class C subnets in Windows, Linux and MAC environments. To be honest networking is like black magic. Some people understand it and many never will. I think the reason for this is fear that you can break something. This is a valid fear. If you hose your TCP/IP stack you are in big trouble. If you are reading this article and are new to networking I'd suggest all of the following to guarantee you learn what you need and don't destroy your own PC's and network in the process.

  • If you have an extra PC to play with perfect make sure you are fine to trash it and reload it if necessary.
  • Before getting started I recommend downloading a product like Acronis True Image and making a full backup of your system. (Please verify the backup image.)
  • If you are going to play with a router that currently works please export/download it's firmware settings as a safe backup.
  • Please write down every setting you change and in what order. It's very easy to go backwards when you take good notes as you go.

TCP/IP Networking in Class C Subnets

You may also enjoy my article on Command Line Tools IPCONFIG after reading this article.

Before we dive to far into the details let's discuss briefly what is involved in configuring a computers TCP/IP stack so that it can:

  • Share files and folders with other computers on the same network.
  • Surf the internet using fully qualified domain names (FQDN) such as
  • Send email to FQDN's and receive email from FQDN's.
  • Participate in all other network related tasks such as File Transfer Protocol (FTP), Terminal Services and Network Monitoring.

In order for a PC to do the above with respect to other PC's on the network and PC's across the internet it must be configured properly and so must other PC's on the LAN. A fully configured TCP/IP stack has all of the following:

  • IP Address - Uniquely identifies a device/interface on a Local Area Network (LAN) or a Wide Area Network (WAN).
  • Subnet Mask - Must be set accordingly to the DHCP server and other devices on the network. Determines the number of devices that may be on a network.
  • Default Gateway - The LAN IP Address of your Internet Firewall, Internet Router, Cable or DSL Modem.
  • Primary DNS Server - The WAN IP Address of the first server to query to resolve FQDN's into IP Addresses when browsing the web or sending email.
  • Secondary DNS Server - The WAN IP Address of the second server to query to resolve FQDN's into IP Addresses when browsing the web or sending email.

What is a TCP/IP Stack?

In the simplest terms I believe a TCP/IP stack is referred to as such because if you examine the numbers required to have a fully functioning network connection they look like a stack.

{XXX}.{XXX}.{XXX}.{XXX} - IP Address

{XXX}.{XXX}.{XXX}.{XXX} - Subnet Mask
{XXX}.{XXX}.{XXX}.{XXX} - Default Gateway
{XXX}.{XXX}.{XXX}.{XXX} - Primary DNS
{XXX}.{XXX}.{XXX}.{XXX} - Secondary DNS

Visually that looks like a stack to me. I also believe that the name comes from the fact that networking is referred to frequently as having layers. This would imply that TCP is a stack of network protocols IP being one of them and that entirely they make up a stack but each individual layer is a subset of the stack. The TCP/IP stack is referred to as such because it's the foundation of the entire TCP protocol implementation. This is a huge and broad topic and it may be better to cover it in more detail later. So that's my answer. Visually the octets manifest a stack and TCP (being a stack) is made of of many layers IP being one of them. So TCP/IP means the the IP layer of the TCP stack. I should mention that IP is Internet Protocol and TCP is Transmission Control Protocol. There is also UDP but that's another subject.

The rest of this section will be spent discussing each of the above items and how they work in greater detail.

A Class C subnet is both a private (LAN: Local Area Network) and a public (WAN: Wide Area Network) network addressing scheme. A Class C rules the LAN while a WAN may be made up of Class A, Class B or Class C addressing schemes. When we are talking about Class C we are talking about Octets. In this IP Address:


There 4 octets. {192} is the first octet {168} is the second octet {0} is the third and {1} is the fourth. Conceptually it should look like this though you will never see this in real configurations {192}.{168}.{000}.{001}.

Figure 1
  A     B    C   D

In a Class C subnet on a Local Area Network we don't actually worry about A, B, or C. In every single case they will always be the same when referring to a LAN Priavte IP Address. If they are not then machines on different subnets will not be able to communicate and this will also affect web browsing and sending and receiving of email.

So in order for machines to see one another they must all be on the same Class C network. A, B and C must be exactly the same numbers on every device. The {D} portion of the network is what we are allowed to change assuming we follow some basic rules. {D} > 0 < 255 and must be unique in every case D must be greater than 0 and it must be less than 255. 0 and 255 are reserved and that's all there is to it.

So if we have 3 computers and 1 Firewall/Router and they all have the same Class C but in every case their {D} must be different.

Figure 2
{192}.{168}.{0}.{1} - Router/Firewall
  A     B    C   D
{192}.{168}.{0}.{2} - LAN PC #1
  A     B    C   D
{192}.{168}.{0}.{3} - LAN PC #2
  A     B    C   D
{192}.{168}.{0}.{4} - LAN PC #3
  A     B    C   D

At this point it might be tempting to think that you understand this and are ready to head off like a professional. Sadly there's more to the story. Now that we understand what the network classes are and how a Class C works with respect to IP Addresses let's move on now to the next portion of a properly configured TCP/IP Stack.


Fortunately there's a much narrower discussion when it comes to the subnet mask. The subnet mask sets the upper bound for the number of machines that can be visible on a network. It works in a reverse notion numerically than what you might be used to. A subnet mask is also compose of 4 octets. A typical subnet mask on most LAN's looks like this:

What this number is saying is that this network only participates with 254 logically related devices or interfaces. Meaning that a network only has room for 254 devices. A network with the subnet mask of only has room for 8 IP addresses in most cases 3 of them will be reserved and you can use the other 5 as you see fit. The 255 in any octet means that we are not allowing this network to add additional members in this portion of the addressing scheme. So a defines a Class C subnet. As you have surmised a defines a Class B network and a defines a Class A network. This documents scope will be restricted to Class C networks only and we will mention Class A, B and D when it makes sense to do so. So for our purposes all machines in a Class C subnet must be set to so that they have visibility to one other.


The Default Gateway is a very simple notion. It simply is the LAN IP address of the device sitting between your network and the internet. If your LAN is a single PC connected directly to a cable modem then the LAN IP address of your cable modem will be your Default Gateway's IP Address. If it isn't you will not be surfing the internet at all. Which makes this a good time to mention that if you are a parent or otherwise concerned citizen and do not want a certain computer to be able to get out on the internet at all simply set's it's default gateway to which is the Loopback Interface IP and always refers to itself. Any PC making any request to the Loopback Interface is simply requesting something from it's own IP Address. So setting a machines Default Gateway to is essentially telling it that it is it's own internet connection which it truly isn't.

So a properly configured Default Gateway is always in the same Class C as the devices that will be using it to get out on the internet. In all of my networks the Default Gateway is a Firewall with a Router built in and I always assign it to the lowest availble IP Address on the network. In a similar vein my Wireless Firewall with built in Router is assigned to the highest available IP address. So respectively my internet firewall will occupy X.X.X.1 and my wireless firewall will occupy X.X.X.254. If we use this convention as a standard (which is common) then a default gateway's IP Address in a TCP/IP stack pointing to the Internet Firewall will look like this:
You will see this conforms to the diagram I configured in Figure 2.

Primary and Secondary Domain Name Servers (DNS)

The last two items I will discuss concurrently. They are your primary and secondary Domain Name Servers (DNS). These are servers that can be found on your LAN or out on the internet WAN and your computer will use these servers to convert a Fully Qualified Domain Name (FQDN) to an Internet Resolvable IP Address. That is the only thing a DNS server does. A machine {Requester} provides and FQDN to the {Server} the server takes that FQDN and queries against it's internal cached lookup table and returns an IP Address. That's it. Pretty simple. I will typically give my local DNS Servers an IP Address of .99 or .199. If my domain controller and DNS Server are on the same physical machine then the IP Address will always be X.X.X.99. If they are on different machines then my Domain Controller will be X.X.X.99 and my DNS Server will be X.X.X.199. Your typical store bought Linksys or D-Link Router will also act as a DNS Forwarder. So you may the LAN IP Address of your Internet Firewall/Router as one of your DNS servers as well. For the sake of discussion I'll configure 3 DNS Servers (I always do.) and it will look something like this: - {Primary DNS Server}   Domain Controller's LAN IP Address.  - {Secondary DNS Server} Internet Firewall/Router's LAN IP Address. - {Tertiary DNS Server}  Public DNS Server provided by my ISP.

To conclude our discussion on TCP/IP Networking in Class C subnets let's now put it all back together. We've discussed the IP Address, Subnet Mask, Default Gateway, Primary and Secondary Domain Name Servers. I've provided a general overview for how the numbering schemes work in each case and we should now have a functioning understanding of how to build a TCP/IP Stack by hand. Let's give it a try.

     IP Address:    The LAN IP Address of PC #1.
    Subnet Mask:  The numbering scheme for a Class C subnet.
Default Gateway:    The LAN IP Address of my Internet Firewall/Router.
    Primary DNS:   The IP Address of my domain controller 
                                or LAN DNS Server. Can also be the LAN IP 
                                of your Firewall/Router.
  Secondary DNS:    The IP Address of my Firewall/Router. 
                                Can also be a WAN ISP provided DNS Server.
   Tertiary DNS:   The IP Address of my WAN ISP provided DNS Server.

As final clarification on this. DNS Servers for computers on networks answering to a Domain Controller should always have the IP Address of that Domain Controller listed first and foremost. That's the only rule. After that you can use any order of DNS Servers from WAN to LAN and back to WAN. Most PC's will have two listed and in most cases those two will be those DNS Servers provided by your ISP.

What is a Domain Controller?

A domain controller is a very complex topic. Domains are made up of Forests and nodes and can be enormous. A simple definition of a single domain controller would be to say that it governs the use of network objects and resources within the domain. Domain Controllers can also controll both inbound and outbound traffic to the domain and will establish rules for each type of traffic. So on my network my Active Directory Domain Controller hosts all my printers, PC's joined to the domain and my active user accounts. I then use Active Directory to control who can do what with these resources on my domain. So think a Domain Controller as place to store information about equipment on your domain, who can use it and from which computers. People study for years to become masters of Active Directory and Domain Controllers and it's not a light topic at all. I would advise you Google "Domain Controllers" or search that term at Microsoft to learn more about them and what can be done. My domain controller is actually a Microsoft Small Business Server 2003 Premium Edition. It hosts SQL Server, Internet Information Server (IIS)Microsoft Exchange 2003, User protected resources, Group protected resources, printers and security updates.



August 10th, 2006. First release.

August 16th, 2006. Adding in information about TCP/IP stacks and Domain Controllers.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionRange request/Random access check Pin
Vaibhav Gade20-Mar-09 1:55
memberVaibhav Gade20-Mar-09 1:55 
QuestionInternetSetFilePointer fails. Pin
Vaibhav Gade20-Mar-09 1:53
memberVaibhav Gade20-Mar-09 1:53 
QuestionMysterious IP Pin
S Douglas27-Aug-06 20:58
memberS Douglas27-Aug-06 20:58 
AnswerRe: Mysterious IP Pin
Thomas George28-Aug-06 0:10
memberThomas George28-Aug-06 0:10 
GeneralRe: Mysterious IP Pin
S Douglas28-Aug-06 3:56
memberS Douglas28-Aug-06 3:56 
GeneralRe: Mysterious IP Pin
Thomas George28-Aug-06 5:23
memberThomas George28-Aug-06 5:23 
GeneralRe: Mysterious IP Pin
S Douglas28-Aug-06 12:47
memberS Douglas28-Aug-06 12:47 
GeneralRe: Mysterious IP Pin
Thomas George28-Aug-06 16:52
memberThomas George28-Aug-06 16:52 
GeneralRe: Mysterious IP Pin
S Douglas28-Aug-06 22:26
memberS Douglas28-Aug-06 22:26 
GeneralRe: Mysterious IP Pin
Thomas George28-Aug-06 22:41
memberThomas George28-Aug-06 22:41 
GeneralRe: Mysterious IP Pin
S Douglas28-Aug-06 23:36
memberS Douglas28-Aug-06 23:36 
GeneralRe: Mysterious IP Pin
S Douglas29-Aug-06 21:03
memberS Douglas29-Aug-06 21:03 
GeneralRe: Mysterious IP Pin
Thomas George30-Aug-06 1:15
memberThomas George30-Aug-06 1:15 
GeneralRe: Mysterious IP Pin
S Douglas30-Aug-06 5:14
memberS Douglas30-Aug-06 5:14 
GeneralRe: Mysterious IP Pin
Thomas George30-Aug-06 16:50
memberThomas George30-Aug-06 16:50 
GeneralRe: Mysterious IP Pin
S Douglas30-Aug-06 19:30
memberS Douglas30-Aug-06 19:30 
GeneralRe: Mysterious IP Pin
code-frog28-Aug-06 18:40
membercode-frog28-Aug-06 18:40 
GeneralRe: Mysterious IP Pin
S Douglas28-Aug-06 22:32
memberS Douglas28-Aug-06 22:32 
AnswerRe: Mysterious IP Pin
code-frog28-Aug-06 6:17
membercode-frog28-Aug-06 6:17 
GeneralRe: Mysterious IP Pin
S Douglas28-Aug-06 12:54
memberS Douglas28-Aug-06 12:54 
GeneralRe: Mysterious IP Pin
S Douglas28-Aug-06 22:36
memberS Douglas28-Aug-06 22:36 
GeneralAdded information suggestion Pin
Michael A. Barnhart25-Aug-06 0:14
memberMichael A. Barnhart25-Aug-06 0:14 
GeneralGood stuff comes in 7 sections Pin
alamban24-Aug-06 0:50
memberalamban24-Aug-06 0:50 
GeneralNice job Pin
S. Senthil Kumar21-Aug-06 0:16
memberS. Senthil Kumar21-Aug-06 0:16 
GeneralExcellent work Pin
Douglas Troy18-Aug-06 5:32
memberDouglas Troy18-Aug-06 5:32 
GeneralExcellent Article Pin
PJ Arends16-Aug-06 15:54
memberPJ Arends16-Aug-06 15:54 
GeneralRe: Excellent Article Pin
code-frog16-Aug-06 15:57
membercode-frog16-Aug-06 15:57 
GeneralNetwork Stack [modified] Pin
Mark Woan16-Aug-06 15:11
memberMark Woan16-Aug-06 15:11 
GeneralRe: Network Stack Pin
code-frog16-Aug-06 15:28
membercode-frog16-Aug-06 15:28 
GeneralSome more info please Pin
khb15-Aug-06 21:24
memberkhb15-Aug-06 21:24 
GeneralRe: Some more info please Pin
code-frog15-Aug-06 21:38
membercode-frog15-Aug-06 21:38 
GeneralRe: Some more info please Pin
khb16-Aug-06 3:37
memberkhb16-Aug-06 3:37 
GeneralRe: Some more info please Pin
code-frog16-Aug-06 14:10
membercode-frog16-Aug-06 14:10 
GeneralRe: Some more info please Pin
khb17-Aug-06 3:45
memberkhb17-Aug-06 3:45 
QuestionWhere is Part II ? Pin
Paddy Wack11-Aug-06 4:39
memberPaddy Wack11-Aug-06 4:39 
AnswerRe: Where is Part II ? Pin
code-frog11-Aug-06 8:07
membercode-frog11-Aug-06 8:07 
GeneralRe: Where is Part II ? Pin
Paddy Wack11-Aug-06 8:12
memberPaddy Wack11-Aug-06 8:12 
GeneralExcellent! Pin
Ravi Bhavnani11-Aug-06 3:14
memberRavi Bhavnani11-Aug-06 3:14 
GeneralGreat article Pin
Cedric Moonen11-Aug-06 2:20
memberCedric Moonen11-Aug-06 2:20 
GeneralRe: Great article Pin
code-frog11-Aug-06 8:08
membercode-frog11-Aug-06 8:08 
GeneralRe: Great article Pin
Cedric Moonen11-Aug-06 8:11
memberCedric Moonen11-Aug-06 8:11 
GeneralGateway Pin
norm .net10-Aug-06 21:49
membernorm .net10-Aug-06 21:49 
GeneralRe: Gateway Pin
code-frog11-Aug-06 8:09
membercode-frog11-Aug-06 8:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.170813.1 | Last Updated 16 Aug 2006
Article Copyright 2006 by code-frog
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid