004 Kathara Lab - Static Routing
004 Kathara Lab - Static Routing
Dipartimento di Ingegneria
Computer Networks Research Group
kathara lab
static-routing
Version 1.0
Author(s) G. Di Battista, M. Patrignani, M. Pizzonia, F. Ricci, M.
Rimondini
E-mail [email protected]
Web http://www.kathara.org/
Description an example of configuration of static routes –
kathara version of netkit lab static-routing vers. 2.2
© Computer Networks Research
Group Roma Tre
Copyright notice
All the pages/slides in this presentation, including but not limited to, images, photos, animations,
videos, sounds, music, and text (hereby referred to as “material”) are protected by copyright.
This material, with the exception of some multimedia elements licensed by other organizations, is
property of the authors and/or organizations appearing in the first slide.
This material, or its parts, can be reproduced and used for didactical purposes within universities and
schools, provided that this happens for non-profit purposes.
Information contained in this material cannot be used within network design projects or other products
of any kind.
Any other use is prohibited, unless explicitly authorized by the authors on the basis of an explicit
agreement.
The authors assume no responsibility about this material and provide this material “as is”, with no
implicit or explicit warranty about the correctness and completeness of its contents, which may be
subject to changes.
This copyright notice must always be redistributed together with the material, or its portions.
pc1 pc2
195.11.14.0/24 200.1.1.0/24
r1 100.0.0.8/30 r2
.5 eth0 eth0 .7
.1 eth0 eth0 .1
collision domain B
r1 r2
eth1 100.0.0.8/30 eth1
.9 .10
r2[0]=C
r2[1]=B
pc1[0]=A
pc2[0]=C
pc1.startup
ifconfig eth0 195.11.14.5 netmask 255.255.255.0 broadcast 195.11.14.255 up
#route add default gw 195.11.14.1 dev eth0
the routing table entries
will be added manually
pc2.startup
ifconfig eth0 200.1.1.7 netmask 255.255.255.0 broadcast 200.1.1.255 up
#route add default gw 200.1.1.1 dev eth0
r2.startup
ifconfig eth0 200.1.1.1 netmask 255.255.255.0 broadcast 200.1.1.255 up
ifconfig eth1 100.0.0.10 netmask 255.255.255.252 broadcast 100.0.0.11 up
#route add -net 195.11.14.0 netmask 255.255.255.0 gw 100.0.0.9 dev eth1
pc1 pc2
200.1.1.7
195.11.14.5 eth0 eth0
r1 r2
eth1 eth1
© Computer Networks Research
Group Roma Tre kathara – [ lab: static routing ] last update: Nov 2019
step 3 – inspecting routing tables
both routers and pcs don’t know how to reach networks that are not directly connected to
them
r1
r1:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
100.0.0.8 * 255.255.255.252 U 0 0 0 eth1
195.11.14.0 * 255.255.255.0 U 0 0 0 eth0
r1:~# █
directly connected networks are automatically inserted into the routing table when the
corresponding interface is brought up
this is a common behavior of all ip devices (even real-world routers!)
pc1
pc1:~# route add default gw 195.11.14.1
pc1:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
195.11.14.0 * 255.255.255.0 U 0 0 0 eth0
default 195.11.14.1 0.0.0.0 UG 0 0 0 eth0
pc1:~# █
pc1 pc2
200.1.1.7
195.11.14.5 eth0 eth0
r1 r2
© Computer Networks Research Group Roma
Tre eth1 kathara – [ lab: static routing ] eth1 last update: Nov 2019
step 4 – default routes on pcs: test
pc1
pc1:~# ping 100.0.0.10 interfaces on
PING 100.0.0.10 (100.0.0.10) 56(84) bytes of data. r2 seem
--- 100.0.0.10 ping statistics --- unreachable!
7 packets transmitted, 0 received, 100% packet loss, time 6105ms
pc1:~# █
can you tell
why?
pc1 pc2
200.1.1.7
195.11.14.5 eth0 eth0
r1 r2
© Computer Networks Research Group Roma
Tre eth1 kathara – [ lab: static routing ] eth1 last update: Nov 2019
step 4 – let’s inspect the network
do echo request packets reach r2?
let’s check...
while pinging from pc1 100.0.0.10 sniff on interface eth1 of r2
r2
r2:~# route add -net 195.11.14.0 netmask 255.255.255.0 gw 100.0.0.9 dev eth1
network 195.11.14.0...
...with netmask …is reachable via
255.255.255.0... 100.0.0.9…
r2:~# route …on interface eth1
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
100.0.0.8 * 255.255.255.252 U 0 0 0 eth1
200.1.1.0 * 255.255.255.0 U 0 0 0 eth0
195.11.14.0 100.0.0.9 255.255.255.0 UG 0 0 0 eth1
r2:~# █
r1
r1:~# route add -net 200.1.1.0 netmask 255.255.255.0 gw 100.0.0.10 dev eth1
r1:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
100.0.0.8 * 255.255.255.252 U 0 0 0 eth1
200.1.1.0 100.0.0.10 255.255.255.0 UG 0 0 0 eth1
195.11.14.0 * 255.255.255.0 U 0 0 0 eth0
r1:~# █