Beruflich Dokumente
Kultur Dokumente
different machines like hosts, routers etc. several network interfaces several protocols complex topologies
Netkit is based on virtual machines which can be run as applications on a standard linux machine Each VM is a full fledged linux machine with
a console memory cut into the host's memory virtual network interfaces etc.
some rights reserved
Starting a simple VM
sabu@laptop$ vstart pc1
PC1
Starting a simple VM
sabu@laptop$ vstart pc1
CD1
Setting IP address ifconfig Setting Route route Echo Reply ping Packet Sniffing tcpdump Trace packet route - traceroute
PC1
eth0
192.168.1.5 CD1
Starting a second VM
sabu@laptop$ vstart pc2 --eth0=CD1
CD1
PC1
eth0
192.168.1.5
PC2
eth0
PC1
eth0
192.168.1.5
PC2
eth0
192.168.1.6
PC1
eth0
192.168.1.5
PC2
eth0
192.168.1.6
ARP Table
pc2# arp
PC1
eth0
192.168.1.5
PC2
eth0
192.168.1.6
Packet Analysis
pc2# tcpdump -i eth0
TCPDUMP listens on the interface eth0 captures all packets arriving there
Packet Analysis
pc2# tcpdump -i eth0
TCPDUMP listens on the interface eth0 captures all packets arriving there packet details can be saved to file and analyzed with WIRESHARK.
PC2
eth0 ROUTER 1
192.168.1.6
eth0
eth1
CD1
CD2
some rights reserved
PC2
eth0
192.168.1.6
eth0 192.168.1.1
eth1 192.168.2.1
CD1
CD2
some rights reserved
Create Subnet 2
192.168.1.5 PC1 eth0 eth0 192.168.2.5 PC3
NIC
PC2
eth0 ROUTER 1
192.168.1.6
eth0
eth1
CD1
192.168.1.1
192.168.2.1
CD2
some rights reserved
Check connectivity
Check connectivity
Check connectivity
Set default gateway for PC1 and ping PC3. What happens now?
pc1# route add default g$ 192 1!" 1 1
Check connectivity
Set default gateway for PC1 and ping PC3. What happens now? Ping makes its way to subnet 2 but cannot find its way back! Set default gateway for PC3 as well.
ARP in Action
Run TCPDUMP on PC3 and Router1's eth0 (one machine in each subnet) Ping PC3 from PC1
Adding Router 2
192.168.2.5 192.168.1.5 PC1 eth0 eth0 PC3
NIC
PC2
192.168.1.6
eth0 192.168.1.1
eth1 192.168.2.1
CD3
CD1
CD2
PC2
192.168.1.6
eth0 192.168.1.1
eth1 192.168.2.1
CD3
CD1
CD2
Check Connectivity
Check Connectivity
Ping Router2/eth0(192.168.2.6) from PC1. What happens? Ping reaches 192.168.2.6, but cannot find its way back, since gateway of router 2 is not set
Check Connectivity
Ping Router2/eth0(192.168.2.6) from PC1. What happens? Ping reaches 192.168.2.6, but cannot find its way back, since gateway of router 2 is not set
router2# route add default g$ 192 1!" 2 1
Adding PC4
192.168.1.5 PC1 eth0
NIC
192.168.2.5 PC3
eth0
PC4 PC2 eth0 ROUTER 1 192.168.1.6 eth0 192.168.1.1 eth1 ROUTER 2 eth0 eth1 192.168.2.6 192.168.3.1
192.168.2.1
CD3
CD1
CD2
192.168.2.1
CD3
CD1
CD2
PC2
192.168.1.6
eth0 192.168.1.1
eth1
192.168.2.1
CD3
CD1
CD2
Network is now symmetric, about CD2 Packets from one end of the network have to pass through two routers to reach the other end.
PC2
192.168.1.6
eth0 192.168.1.1
eth1
192.168.2.1
CD3
CD1
CD2
Will pinging PC1 from PC4 work? (Assume default gateway of PC4 is set) Remember we successfully pinged Router2/eth0 from PC1.
Will pinging PC1 from PC5 work? (Assume default gateway of PC5 is set) Remember we successfully pinged Router2/eth0 from PC1. Directly connected subnets, i.e. those connected to the same router are directly accessible. But if there is another router in between, the routing tables have to be properly configured. Router 1 doesn't know where to forward packets meant for 192.168.3.0/24
Specific Routes
router1 # route add -net 192.168.3.0 netmask 255.255.255.0 gw 192.168.2.6 dev eth1
The commands adds an entry in Router 1's routing table to forward all packets meant for 192.168.3.0/24, to 192.168.2.6 over eth1. Now pinging PC4 from PC1 works!
Specific Routes
So far we specified only default routes for the routers. This is not enough, in a complicated network with multiple subnets and routers with more than two interfaces.
What happens when you ping PC3 from PC4? Default GW of PC3 is 192.168.2.1 The reply will be forwarded to 192.168.2.1 and will never reach PC4(192.168.3.5)
What happens when you ping PC3 from PC4? Default GW of PC3 is 192.168.2.1 The reply will be forwarded to 192.168.2.1 and will never reach PC4(192.168.3.5) PC3 is connected to two routers and we need to specify the routes to be chosen for different destinations
some rights reserved
Routing Algorithms
Imagine how difficult it will be to set static routes for a large network? That's where Routing Algorithms come into play ZEBRA- a daemon for running routing algorithms on routers.
Setting up the machines so far was a lot of work! Imagine having to do it all over again!
Netkit Labs
Make a directory for your lab Specify the network topology inside lab conf Specify boot dependency inside lab dep (At the console, type man lstart for details) Make empty directories for each VM Create .startup files for each machine and list the commands to be executed at startup. sabu@laptop$ lstart -d (director)*
some rights reserved
DHCP DNS Socket programing in Python RIP, OSPF, BGP and lots more...
Attribution-Share Alike You are free: to Share to copy, distribute and transmit the work to Remix to adapt the work
For more details please visit http://creativecommons.org/licenses/by-sa/3.0/