Network programming

Job ID: 35157333

Budget: €8 – €30 EUR

Part 1 :
Using only the ifconfig command, put an IP address on your connected network interface with the cable attached to the wall. The IP addresses of the machines are given to you by the lecturer to avoid any conflicts.
- V-12 : 10.0.2.X
- V-13: 10.0.13.X
To find out which interface is on your system, do the following. Important note: the Ethernet interface on your machines that we are interested in here is from the manufacturer Intel(R) PRO/1000 Network Connection.
user@ debian : ~ dmesg | grep eth
[ 0 . 1 0 1 1 2 3 ] reboot : HP Compaq Laptop series board detected . Selecting BIOS-method f o r reboots .
[ 0 . 7 8 9 0 7 4 ] r8169 0 0 0 0 : 0 6 : 0 1 . 0 eth0 : RTL 8169 sb /8110 sb at 0 xffffc 9000066 a 000 , e8 : de : 2 7 : 0 1 : 8 e : 5 4 , XID 10000000 IRQ 21
[ 0 . 7 8 9 0 7 5 ] r8169 0 0 0 0 : 0 6 : 0 1 . 0 eth0 : jumbo features [ frames : 7152 bytes , tx checksumming : ok ]
[ 0 . 7 8 9 3 5 3 ] r8169 0 0 0 0 : 0 6 : 0 2 . 0 eth1 : RTL 8169 sb /8110 sb at 0 xffffc 9000066 c 000 , 6 c : 1 9 : 8 f : 9 9 : 9 1 : 4 5 , XID 10000000 IRQ 22
[ 0 . 7 8 9 3 5 4 ] r8169 0 0 0 0 : 0 6 : 0 2 . 0 eth1 : jumbo features [ frames : 7152 bytes , tx checksumming : ok ] [ 0 . 9 9 5 2 3 2 ] e1000e 0 0 0 0 : 0 0 : 1 9 . 0 eth2 : registered PHC clock
[ 0 . 9 9 5 2 3 6 ] e1000e 0 0 0 0 : 0 0 : 1 9 . 0 eth2 : ( PCI Express : 2 . 5 GT/ s : Width x1 ) 2 4 : be : 0 5 : 1 7 : 5 9 : 7 e
[ 0 . 9 9 5 2 3 8 ] e1000e 0 0 0 0 0 : 0 0 : 1 9 . 0 eth2 : Intel ( R ) PRO /1000 Network Connection
[ 0 . 9 9 5 3 1 4 ] e1000e 0 0 0 0 : 0 0 : 1 9 . 0 eth2 : MAC : 10 , PHY : 11 , PBA No : 0100 FF-0FF
The interface connected to the network is, in this example, the eth2 interface.
Be careful, Linux, through the udev daemon, has fun renaming the interfaces already named. This gives rise to a game of musical chairs. So you can have this kind of thing:
[ 4 . 1 6 8 3 8 2 ] udevd [ 4 1 4 ] : renamed network interface eth0 to rename2 [ 4 . 1 8 8 3 6 4 ] udevd [ 4 3 0 ] : renamed network interface eth1 to rename3 [ 4 . 2 0 4 3 6 1 ] udevd [ 4 6 2 ] : renamed network interface eth2 to eth0
[ 4 . 2 3 2 3 3 7 ] udevd [ 4 1 4 ] : renamed network interface rename2 to eth1
[ 4 . 2 5 2 4 1 9 ] udevd [ 4 3 0 ] : renamed network interface rename3 to eth2
So, in this case, the "correct" interface is eth0 (since eth2 has been renamed to eth0). To configure an IP address on the eth0 interface, simply type the following command:
# ifconfig eth0 X . X . X . X or
# ip a add X . X . X . X dev eth0
The code examples presented in class can be found at
- V-12 : http ://10.1.2.253 :8080/files/4A/TP3/code
- V-13 : http ://10.1.13.253 :8080/files/4A/TP3/code