Skip to content

Example: dhcp with static allocation

Alt text

r1

hostname r1
vrf def v1
 rd 1:1
 exit
int eth1
 vrf for v1
 ipv4 addr 1.1.1.1 255.255.255.0
 ipv6 addr 1234::1 ffff::
 ipv6 prefix-suppress
 exit
int lo0
 vrf for v1
 ipv4 addr 4.4.4.4 255.255.255.255
 ipv6 addr 4444::4 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
 exit
server dhcp4 dh4
 pool 1.1.1.2 1.1.1.199
 gateway 1.1.1.1
 netmask 255.255.255.0
 static 0000.0000.2222 1.1.1.111
 interface ethernet1
 vrf v1
 exit
server dhcp6 dh6
 netmask ffff:ffff:ffff:ffff::
 gateway 1234::1
 static 0000.0000.2222 1234::111
 interface ethernet1
 vrf v1
 exit

r2

hostname r2
vrf def v1
 rd 1:1
 exit
prefix-list p4
 permit 0.0.0.0/0
 exit
prefix-list p6
 permit ::/0
 exit
int eth1
 vrf for v1
 ipv4 addr 3.3.3.3 255.255.255.128
 ipv4 dhcp-client enable
 ipv4 gateway-prefix p4
 ipv6 addr 3333::3 ffff::
 ipv6 dhcp-client enable
 ipv6 gateway-prefix p6
 exit
r2 tping 100 20 1.1.1.1 vrf v1
r2 tping 100 20 1234::1 vrf v1
r2 tping 100 5 4.4.4.4 vrf v1
r2 tping 100 5 4444::4 vrf v1
r1 tping 100 20 1.1.1.111 vrf v1
r1 tping 100 20 1234::111 vrf v1
  1. Install ContainerLab as described here
  2. Fetch conn-dhcp03 file
  3. Launch ContainerLab conn-dhcp03.yml topology:

   containerlab deploy --topo conn-dhcp03.yml  
4. Destroy ContainerLab conn-dhcp03.yml topology:

   containerlab destroy --topo conn-dhcp03.yml  
5. Copy-paste configuration for each node in the lab topology

  1. Fetch or compile freeRtr rtr.jar file.
    You can grab it here
  2. Fetch conn-dhcp03.tst file here
  3. Launch conn-dhcp03.tst test:

   java -jar ../../rtr.jar test tester conn-dhcp03 path ./ temp ./ wait
4. Destroy freeRtr conn-dhcp03.tst test:

   Ctrl-C (In freeRtr test window)