0% found this document useful (0 votes)
46 views

NETKIT MD PDF

This document provides instructions for using various networking commands and tools in a Bash shell to configure and analyze a virtual networking lab environment created with Netkit. It describes how to convert between decimal and binary numbers, enable IP forwarding, start virtual machines, configure their network interfaces, check routing tables, ping between VMs, capture network packets, configure static and default routes, examine ARP caches, sniff DNS and routing protocol traffic, use traceroute, and more. The goal is to demonstrate how to set up and explore network communication and routing between virtual machines.

Uploaded by

jukom
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

NETKIT MD PDF

This document provides instructions for using various networking commands and tools in a Bash shell to configure and analyze a virtual networking lab environment created with Netkit. It describes how to convert between decimal and binary numbers, enable IP forwarding, start virtual machines, configure their network interfaces, check routing tables, ping between VMs, capture network packets, configure static and default routes, examine ARP caches, sniff DNS and routing protocol traffic, use traceroute, and more. The goal is to demonstrate how to set up and explore network communication and routing between virtual machines.

Uploaded by

jukom
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Convertire

numero da decimale a
binario con Bash
varD=127;bc <<<"obase=2;$varD"

Convertire numero da binario a


decimale con Bash
bash~$ echo "$((2#101010101))"

NETKIT
Enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip forward

Start the lab,given a folder

bash~$ cd [lab folder]

bash~/[lab folder]$ lstart

VM configuration
Create a virtual machine
Start VM with name pc1 and network interface
eth0 on collision domain A
bash~$ vstart pc1 --eth0=A

Configure network interface of pc1


pc1~$ ifconfig eth0 10.0.0.1 netmask 255.255.255.0 broadc

ast 10.0.0.255 mtu 4000 up

eth0 is the interface choosen

10.0.0.1 is the network address

255.255.255.0 is the netmask

(optional) 10.0.0.255 is the broadcast address

(optional) 4000 is MTU Maximum Transfer Unit selected for the


interface

Up is the command to abilitate the interface

List details on network interface


eth0 is the interface choosen
bash~$ ifconfig eth0

Check routing table of pc1


pc1~$ route

Stop the VMs


From the VM pc1~$ halt

From the terminal bash~$ vhalt pc1

From the terminal bash~$ vcrash pc1

Two or more VMs


After we started the VMs (on the same
collision domain A)
bash~$ vstart pc1 --eth0=A

bash~$ vstart pc2 --eth0=A

and assigned their network interfaces


configurations such as network
addresses/netmasks
We can ping one another
Ping pc2 from pc1
pc1~$ ping [network address]

pc1~$ ping 10.0.0.2

Dumping (collecting) packets of pc2


We can look at the packets pc2 receives
pc1~$ ping [network address pc2]

pc2~$ tcpdump -i eth0

If we are interested in CAPTURING the packets in


a PCAP file
pc1~$ ping [network address pc2]

pc2~$ tcpdump -i eth0 -w /hosthome/capture.pcap

To display pcap capture on the graphical


interface on Wireshark
bash~$ wireshark -r [filename]

Gateways
If we cannot ping interfaces on other
domains [Network unreachable] we have
to modify their routing tables
Directly connected networks are automatically
inserted into the routing table when the
corrisponding interface is brought up
Set default routes on PCs
Specify default gw to route packets
pc1~$ route add default gw [address of the specific inter

face of the gateway]

Remove default routes on PCs


Remove default gw to route packets
pc1~$ route del default gw [address of the specific inter

face of the gateway]

Configure static routes into the routing


table
Configure path to reach a destination on
r2
Configure the correct gateway and interface to
reach the destination
r2~$ route add -net [destination gateway address]

netmask [destination netmask address]

gw [network interface address next hop]

dev [interface next hop]

Delete an entry
r2~$ route del -net [destination gateway address]

netmask [destination netmask address]

specify net and netmask parameter found in routing table with

command route

Check the new routing table on r2


r2~$ route

Check if r2 pings the desired destination


r2~$ ping [destination address]

ARP

ARP Cache
Check the ARP cache of the machine
Displays the address resolution results already
present in the machine
pc1~$ arp

If nothing is displayed means that the cache is


empty
When we ping a machine
In the same network

we get the hardware (linklayer) address of it.

The other machine stores in its ARP cache the hardware

(linklayer) address of the machine that pinged it.

In another network

(in case that is reachable) we get the hardware

(linklayer) address of the “nexthop” router

Sniff ARP traffic


Sniff ARP traffic on a router
Capture ARP traffic of a router for packets that
pass through a specific interface
r2~$ tcpdump -e -t -i [interface]

for example as interface we can pick eth0, but it depends on the


network

Routing protocols
Routing protocols are used to automatically update routing

tables,avoiding the need to do it manually

In netkit routers that are virtual machines as well, run a specific piece
of software that implements routing protocols such as Zebra / Quagga

TraceRoute command
Packets path to destination
Identifies the route the packets take to reach
destination
pc1~$ traceroute [destination address]

DNS
Sniff packets of DNS service
pc2~$ tcpdump -n -t port domain

where domain is the port (53) associated with the DNS service

RIP
Sniff packets of RIPv2 service on the
machine
pc2~$ tcpdump -i [interface] -v -n -s 1518

-v option to display packet details


-n option to not resolve numbers to names

-s 1518 to sniff the entire ethernet packets (otherwise by default


only 68 bytes)

You might also like