Router: a network device that forwards traffic depending on the destination address of that traffic
has at least two network interfaces
Basic Routing Steps
1) The router receives data packets
2) The router examines the destination IP of the packet
3) The router looks up destination addresses in the routing table
4) The router forwards traffic to destination
Example
Imagine router connected to two networks
Network A:
IP: 192.168.1.1
CIDR: 192.168.1.0/24
Computer A IP: 192.100.1.100
Computer A
Network B:
IP: 10.0.0.254
CIDR: 10.0.0.0/24
Computer B: 10.0.0.10
Source MAC address: 00:00:0A:BB:28:FD
Destination MAC address: 00:)A:95:9D:68:16
Network C:
Address Space: 172.16.1.100/23
Router connecting Network B and Network C w/ IP of: 10.0.0.0, and interface on network c has an IP of 172.16.1.1.
Situation: Computer A from Network Asends data to the MAC address of its gateway (the router) because it recognizes that the IP address of computer B is not local. The routers interface on Network A receives the packet because it sees that the destination MAC address belongs to it. The router strips the data link layer encapsulation, leaving the IP datagram. The router examines the IP datagram header for the destination IP field. The router finds the destination IP address, looks at its routing table, and sends the data to Network B. The router also has the MAC address in its ARP table. The router forms a new data packet to forward to Network B. The router takes the data from the first IP datagram and duplicates it, but decrements the TTL field by one and calculates a new checksum. The router then encapsulates this new IP datagram inside of a new Ethernet frame. It sets its own MAC address on the interface of Network B as the source MAC address. Since it has the mac address of 10.0.0.10 in its ARP table, it sets that as the destination mac address. The packet is sent out of the interface on Network B and delivered to the nodes on Computer B’s IP address (10.0.0.10). If there is a Network C, it will go from Network A to Router A, which decrements the TTL field before sending to Network B to Router B, which goes through above steps and forwards packet to final destination. To protect against breakages, core routers are connected in a mesh, meaning there may be many different paths for a packet to take
Routing Table:
Most basic will have four columns:
Destination network: column would contain a row for each network that the router knows about (definition of the remote network- network ID and net mask, which may be stored in one column insider notation or in a separate column)
Next hop:the IP address of the next router that should receive data intended for the destination network in question
Total hops: each next hop and destination network to keep track of how far destination is and keep track of the best path available
Interface: must know which interface it should forward traffic matching the destination network out of
Routing Protocols: special protocols routers use to speak to each other and share available information
Interior Gateway Protocols: used by routers to share information within a single autonomous system (collection of networks under a single network operator)
Link State Routing Protocols: each router advertises the state of the link of each of its interfaces, which could be connected to other routers or direct connections to networks
Each router knows every detail about every other router in the system
Using this new set of information, the router runs complicated algorithms to determine the best path to any destination network
Requires more memory to hold all of the data and more processing data
Distance-Vector Protocols: Older standard where a router takes the routing table (list of every network known to it) and how far these networks are in terms of hops. Then the router sends the list (vector) to all neighboring routers.
Router knows little of total state of an autonomous system- only information of immediate neighbors
Router will update routing table based on new information from neighboring routers
Slow to respond to changes far from immediate network
Exterior Gateway Protocols: Used for exchange of information between independent autonomous systems