It should be pointed out that RIP is VERY basic, it is ineffiecent compared with other protocols however
it is very easily setup and would suffice in a LAN environment, it would not be recommended to use it over WAN links
(due to the frequent timed updates). In short to configure this you would type
routera# route rip routera# network 10.0.0.0
routera# network 10.0.1.0
routera# network 192.168.0.0
Then hit ctrl Z and let the routers share routes. To see your dynamically learned routes type show ip route and a list will come up.
It should however be noted that in a very small environment static routes would be the preferred method of routing, however once more routers are added this becomes very inpractial and dynamic routing protocols like RIP, IGRP etc should be used. However you could add static routes for the preferred links and then run RIP to take over in the event of a link going down. If you intend using RIP for anything more than a handful of routers you should either 1) Look at different protocols or 2) Learn more about how rip works (which is beyond the scope of this tutorial).
Let’s use these two addresses for some examples: 22.214.171.124 and 126.96.36.199. If the subnet mask is 255.255.255.0,
the first 24 bits are masked, so the router compares the first 3 octets of the two addresses. Since the masked bits are
not the same, the router knows that these addresses belong to different subnets.
If the subnet mask is 255.255.0.0, the first 16 bits are masked, so the router compares the first 2 octets of the two addresses. Since the masked bits are the same, the router knows that these addresses belong to the same subnet.
Nodes and routers use the mask to identify the data link on which an address resides. For instance, imagine that San Francisco proper is a class B network, and think of the streets as subnets. Each street must have a unique name. How would the postal service deliver a letter or find the correct destination if there were two Lombard Streets? Each house number can be thought of as a unique identifier for that street. The house numbers themselves can be duplicated on other streets: 33 Market Street is not the same as 33 Van Ness Avenue.
171.68. 3. 3
171.68. 2. 3
Sometimes you need to perform a logical “AND” operation to find out what subnet your node is in. Performing an “AND” operation means that anytime you “AND” a 0 value to another 0 or a 1 value, the result is 0. Only a 1 ANDed with another 1 value will result in a 1 value. Here’s how it works:
0 AND 0 IS 0
0 AND 1 IS 0
1 AND 1 IS 1
Let’s compare our sample addresses (188.8.131.52 and 184.108.40.206) against the subnet mask 255.255.240.0. We need to compare the binary representation of the third octet of the mask with the binary representation of the third octets of the addresses. In order to do this, we’ll perform a logical “AND” operation on the corresponding bits in each octet.
The masked bits are those that are “turned on,” or 1 in the mask. Since the masked bits in both addresses are the same, the router knows that these addresses belong to the same subnet.
Example 1: Class B
Let’s use a class B address to illustrate how subnetting works. Let’s say you were assigned the class B address 172.16 from the NIC. First determine how many subnets you need, and how many nodes per subnet you need to define. A typical (and easy to use) class B subnet mask would be 8 bits. Since the 3rd octet is the first “free” octet for Class B, you will start there. So, an 8 bit subnet mask would be 255.255.255.0. This means you have 254* subnets available and 254 addresses for nodes per subnet.
*Why are there only 254 subnets available instead of 256 (0-255)? You should not use subnet 0 or a subnet of all 1s. With an all 1s subnet mask, this is also your broadcast address. You can configure this, but it is neither proper nor recommended to make your subnet the same as your broadcast address. Subnet 0 is also not recommended. Cisco will allow the use of subnet 0 with the IP subnet zero command.
Example 2: Class B
Now let’s take this example: you have just assigned an interface the address 172.16.10.50 with a mask of 255.255.255.0. What subnet is it in? First represent the bits in binary (for class B, you start with the 3rd octet since octets 1 and 2 are fixed).
00001010 00110010 (address representation – 10.50)
11111111 00000000 (subnet mask representation – 255.0)
00001010 00000000 (results of logical “AND” – subnet 10) 10
This address is in subnet 10 (172.16.10.0). Valid addresses for subnet 10 would be 172.16.10.1 through 172.16.10.254. Address 172.16.10.255 is the broadcast address for this subnet. According to the standard, any host id consisting of all 1s is reserved for broadcast.
Keeping the same subnet mask, you can choose different addresses to be in different subnets. For instance, address
220.127.116.11 255.255.255.240 is in subnet 16 and therefore has another unique subnet address, with valid addresses in the
range of 18.104.22.168 through 22.214.171.124.
Class B Effective Effective
# bits Mask Subnets Hosts
——- ————— ——— ———
2 255.255.192.0 2 16382
3 255.255.224.0 6 8190
4 255.255.240.0 14 4094
5 255.255.248.0 30 2046
6 255.255.252.0 62 1022
7 255.255.254.0 126 510
8 255.255.255.0 254 254
9 255.255.255.128 510 126
10 255.255.255.192 1022 62
11 255.255.255.224 2046 30
12 255.255.255.240 4094 14
13 255.255.255.248 8190 6
14 255.255.255.252 16382 2
Class C Effective Effective
# bits Mask Subnets Hosts
——- ————— ——— ———
2 255.255.255.192 2 62
3 255.255.255.224 6 30
4 255.255.255.240 14 14
5 255.255.255.248 30 6
6 255.255.255.252 62 2
*Subnet all zeroes and all ones excluded.
*Host all zeroes and all ones excluded.