Dynamic routing

  • Review of IP forwarding / routing from the last networking lecture. Contents of the routing table.
  • Difference between IP forwarding and routing information exchange:
    • IP forwarding is when you forward IP packets according to the routing table. That is a responsibility of the IP protocol.
    • Routing information exchange is when you fill your routing table with routing information from your neighboring routers.
  • Difference between static and dynamic routing:
    • Static routing is when you fill the routing table manually (with the intervention of a network administrator).
    • Dynamic routing is when you run a program (a daemon) on your router and exchange the contents of the routing table with your neighbors via a routing protocol.
  • Connected routes are routes added to the routing table automatically by the kernel when you assign an IP address to an interface. These routes represents networks directly connected and reachable from the router (there’s no other option: If the router is part of the network, the network must be directly reachable from the router). These routes do not have gateway, only an interface in the routing table. Example: If we assign an IP address of 10.0.0.1 to the router, connected route 10.0.0.0/24 dev eth0 automatically appears in the routing table.
  • Examples of dynamic routing protocols:
  • The Internet is divided into so called autonomous systems (AS).
  • The first two protocols are used for routing information exchange inside ASes.
  • The last is used for routing information exchange inbetween the ASes.
  • BIRD is a routing daemon capable of running all of the mentioned routing protocols.

Example 1: Transit AS - configuration of BIRD

transit_as

Here AS 65000 acts as a so called transit AS – traffic from AS 65001 and AS 65002 flows through the router in the middle, so IP forwarding on that router must be enabled.

BIRD configuration file on the middle router:

log syslog all;

protocol device {
}

protocol direct {
	ipv4;
}

protocol kernel {
	ipv4 {
	      import all;
	      export where source ~ [ RTS_BGP ];
	};
}

protocol bgp as1 {
	local 10.0.1.1 as 65000;
	neighbor 10.0.1.2 as 65001;
	ipv4 {
		import all;
		export all;
	};
}

protocol bgp as2 {
	local 10.0.2.1 as 65000;
	neighbor 10.0.2.2 as 65002;
	ipv4 {
		import all;
		export all;
	};
}

BIRD configuration file on the left (and right) router:

log syslog all;

protocol device {
}

protocol direct {
	ipv4;
}

protocol kernel {
	ipv4 {
	      import all;
	      export where source ~ [ RTS_BGP ];
	};
}

protocol bgp transit {
	local 10.0.1.2 as 65001;      # On the right router, there is: "local 10.0.2.2 as 650002;"
	neighbor 10.0.1.1 as 65000;   # On the right router, there is: "neighbor 10.0.2.1 as 65000;"
	ipv4 {
		import all;
		export all;
	};
}

Example 2: IXP AS - configuration of BIRD

ixp_as

In this example, the middle router acts as a so called route server. It means that many BGP peers (the number of peers doesn’t have to be known in advance) connect to the route server only to exchange the routing information. Given the fact that all the routers are connected through the switch to the same network, the trafic can be forwarded directly between the routers through the switch. Therefore IP forwarding does not have to be enabled on the route server as it only serves the routing information to its BGP peers.

BIRD configuration file on the middle router:

log syslog all;

protocol device {
}

protocol direct {
	ipv4;
}

protocol kernel {
	ipv4 {
	      import all;
	      export none;
	};
}

protocol bgp routeserver {
	local 10.0.0.1 as 65000;
	neighbor range 10.0.0.0/24 external;
	rs client;
	ipv4 {
		import all;
		export all;
	};
}

BIRD configuration file on the left (and right) router:

log syslog all;

protocol device {
}

protocol direct {
	ipv4;
}

protocol kernel {
	ipv4 {
	      import all;
	      export where source ~ [ RTS_BGP ];
	};
}

protocol bgp ixp {
	local 10.0.0.2 as 65001;     # On the right router, there is: "local 10.0.0.3 as 650002;"
	neighbor 10.0.0.1 as 65000; 
	ipv4 {
		import all;
		export all;
	};
}

IXP stands for Internet Exchange Point. In simple words, it is a very powerful switch or more precisely set of switches connected together in a redundant way, so that all ISPs can easily connect to the switch to establish BGP peering relations in between them. Often the operator of the IXP runs a route server (as shown in Example 2) in the IXP to easy the establishment of the BGP relations.