3.1 How a Host Routes Flashcards
With both IPv4 and IPv6, packets are always created at the source host. The source host must be able to direct the packet to the destination host. To do this, host end devices create their own routing table. This topic discusses how end devices use routing tables.
Another role of the network layer is to direct packets between hosts. A host can send a packet to the following:
Itself - A host can ping itself by sending a packet to a special IPv4 address of 127.0.0.1 or an IPv6 address ::1, which is referred to as the loopback interface. Pinging the loopback interface tests the TCP/IP protocol stack on the host.
Local host - This is a destination host that is on the same local network as the sending host. The source and destination hosts share the same network address.
Remote host - This is a destination host on a remote network. The source and destination hosts do not share the same network address.
Whether a packet is destined for a local host or a remote host is determined by the source end device. The source end device determines whether the destination IP address is on the same network that the source device itself is on. The method of determination varies by IP version:
In IPv4 - The source device uses its own subnet mask along with its own IPv4 address and the destination IPv4 address to make this determination.
In IPv6 - The local router advertises the local network address (prefix) to all devices on the network.
In a home or business network, you may have several wired and wireless devices interconnected together using an intermediary device, such as a LAN switch or a wireless access point (WAP). This intermediary device provides interconnections between local hosts on the local network. Local hosts can reach each other and share information without the need for any additional devices. If a host is sending a packet to a device that is configured with the same IP network as the host device, the packet is simply forwarded out of the host interface, through the intermediary device, and to the destination device directly.
Of course, in most situations we want our devices to be able to connect beyond the local network segment, such as out to other homes, businesses, and the internet. Devices that are beyond the local network segment are known as remote hosts. When a source device sends a packet to a remote destination device, then the help of routers and routing is needed. Routing is the process of identifying the best path to a destination. The router connected to the local network segment is referred to as the default gateway.
DEFAULT GATEVWAY
The default gateway is the network device (i.e. router or Layer 3 switch) that can route traffic to other networks.
On a network, a default gateway is usually a router with these features:
It has a local IP address in the same address range as other hosts on the local network.
It can accept data into the local network and forward data out of the local network.
It routes traffic to other networks.
A default gateway is required to send traffic outside of the local network. Traffic cannot be forwarded outside the local network if there is no default gateway, the default gateway address is not configured, or the default gateway is down.
A host routing table will typically include a default gateway. In IPv4, the host receives the IPv4 address of the default gateway either dynamically from Dynamic Host Configuration Protocol (DHCP) or configured manually. In IPv6, the router advertises the default gateway address or the host can be configured manually.
Having a default gateway configured creates a default route in the routing table of the PC. A default route is the route or pathway your computer will take when it tries to contact a remote network.
On a Windows host, the route print or netstat -r command can be used to display the host routing table. Both commands generate the same output.
Entering the netstat -r command or the equivalent route print command displays three sections related to the current TCP/IP network connections:
Interface List - Lists the Media Access Control (MAC) address and assigned interface number of every network-capable interface on the host, including Ethernet, Wi-Fi, and Bluetooth adapters.
IPv4 Route Table - Lists all known IPv4 routes, including direct connections, local network, and local default routes.
IPv6 Route Table - Lists all known IPv6 routes, including direct connections, local network, and local default routes.
When a host sends a packet to another host, it consults its routing table to determine where to send the packet. If the destination host is on a remote network, the packet is forwarded to the default gateway, which is usually the local router.
The router examines the destination IP address of the packet and searches its routing table to determine where to forward the packet. The routing table contains a list of all known network addresses (prefixes) and where to forward the packet. These entries are known as route entries or routes. The router will forward the packet using the best (longest) matching route entry.
The routing table of the router contains network route entries listing all the possible known network destinations.
The routing table stores three types of route entries:
Directly-connected networks - These network route entries are active router interfaces. Routers add a directly connected route when an interface is configured with an IP address and is activated. Each router interface is connected to a different network segment. In the figure, the directly-connected networks in the R1 IPv4 routing table would be 192.168.10.0/24 and 209.165.200.224/30.
Remote networks - These network route entries are connected to other routers. Routers learn about remote networks either by being explicitly configured by an administrator or by exchanging route information using a dynamic routing protocol. In the figure, the remote network in the R1 IPv4 routing table would be 10.1.1.0/24.
Default route – Like a host, most routers also include a default route entry, a gateway of last resort. The default route is used when there is no better (longer) match in the IP routing table. In the figure, the R1 IPv4 routing table would most likely include a default route to forward all packets to router R2.
A router can learn about remote networks in one of two ways:
Manually - Remote networks are manually entered into the route table using static routes.
Dynamically - Remote routes are automatically learned using a dynamic routing protocol.
STATIC ROUTES
Static routes are route entries that are manually configured.
The static route includes the remote network address and the IP address of the next hop router.
If there is a change in the network topology, the static route is not automatically updated and must be manually reconfigured.
A static route does not automatically adjust for topology changes.
Static routing has the following characteristics:
A static route must be configured manually.
The administrator needs to reconfigure a static route if there is a change in the topology and the static route is no longer viable.
A static route is appropriate for a small network and when there are few or no redundant links.
DYNAMIC ROUTING
A dynamic routing protocol allows the routers to automatically learn about remote networks, including a default route, from other routers. Routers that use dynamic routing protocols automatically share routing information with other routers and compensate for any topology changes without involving the network administrator. If there is a change in the network topology, routers share this information using the dynamic routing protocol and automatically update their routing tables.
Dynamic routing protocols include Open Shortest Path First (OSPF) and Enhanced Interior Gateway Routing Protocol (EIGRP)
OSPF
Open Shortest Path First
EIGRP
Enhanced Interior Gateway Routing Protocol
Basic configuration only requires the network administrator to enable the directly connected networks within the dynamic routing protocol. The dynamic routing protocol will automatically do as follows:
Discover remote networks
Maintain up-to-date routing information
Choose the best path to destination networks
Attempt to find a new best path if the current path is no longer available
When a router is manually configured with a static route or learns about a remote network dynamically using a dynamic routing protocol, the remote network address and next hop address are entered into the IP routing table.
If there is a change in the network topology, the routers will automatically adjust and attempt to find a new best path.
Note: It is common for some routers to use a combination of both static routes and a dynamic routing protocol.
Unlike a host computer routing table, there are no column headings identifying the information contained in the routing table of a router.
show ip route
The show ip route privileged EXEC mode command is used to view the IPv4 routing table on a Cisco IOS router.
At the beginning of each routing table entry is a code that is used to identify the type of route or how the route was learned. Common route sources (codes) include these:
L - Directly connected local interface IP address
C – Directly connected network
S – Static route was manually configured by an administrator
O - OSPF
D - EIGRP
A directly connected route is automatically created when a router interface is configured with IP address information and is activated. The router adds two route entries with the codes C (i.e., the connected network) and L (i.e., the local interface IP address of the connected network). The route entries also identify the exit interface to use to reach the network.