Lecture 5
Basic Setup
Data Link Layer "Routing": Directly Connected
Only outgoing interface and L2 address (MAC) needed
L2 address obtained through ARP in IPv4 and NDP in IPv6
Frames are selectively flooded on L2
Switches use a lookup table to map L2 addresses to outgoing interfaces
If unknown, flood everywhere except source interface
STP takes care of loop, as to not create a broadcast storm with flooding
Global Routing: Not Directly Connected
When not directly connected, we need a gateway (next hop)
Use the system's default gateway: 0.0.0.0/0 -> eth0
Routing table:
Keep track of best paths
Forwarding: choose which path (there may be multiple) to use
%20Inter-Networking%20and%20Routing/Attachments/Pasted%20image%2020250916104036.png)
Use recursive lookup
In practice only 1 level, so gateway should be directly connected
In theory, deeper recursion is possible
Classical (Outdated) Commands
Directly Connected IP Networks
Traditional config using ifconfig command
iwconfig for wireless interfaces
Routing Table
netstat -r: The traditional command to show the routing table
Contains:
- The destination
- The gateway (next hop)
- The subnet mask of the destination address
- The interface to forward it to
route is the same as netstat -r, but also allows modifying the route table
Add a static default route:
route add default <gateway>
Add a static host route:
route add -host <host> gw <gateway>
Add a static network route:
route add -net <network> netmask <netmask> gw <gateway>
You could consider adding static routes instead of letting the protocols work:
- Deterministic, always the same
- Backup options
ARP Table
Read the ARP table: arp
Delete an entry: arp -d <address>
Add a static entry: arp -s <address> <hardware_address>
This also prevents ARP spoofing
ARP data stays in the subnet, the router is the border
Modern Commands
The ip command
Introduced by linux iproute2 package
Meant to replace ifconfig, route and arp
Has support for:
IPv6
Multicast
Multiple routing tables (e.g. for VLANs)
Subcommands:
link: L2 settings (MAC)
address L2 settings (IP)
maddress: L2/3 multicast membership
neighbour ARP cache date
rule: routing table selection
ss, iw and ethtool commands
ss replaces netstat: shows socket status and statistics
iw replaces iwconfig: a utility for wireless devices
ethtool: shows and controls the network driver and hardware status
Route Selection
Longest prefix match: host routes are preferred over network routes
If you know the full address, might as well use it
Default route has shortest prefix
Last resort
Cannot be used in the internet core: might create loops, if present
Mathematical Representation
As in previous lectures: undirected graphs
Routes are nodes, connections are edges
Labels on edges represent cost
Broadcast networks are represented using "extra" nodes
Node Reduction
Lan with
Full mesh has
With 1 extra node, it can be reduced to
Just an added fake node
%20Inter-Networking%20and%20Routing/Attachments/Pasted%20image%2020250916111837.png)
Works for LANs, but also for Non-Broadcast Multiple Access (NBMA) networks
In many situations
But not always
Assumes all links are the same and working
Routing on the Internet
Based on top-level structure defined by Autonomous Systems (AS)
Each AS has control of a collection of:
- Routers and hosts
- Networks
Similar to the post office of a town
Can be operated by ISPs, companies, universities, ...
There are tiers to ASs
Tier 1: backbone to the internet, no upstream
Tier 2: can upstream to tier 1 AS
Tier 3: smaller ISPs
An Autonomous System (AS) is a connected group of one or more IP prefixes run by one or more network operators which has a single and clearly defined routing policy
Edge routers in one AS can be directly connected to edge routers in another AS
Used for inter-AS routing
Implementing an Exterior Gateway Protocol (EGP)
Border Gateway Protocol 4 (BGP4) is the current choice
No other protocols in use, except variants of BGP
%20Inter-Networking%20and%20Routing/Attachments/Pasted%20image%2020250916112339.png)
Routers within an AS communicate with one another to provide intra-AS routing
Implementing an Interior Gateway Protocol (IGP)
E.g. RIP, OSPF, IS-IS
Extended with an internal exterior protocol (iBGP): the internal part of an exterior protocol
Different Routing Mechanisms
Routing Protocol Classifications
Static:
A "human" protocol
Explicit commands like route add
Side effect of a script
Dynamic:
Automatically determined by a routing protocol
E.g.:
Distance vector (RIP)
Path vector (BGP)
Link state (OSPF, IS-IS)
Distance Vector Routing
Original ARPANET routing algorithm, based on Bellman-Ford
Decentralised
Asynchronous
No selection of "root"
Matrix with costs from node to node
In the end, every node will know the shortest destination from node to node
The full matrix is usually filled, the image is wrong
%20Inter-Networking%20and%20Routing/Attachments/Pasted%20image%2020250916112831.png)
Path Vector Routing
Like distance vector routing, but
Instead of the distance to the destination, the complete path (on AS level) is specified
"It takes 3 hops to reach X" -> "To get to X you have to go through A, B and C"
Still decentralised and async
May depend on explicit or implicit policies
Has consequences for stability and convergence due to incompatible policy rules
Link State Routing
Link state algorithm
Dijkstra
Single source shortest path
Used by OSPF for intra-domain routing
Complete knowledge is distributed to all nodes
Every node executes the algorithm and hence draws consistent conclusions
Scales better than other options
Resolves loops
- Distribute topology information
- Run Dijkstra on the received topology