All About IP Addresses
The
key to understanding IP, and all of the issues related to IP, is
knowing what a routing table looks like and the effects each IP topic
has on the entries in a routing table. To begin with, let's review the
basics. IP addresses are 32 bit numbers, most commonly represented in
dotted decimal notation (xxx.xxx.xxx.xxx). Each decimal number
represents eight bits of binary data, and therefore can have a decimal
value between 0 and 255. IP addresses most commonly come as class A, B,
or C. It's the value of the first number of the IP address that
determines the class to which a given IP address belongs. Class D
addresses are used for multi-cast applications.
(For a full explanation of class D addresses, refer to "Diving Through the Layers" .) The range of values for these classes are given below.
Class Range Allocation
A 1-126 N.H.H.H
B 128-191 N.N.H.H
C 192-223 N.N.N.H
D 224-239 Not applicable
N=Network
H=Host
Note 1: 127.0.0.0 is a class A network,
but is reserved for use as a loopback address
(typically 127.0.0.1).
Note 2: The 0.0.0.0 network is reserved for use as the default route.
Note 3: Class D addresses are used by groups of hosts or routers
that share a common characteristic: e.g. all OSPF devices
respond to packets sent to address 224.0.0.2
Note 4: Class E addresses exist (240-248),
but are reserved for future use
The
class of an address defines which portion of the address identifies the
Network number and which portion identifies the Host, as illustrated
above, as N and H.
So,
without any subnetting (which we will come to a little later), a
routing table will keep track of a) network numbers, b) the next hop
router to use to get to that network, and c) the interface this next hop
router is reachable through. A simple network with the corresponding
routing table for a Cisco router is illustrated below.
C 199.2.2.0 directly connected Ethernet 0
C 10.0.0.0 directly connected Token-ring 1
C 152.8.0.0 directly connected Ethernet 1
I 200.1.1.0 via 152.8.1.2 Ethernet 1
Since
Cisco doesn't give headings for these columns, you need to know what
each column consists of. The first column of the routing table indicates
how the network number was discovered. C stands for Connected and I
indicates the network was learned from the IGRP routing protocol. For a
full description of the routing table as it appears in a UNIX host and a
Cisco router, refer to "Should RIP Rest In Peace" .
The
important thing to realize is that while a routing table keeps track of
network numbers, no one assigns a network number to any piece of
equipment. Every interface of a router or host connected on the network
must have an IP address and a subnet mask defined (many pieces of
equipment will assign a default subnet mask if none is applied). From
this IP address and subnet mask, the network number is derived by the IP
stack and tracked in the routing table.
(This
is the exact opposite of what happens in a NetWare network. In NetWare,
you assign a network number to a server LAN card, which is used by all
workstations on that wire. The workstations use MAC addresses as IPX
node numbers.)
Routing
tables can get very large. Internet backbone routers can have over
40,000 routes defined in them. In most corporate networks, the routing
table is much smaller, as there are not so many subnets that need to be
reached.
Many
large routers, particulary internet routers, use a method called
Classless Interdomain Routing (CIDR) to reduce the number of entries a
router needs in its routing table. If we imagine, for instance, that all
the Class C addresses that start with the value 194 are allocated for
use in Europe, it would significantly reduce the number of entries in
Internet routers in the US if there was only one entry for all these
class C addresses, rather than a separate entry in the routing table for
each one. CIDR works if (as in this example) all the networks with the
first octet value of 194 are physically located in one area of the
network.
IP
addresses are used to deliver packets of data across a network and have
what is termed end-to-end significance. This means that the source and
destination IP address remains constant as the packet traverses a
network. Each time a packet travels through a router, the router will
reference it's routing table to see if it can match the network number
of the destination IP address with an entry in its routing table. If a
match is found, the packet is forwarded to the next hop router for the
destination network in question (note that a router does not necessarily
know the complete path from source to destination--it just knows the
next hop router to go to). If a match is not f ound, one of two things
happens. The packet may be forwarded to the router defined as the
default gateway, or the packet may be dropped by the router. (In the
language of TCP/IP, a gateway is a router.)
Packets
are forwarded to a default router in the belief that the default router
has more network information in its routing table and will therefore be
able to route the packet correctly on to its final destination. This is
typically used when connecting a LAN with PCs on it to the Internet.
Each PC will have the router that connects the LAN to the Internet
defined as its default gateway.
A
default gateway is seen in a routing table of a host as follows: the
default route 0.0.0.0 will be listed as the destination network, and the
IP address of the default gateway will be listed as the next hop
router.
If
the source and destination IP addresses remain constant as the packet
works its way through the network, how is the next hop router addressed?
In a LAN environment this is handled by the MAC (Media Access Control)
address, as illustrated below. The key point is that the MAC addresses
will change every time a packet travels though a router, however, the IP
addresses will remain constant.
PC1 Router E0 Router E1 PC2
MAC Address M1 M2 M3 M4
Software (IP) address 11 12 13 14
A packet sent from PC1 to PC2 will look like this at point A:
Destination Source Destination Source Data
MAC MAC IP IP
M2 M1 14 11 1001001
A packet sent from PC1 to PC2 will look like this at point B:
Destination Source Destination Source Data
MAC MAC IP IP
M4 M3 14 11 1001001
0 comments: