For my task i need to dump dhcp client-server exchange in local linux machine.
- First of all i clone and build dhcp server and client from ISC dhcp sources - https://github.com/isc-projects/dhcp.
- Create and setup tap interfaces in bridge for my experiments:
sudo ip link add test_eth0 type tap
sudo ip link add test_eth1 type tap
sudo ip link add test_eth2 type tap
sudo ifconfig test_eth0 up
sudo ifconfig test_eth1 up
sudo ifconfig test_eth2 up
sudo ifconfig test_eth0 10.1.1.7 netmask 255.255.255.0 up
sudo ip link add test_br0 type bridge
sudo ip link set dev test_eht0 master test_br0
sudo ip link set dev test_eht1 master test_br0
sudo ip link set dev test_eht2 master test_br0
sudo ip link set test_br0 up
- Start dhcpd server
sudo ./dhcpd -d -f # start dhcp daemon in foreground mode
with dhcpd.conf:
...
subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.3 10.1.1.254;
option routers 10.1.1.1;
}
...
- Start dhclient specifying target interface and dhcp server:
sudo ./dhclient -lf ./dhclient.leases test_eth1 -s 10.1.1.0 -v
client output:
...
DHCPDISCOVER on test_eht1 to 10.1.1.0 port 67 interval 3
DHCPDISCOVER on test_eht1 to 10.1.1.0 port 67 interval 6
DHCPDISCOVER on test_eht1 to 10.1.1.0 port 67 interval 11
...
I expected that after starting the client, it will detect a running server, which will give a dynamic address to the test_eth1 interface and i can dump it with dhcpdump, but i'm not so good in networking as in my imagine.
dummy
interfaces don't actually route any traffic. Use network namespaces instead superuser.com/questions/1229674/…