Networking 101

Welcome to Chris Sutton’s networking tutorial.

The first thing we need to talk about are IP Addresses.  Every computer on the internet needs an IP Address.  They look like this  Basically 4 numbers separated by periods.  Can these be any numbers you ask, like 1235.6789.98234.123556?  Nope.  The numbers must be from 0 to 254.  So you can have something like

Generally each computer needs a unique IP Address.  Think of it like a phone number.  If we want to talk to that computer, we need to know how to dial it up.

The next thing we need to learn about are Subnet Masks.  Here is an example:  Wow, that looks a whole lot like an IP address.  Yes, it does and it works with an IP Address to help define the size of the local network a computer belongs to.  When your computer is assigned an IP address, it also must be assigned a Subnet Mask.

Lets go back to our first example of IP address with a subnet mask of  The 255’s in the subnet basically block out the first 3 numbers and say “dont worry about these for now”, and the 0 says don’t block out any of the last number.

Now, remember when we said each part of an IP address can be from 0 to 254.  The last part of the subnet mask says that this computer is on a local network that can talk to all the IP addresses from to

So if your computer was and my computer was and we both had a subnet mask of then we would be able to talk to each other.

Now, lets bring in Sam’s computer, which has an address of and subnet mask of  Can we talk to Sam?  Nope, because our subnet mask is blocking him out.  We can only talk to those people in the 10.4.2.(0-254) network, not someone on the 10.4.0.(0.254) network.

So, how do we talk to Sam?  We need a gateway (actually default gateway)!  And this is the last piece you need for a network configuration, someplace to go when you need to travel outside your local network of 254 friends.  For our example our default gateway is going to be (which luckily is in our network that we can talk to, otherwise we would have big problems).  This default gateway is actually just another computer, and for simplicity lets call this Arla.

Now, some computers can have more than one network interface.  Think of it like 2 phone jacks.  And each network interface must have it’s own settings.

So, we already know the network settings for our first interface (which we will call eth0),  Now, the other network interface (called eth1) is on Sam’s network and has an address of

With me so far…ya, coffee break time, and time for a sidebar.

Can you just make up and use an old IP Address you want?  Generally no, you need to talk to your ISP, and they can give you an address, or a block of addresses to use.  But, there are a few ranges of IP addresses that are available to anyone to use without asking for permission.  One of these ranges is the addresses from to  Another range you may have seen is from to  More information can be found on wikipedia about these private networks.  This tutorial uses the network.

Now, back to our program.  We were trying to talk to Sam on the network next door, and we do this through our default gateway Arla.  Here is a little text graphic showing the path.  The square brackets show that Arla that has 2 interfaces and 2 different IP Addresses.

(You) -> (Arla)[ — ] -> (Sam)

Now, we defined the default gateway on our computer as  But Arla also needs her own default gateway, as does Sam, and in this case it’s

Quick side note:  Each computer can only have 1 default gateway.

So, to review.  Your settings are (IP Address/Subnet/Gateway). Arla is and with a gateway.  Sam is

So, why do we need this other gateway?  Well, we need it so Sam can talk back to us.  Lets put that gateway in the picture, and we will call it Tom.

(You) -> (Arla)[ — ] -> (Sam) -> (Tom)[ ]

You can talk to Sam because your computer says, Sam is not on your network, we need to talk to the default gateway Arla.  Arla then says, hey, Sam is on my other network, I can talk to him directly.

But, when Sam needs to talk to you at, his network settings say you are not on my network, so I need to talk to my gateway Tom (at

And here is the last part which are Routes!

Routes are a way to tell who you need to talk to next to get somewhere.  Routes use something that looks like an IP Address and a subnet mask, and then an IP Address.  For this example we are going to start with a route on Tom that looks like this:

This says, “if you want to talk to the network, talk to”.  So, we have this route on Tom.  Sam asks Tom, “I need to get to″, and Tom says, talk to Arla(”.

Then Sam turns around says to Arla, I need to talk to and Arla says, hey, I can do that because it’s on my other network.

Now, remember that default gateway we talked about.  This is actually just a route.  And it looks like this:

This says, if we have not already told you who to talk to with other routes, then EVERYONE ELSE you should go to