Title: Managing TCP/IP Based Routing Protocols on GNU Zebra
1Managing TCP/IP Based Routing Protocols on GNU
Zebra
- Computer Network Experiments
- Students Un-Pio Leong, Wei-Min Yao
- Instructor Dr. Ying-Dar Lin
mailto upleong_at_cis.nctu.edu.tw,
wmyao_at_csie.nctu.edu.tw May, 2001
2Objectives
- Configure a router using open source software
- Observation on RIP, OSPF behavior
- Understanding routing protocols implementation by
tracing GNU zebra - Experiments on GNU zebra
3Routing Autonomous System and EGP/IGP
EGP
EGP Exterior Gateway Protocol IGP Interior
Gateway Protocol
4Vector Distance Vs Link-State Routing
- Vector Distance Routing
- RIP
- Bellman-Ford algorithm
- Link-State (SPF) Routing
- OSPF
- Dijkstras algorithm
5Bellman-Ford Algo.
6Bellman-Ford Example
7RIP example
a
b
A
B
C
A ? Link Cost B? Link Cost C? Link Cost
A local 0 B local 0 C local 0
B a 1 A a 1 B b 1
C b 1
A a 1
C a 2 C b 1 A b 2
8Dijkstras Algorithm
9An Example
?
?
7
a
d
5
2
2
4
?
f
b
5
1
s
3
?
1
0
7
e
4
c
4
?
?
10 2
?
7
a
d
5
2
2
4
5
f
b
5
1
s
3
?
1
0
7
e
4
c
4
?
4
11 2
9
7
a
d
5
2
2
4
4
f
b
5
1
s
3
?
1
0
7
e
4
c
4
?
4
12 2
8
7
a
d
5
2
2
4
4
f
b
5
1
s
3
?
1
0
7
e
4
c
4
7
4
13 2
8
7
a
d
5
2
2
4
4
f
b
5
1
s
3
?
1
0
7
e
4
c
4
7
4
14 2
8
7
a
d
5
2
2
4
4
f
b
5
1
s
3
14
1
0
7
e
4
c
4
7
4
15 2
8
7
a
d
5
2
2
4
4
f
b
5
1
s
3
13
1
0
7
e
4
c
4
7
4
16 2
8
7
a
d
5
2
2
4
4
f
b
5
1
s
3
13
1
0
7
e
4
c
4
7
4
17OSPF example
a
b
A
B
C
c
d
e
f
D
E
From To Link Dist. From To Link Dist.
A B a 1 C E e 1
A D c 1 D A c 1
B A a 1 D E f 1
B C d 1 E B d 1
B E b 1 E C e 1
C B b 1 E D f 1
18OSPF example
a
b
A
B
C
c
d
e
f
D
E
From To Link Dist. From To Link Dist.
A B a Inf. C E e 1
A D c 1 D A c 1
B A a Inf. D E f 1
B C d 1 E B d 1
B E b 1 E C e 1
C B b 1 E D f 1
19Routing Software
Gated GNU Zebra MRT
Program size Big, more than 100,000 line code Small, modularization One process for each protocol One big daemon Libraries provide protocol implementations
Task and memory management Yes Leave it to kernel Yes
Dynamic configuration change Not supported Yes Yes
License Product GPL Free
20Kernel Packet Processing Control and Data
Packets
21GNU Zebra Software Pieces
22Zebra Protocol and Netlink/RTNetlink
23Client Server Interaction in Zebra Protocol
zclient_init() Install callback functions
Make zebra server socket
zclient_connect
Zebra connection
Zebra client APIs
Zebra server APIs
callback functions
24Zebra Client/Server Protocol
Zebra IPv4 route message API
Zebra Server
zsend_interface_add,delete
zsend_interface_address_add,delete
zsend_interface_up,down
zsend_ipv4_add,delete
zsend_ipv4_add,delete_multipath
Zebra client
zapi_ipv4_add, delete
zebra_interface_add_read
zebra_interface_state_read
zebra_interface_address_add,delete_read
/ Structure for the zebra client. / struct
zclient / Other data structures here /
/ Pointer to the callback functions. / int
(interface_add) () int (interface_delete)
() int (interface_up) () int
(interface_down) () int (interface_address_a
dd) () int (interface_address_delete) ()
int (ipv4_route_add) () int
(ipv4_route_delete) ()
25RIP Daemon (ripd)
26OSPF Daemon (ospfd)
Initialization Scheduling
Interface
Route
OSPF core ip_ospf_interface ip_ospf_neighbor ospf_
router_id network_area show_ip_ospf_cmd
LSA Link State Advertisement
Network
Route Map route_map_update route_map_event
OSPF SPF calcuation
LSDB
OSPF Flooding
ASE AS external route calculation
27RIP Problems Count to Infinity and Slow
Convergence
Router 1 Router 1 Router 1
Dest. Distance Route
Net 1 1 direct
Router 2 Router 2 Router 2
Dest. Distance Route
Net 1 2 R1
Router 1 Router 1 Router 1
Net 1 16 infinity
Router 2 Router 2 Router 2
Net 1 2 R1
Net 1 3 R2
Net 1 4 R1
Net 1 5 R2
Net 1 6 R1
Net 1 16 infinity
Net 1 16 infinity
28Experiments
- RIP
- Active and Passive mode router
- Tracing RIP messages
- Count to infinity and slow convergence
- OSPF
- Cold start
- Break a link
- Delete a router
- Expected result
- Routing table status
- Routing protocol messages
- The output from netstat, traceroute, ping,
gprof/kprof
29Experiment -- Active and Passive RIP Router
Dest Gateway Netif
192.168.167.0/24 192.168.167.1 eth0
192.168.188.0/24 192.168.188.1 eth1
Dest Gateway Netif
192.168.167.0/24 192.168.167.1 eth0
192.168.188.0/24 192.168.167.1 eth0
192.168.199.0/24 192.168.199.2 eth1
30Experiment Analyze RIPv1, RIPv2 messages
Set the routers to RIPv1 and RIPv2 Logging the
rip information from both router Compare RIPv1
(broadcast) and RIPv2 (multicast)
31Experiment Count to Infinity and Slow
Convergence
Set the interface not to perform split horizon
and disable triggered update ripd conf
t ripd(config) interface eth0 ripd(config-if)
no ip split-horizon
Set RIP routing subnet ripd(config) router
rip ripd(config-router) route 192.168.188.0/24 ri
pd(config-router) no route 192.168.188.0/24
32Zebra Program Profiling Call-Graph
33Data Display Debugger (ddd) on ripd
34References
- GNU zebra, http//www.zebra.org
- Gated, http//www.gated.org
- Multi-threaded routing toolkit,
http//www.mrtd.net - KProf, http//kprof.sourceforge.net
- RFC 2453, RIP Version 2
- RFC 2328, OSPF Version 2