Starting from:
$35

$29

Lab 11 (Raw Socket Programming) Solution


    1. You are given the virtual network in Fig. 1. This network has two subnets, and one node common to both these subnets. Your rst exercise is to write a simple packet sni er at node

192.168.20.2








eth1


192.168.30.0/8



h1









192.168.20.1







192.168.30.2








eth1


eth2






r1


r2

192.168.20.0/8

















eth1





































h2
eth1


192.168.30.1






















192.168.20.3

Figure 1: A network with 2 subnets.

r1. This packet sni er should print the MAC addresses (source and destination), IP addresses

(source and destination) of all IP packets sent and received by r1.  Refer https://www.

binarytides.com/raw-sockets-c-code-linux/ and http://squidarth.com/networking/

systems/rc/2018/05/28/using-raw-sockets.html
[50]

    2. Modify the packet sni er in the previous exercise to print the MAC addresses (source and destination), IP addresses (source and destination) of only those IP packets that are received

by r1 on interface eth1.
[20]

    3. Enhance the program created in the previous exercise so that you transfer IP packets across the subnets in Fig. 1. Infact, you will essentially be building a rudimentary router. Some hints

can be found at https://opensourceforu.com/2015/03/a-guide-to-using-raw-sockets/
[30]






















End of paper

More products