The Second Internet HTML version – Basic IPv4 Routing
In the simplest case, where two nodes (A and B) are on the same network segment (not separated by
any router), no routing is required. This is determined by examining B’s IP address. If it is in the same
subnet as A’s IP address, then B is a local node. Node A simply uses B’s MAC address from its MAC table
to send the packet to B. If there is no entry for B’s IP address, then ARP is used to do address resolution
(obtain the MAC address for B).
If B’s address is not in the local subnet, B is not a local node, and the packet (with B’s correct IP address
as the destination) is sent to the node which serves as the default gateway for A’s subnet (A may first
have to do an ARP to obtain the MAC address of the default gateway). The default gateway is a node
with multiple network interfaces that knows how to forward the packet on towards the network in
which B’s IP address is found. Note that by default, packet forwarding (relaying packets from one
interface to another on a multi-homed system) is not enabled. It must be specifically enabled for each
protocol (IPv4 and IPv6). The address of a network’s default gateway is known to every node in a subnet,
either through manual configuration or via DHCPv4. Once the default gateway receives the packet, it
may already have the necessary routing information to know where to send that packet (either via static
routes, or via a routing protocol, such as RIP, OSPF and/or BGP). In the case of a home network, your
SOHO router typically just knows how to forward packets for the outside world to yet another gateway
at the ISP, where the real routing takes place (via its own default gateway, which is a node at the ISP).
Once your traffic gets to your default gateway, that node typically uses an Interior Gateway Routing
Protocol (RIP. RIPv2 or OSPF) to route that traffic to the edge of your overall network (e.g. the place
your organization’s or ISP’s network connects to the rest of the Internet). At that point, an Exterior
Gateway Routing Protocol (typically BGP-4) is used to determine the best route to the correct edge
router for the destination address. Once your traffic arrives there, once again an Interior Gateway
Routing Protocol (RIP, RIPv2 or OSPF) takes over and get the packets to the default gateway of the
subnet where the destination node lives. From there, ARP is used to forward the packets to the actual
destination node, because the default gateway and the destination node are now on the same subnet.
And all this takes place in the blink of an eye, billions of times a day, just like clockwork.
3.4 – TCP: The Transmission Control Protocol
The Transmission Control Protocol is defined in RFC 793, “Transmission Control Protocol”, September
1981. This is a Transport Layer protocol. TCP implements a reliable, connection oriented model. When
we say reliable, we aren’t talking about a well designed or robust protocol. With respect to TCP,
“reliable” simply means that it includes error detection and recovery (via retransmission). The term
connection oriented refers to the fact that TCP is designed to handle potentially large streams of data
(typically larger than a single packet). It does this by breaking the large object up into multiple packet
sized chunks and sending them out in an ordered sequence. For example, a large e-mail message or a
JPEG photograph might require quite a few packets. Software that uses TCP typically opens (initiates) a
connection for I/O, reads and/or writes potentially a lot of data to it, then when done, closes
(terminates) the connection. This is very similar to the process for reading and writing files, and in fact in
UNIX, network streams are just a special kind of file.