Relay
This scenario shows how to configure service dhcp-relay. The
relay agent must be used when the DHCP server and the DHCP
clients are not connected to the same layer 2 domain.
Test DHCP Relay
Description
This example demonstrates how to configure a DHCP relay instance in DUT0 to forward DHCP requests from DUT2 to DUT1.
Scenario
Step 1: Set the following configuration in DUT0 :
set interfaces ethernet eth0 vif 100 address 10.0.0.2/24 set interfaces ethernet eth1 vif 200 address 20.0.0.2/24 set service dhcp-relay INS downstream-interface eth1.200 set service dhcp-relay INS server 10.0.0.1 set service dhcp-relay INS upstream-interface eth0.100 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 2: Set the following configuration in DUT1 :
set interfaces ethernet eth0 vif 100 address 10.0.0.1/24 set protocols static route 0.0.0.0/0 next-hop 10.0.0.2 set service dhcp-server shared-network dummy subnet 10.0.0.1/32 set service dhcp-server shared-network remote subnet 20.0.0.0/24 start 20.0.0.50 stop 20.0.0.50 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 3: Set the following configuration in DUT2 :
set interfaces ethernet eth0 vif 200 address dhcp set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 4: Ping IP address 10.0.0.1 from DUT0:
admin@DUT0$ ping 10.0.0.1 count 1 size 56 timeout 1Show output
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.283 ms --- 10.0.0.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.283/0.283/0.283/0.000 ms
Step 5: Run command interfaces ethernet show at DUT2 and check if output contains the following tokens:
20.0.0.50Show output
--------------------------------------------------------------------- Name IP Address Admin Oper Vrf Description --------------------------------------------------------------------- eth0 fe80::dcad:beff:feef:6c20/64 up up eth0.200 20.0.0.50/24 up up fe80::dcad:beff:feef:6c20/64 eth1 down down
Test DHCP Relay With Giaddr
Description
This example demonstrates how to set the gateway IP address (giaddr) in the IP address. This value must be set in an IP address that the DHCP server can reach.
Scenario
Step 1: Set the following configuration in DUT0 :
set interfaces ethernet eth0 vif 100 address 10.0.0.2/24 set interfaces ethernet eth1 vif 200 address 20.0.0.2/24 set interfaces ethernet eth1 vif 200 address 20.0.0.3/24 set service dhcp-relay INS downstream-interface eth1.200 set service dhcp-relay INS server 10.0.0.1 giaddr 20.0.0.3 set service dhcp-relay INS upstream-interface eth0.100 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 2: Set the following configuration in DUT1 :
set interfaces ethernet eth0 vif 100 address 10.0.0.1/24 set protocols static route 0.0.0.0/0 next-hop 10.0.0.2 set service dhcp-server shared-network dummy subnet 10.0.0.1/32 set service dhcp-server shared-network remote subnet 20.0.0.0/24 start 20.0.0.50 stop 20.0.0.50 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 3: Set the following configuration in DUT2 :
set interfaces ethernet eth0 vif 200 address dhcp set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 4: Ping IP address 10.0.0.1 from DUT0:
admin@DUT0$ ping 10.0.0.1 count 1 size 56 timeout 1Show output
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.232 ms --- 10.0.0.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.232/0.232/0.232/0.000 ms
Step 5: Run command interfaces ethernet show at DUT2 and check if output contains the following tokens:
20.0.0.50Show output
--------------------------------------------------------------------- Name IP Address Admin Oper Vrf Description --------------------------------------------------------------------- eth0 fe80::dcad:beff:feef:6c20/64 up up eth0.200 20.0.0.50/24 up up fe80::dcad:beff:feef:6c20/64 eth1 down down
Step 6: Run command system journal show | cat at DUT1 and check if output matches the following regular expressions:
DHCPACK on 20.0.0.50 to [^\)]+\) via 20.0.0.3Show output
Nov 12 16:03:25.382763 osdx systemd-journald[1754]: Runtime Journal (/run/log/journal/18feb8e5bb5a49edb7e456ab042ed98b) is 964.0K, max 6.5M, 5.5M free. Nov 12 16:03:25.383749 osdx systemd-journald[1754]: Received client request to rotate journal, rotating. Nov 12 16:03:25.383815 osdx systemd-journald[1754]: Vacuuming done, freed 0B of archived journals from /run/log/journal/18feb8e5bb5a49edb7e456ab042ed98b. Nov 12 16:03:25.395882 osdx OSDxCLI[229492]: User 'admin' executed a new command: 'system journal clear'. Nov 12 16:03:25.675024 osdx OSDxCLI[229492]: User 'admin' executed a new command: 'system coredump delete all'. Nov 12 16:03:27.208679 osdx OSDxCLI[229492]: User 'admin' entered the configuration menu. Nov 12 16:03:27.305438 osdx OSDxCLI[229492]: User 'admin' added a new cfg line: 'set interfaces eth0.100 address 10.0.0.1/24'. Nov 12 16:03:27.389332 osdx OSDxCLI[229492]: User 'admin' added a new cfg line: 'set service dhcp-server shared-network dummy subnet 10.0.0.1/32'. Nov 12 16:03:27.483131 osdx OSDxCLI[229492]: User 'admin' added a new cfg line: 'set service dhcp-server shared-network remote subnet 20.0.0.0/24 start 20.0.0.50 stop 20.0.0.50'. Nov 12 16:03:27.537588 osdx OSDxCLI[229492]: User 'admin' added a new cfg line: 'set protocols static route 0.0.0.0/0 next-hop 10.0.0.2'. Nov 12 16:03:27.646122 osdx OSDxCLI[229492]: User 'admin' added a new cfg line: 'show working'. Nov 12 16:03:27.741748 osdx ubnt-cfgd[318279]: inactive Nov 12 16:03:27.774935 osdx INFO[318289]: FRR daemons did not change Nov 12 16:03:27.835740 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0 Nov 12 16:03:27.856307 osdx (udev-worker)[318338]: Network interface NamePolicy= disabled on kernel command line. Nov 12 16:03:28.000123 osdx systemd[1]: Started dhcpd@main.service - "DHCP Server Service instance main". Nov 12 16:03:28.002005 osdx cfgd[1453]: [229492]Completed change to active configuration Nov 12 16:03:28.003266 osdx dhcpd[318410]: Wrote 0 leases to leases file. Nov 12 16:03:28.014580 osdx OSDxCLI[229492]: User 'admin' committed the configuration. Nov 12 16:03:28.025747 osdx dhcpd[318410]: Nov 12 16:03:28.025757 osdx dhcpd[318410]: No subnet declaration for eth0 (no IPv4 addresses). Nov 12 16:03:28.025760 osdx dhcpd[318410]: ** Ignoring requests on eth0. If this is not what Nov 12 16:03:28.025763 osdx dhcpd[318410]: you want, please write a subnet declaration Nov 12 16:03:28.025767 osdx dhcpd[318410]: in your dhcpd.conf file for the network segment Nov 12 16:03:28.025770 osdx dhcpd[318410]: to which interface eth0 is attached. ** Nov 12 16:03:28.025773 osdx dhcpd[318410]: Nov 12 16:03:28.041527 osdx OSDxCLI[229492]: User 'admin' left the configuration menu. Nov 12 16:03:28.047864 osdx dhcpd[318410]: Server starting service. Nov 12 16:03:28.654069 osdx dhcpd[318410]: DHCPDISCOVER from de:ad:be:ef:6c:20 via 20.0.0.3 Nov 12 16:03:29.654962 osdx dhcpd[318410]: DHCPOFFER on 20.0.0.50 to de:ad:be:ef:6c:20 (osdx) via 20.0.0.3 Nov 12 16:03:29.655663 osdx dhcpd[318410]: DHCPREQUEST for 20.0.0.50 (10.0.0.1) from de:ad:be:ef:6c:20 (osdx) via 20.0.0.3 Nov 12 16:03:29.682569 osdx dhcpd[318410]: DHCPACK on 20.0.0.50 to de:ad:be:ef:6c:20 (osdx) via 20.0.0.3
Test DHCP Relay With GRE Tunnel
Description
This example demonstrates how to configure a DHCP relay that forwards DHCP requests to the DHCP server through a GRE tunnel (upstream).
Scenario
Step 1: Set the following configuration in DUT0 :
set interfaces ethernet eth0 vif 100 address 10.0.0.2/24 set interfaces ethernet eth1 vif 200 address 20.0.0.2/24 set interfaces tunnel tun1 address 1.0.0.2/32 set interfaces tunnel tun1 encapsulation gre set interfaces tunnel tun1 local-address 10.0.0.2 set interfaces tunnel tun1 local-interface eth0.100 set interfaces tunnel tun1 nhrp holdtime 5 set interfaces tunnel tun1 nhrp nhs 1.0.0.1 nbma 10.0.0.1 set service dhcp-relay INS downstream-interface eth1.200 set service dhcp-relay INS server 1.0.0.1 set service dhcp-relay INS upstream-interface eth0.100 set service dhcp-relay INS upstream-interface tun1 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 2: Set the following configuration in DUT1 :
set interfaces ethernet eth0 vif 100 address 10.0.0.1/24 set interfaces tunnel tun1 address 1.0.0.1/32 set interfaces tunnel tun1 encapsulation gre set interfaces tunnel tun1 local-address 10.0.0.1 set interfaces tunnel tun1 local-interface eth0.100 set interfaces tunnel tun1 nhrp set protocols static route 0.0.0.0/0 next-hop 10.0.0.2 set protocols static route 20.0.0.0/24 next-hop 1.0.0.2 set service dhcp-server shared-network dummy subnet 1.0.0.1/32 set service dhcp-server shared-network remote subnet 20.0.0.0/24 start 20.0.0.50 stop 20.0.0.50 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 3: Set the following configuration in DUT2 :
set interfaces ethernet eth0 vif 200 address dhcp set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 4: Ping IP address 10.0.0.1 from DUT0:
admin@DUT0$ ping 10.0.0.1 count 1 size 56 timeout 1Show output
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.209 ms --- 10.0.0.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.209/0.209/0.209/0.000 ms
Step 5: Ping IP address 1.0.0.1 from DUT0:
admin@DUT0$ ping 1.0.0.1 count 1 size 56 timeout 1Show output
PING 1.0.0.1 (1.0.0.1) 56(84) bytes of data. 64 bytes from 1.0.0.1: icmp_seq=1 ttl=64 time=0.337 ms --- 1.0.0.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.337/0.337/0.337/0.000 ms
Step 6: Run command interfaces ethernet show at DUT2 and check if output contains the following tokens:
20.0.0.50Show output
--------------------------------------------------------------------- Name IP Address Admin Oper Vrf Description --------------------------------------------------------------------- eth0 fe80::dcad:beff:feef:6c20/64 up up eth0.200 20.0.0.50/24 up up fe80::dcad:beff:feef:6c20/64 eth1 down down
Test DHCP Relay With Multiple Instances
Description
This example demonstrates how to configure multiple DHCP relay instances.
Scenario
Step 1: Set the following configuration in DUT0 :
set interfaces ethernet eth0 vif 100 address 10.0.0.2/24 set interfaces ethernet eth1 vif 200 address 20.0.0.2/24 set interfaces ethernet eth1 vif 300 address 30.0.0.2/24 set service dhcp-relay INS downstream-interface eth1.200 set service dhcp-relay INS server 10.0.0.1 set service dhcp-relay INS upstream-interface eth0.100 set service dhcp-relay INS2 downstream-interface eth1.300 set service dhcp-relay INS2 server 10.0.0.1 set service dhcp-relay INS2 upstream-interface eth0.100 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 2: Set the following configuration in DUT1 :
set interfaces ethernet eth0 vif 100 address 10.0.0.1/24 set protocols static route 0.0.0.0/0 next-hop 10.0.0.2 set service dhcp-server shared-network dummy subnet 10.0.0.1/32 set service dhcp-server shared-network remote subnet 20.0.0.0/24 start 20.0.0.50 stop 20.0.0.50 set service dhcp-server shared-network remote2 subnet 30.0.0.0/24 start 30.0.0.50 stop 30.0.0.50 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 3: Set the following configuration in DUT2 :
set interfaces ethernet eth0 vif 200 address dhcp set interfaces ethernet eth0 vif 300 address dhcp set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 4: Ping IP address 10.0.0.1 from DUT0:
admin@DUT0$ ping 10.0.0.1 count 1 size 56 timeout 1Show output
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.270 ms --- 10.0.0.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.270/0.270/0.270/0.000 ms
Step 5: Run command interfaces ethernet show at DUT2 and check if output contains the following tokens:
20.0.0.50Show output
--------------------------------------------------------------------- Name IP Address Admin Oper Vrf Description --------------------------------------------------------------------- eth0 fe80::dcad:beff:feef:6c20/64 up up eth0.200 20.0.0.50/24 up up fe80::dcad:beff:feef:6c20/64 eth0.300 30.0.0.50/24 up up fe80::dcad:beff:feef:6c20/64 eth1 down down
Step 6: Run command interfaces ethernet show at DUT2 and check if output contains the following tokens:
30.0.0.50Show output
--------------------------------------------------------------------- Name IP Address Admin Oper Vrf Description --------------------------------------------------------------------- eth0 fe80::dcad:beff:feef:6c20/64 up up eth0.200 20.0.0.50/24 up up fe80::dcad:beff:feef:6c20/64 eth0.300 30.0.0.50/24 up up fe80::dcad:beff:feef:6c20/64 eth1 down down
Step 7: Run command system journal show | cat at DUT1 and check if output matches the following regular expressions:
DHCPACK on 20.0.0.50 to [^\)]+\) via 20.0.0.2 DHCPACK on 30.0.0.50 to [^\)]+\) via 30.0.0.2Show output
Nov 12 16:03:51.377235 osdx systemd-journald[1754]: Runtime Journal (/run/log/journal/18feb8e5bb5a49edb7e456ab042ed98b) is 932.0K, max 6.5M, 5.6M free. Nov 12 16:03:51.379973 osdx systemd-journald[1754]: Received client request to rotate journal, rotating. Nov 12 16:03:51.380029 osdx systemd-journald[1754]: Vacuuming done, freed 0B of archived journals from /run/log/journal/18feb8e5bb5a49edb7e456ab042ed98b. Nov 12 16:03:51.389295 osdx OSDxCLI[229492]: User 'admin' executed a new command: 'system journal clear'. Nov 12 16:03:51.668647 osdx OSDxCLI[229492]: User 'admin' executed a new command: 'system coredump delete all'. Nov 12 16:03:53.406645 osdx OSDxCLI[229492]: User 'admin' entered the configuration menu. Nov 12 16:03:53.496469 osdx OSDxCLI[229492]: User 'admin' added a new cfg line: 'set interfaces eth0.100 address 10.0.0.1/24'. Nov 12 16:03:53.580231 osdx OSDxCLI[229492]: User 'admin' added a new cfg line: 'set service dhcp-server shared-network dummy subnet 10.0.0.1/32'. Nov 12 16:03:53.683638 osdx OSDxCLI[229492]: User 'admin' added a new cfg line: 'set service dhcp-server shared-network remote subnet 20.0.0.0/24 start 20.0.0.50 stop 20.0.0.50'. Nov 12 16:03:53.780441 osdx OSDxCLI[229492]: User 'admin' added a new cfg line: 'set protocols static route 0.0.0.0/0 next-hop 10.0.0.2'. Nov 12 16:03:53.889356 osdx OSDxCLI[229492]: User 'admin' added a new cfg line: 'set service dhcp-server shared-network remote2 subnet 30.0.0.0/24 start 30.0.0.50 stop 30.0.0.50'. Nov 12 16:03:53.963378 osdx OSDxCLI[229492]: User 'admin' added a new cfg line: 'show working'. Nov 12 16:03:54.050785 osdx ubnt-cfgd[319233]: inactive Nov 12 16:03:54.085481 osdx INFO[319245]: FRR daemons did not change Nov 12 16:03:54.115971 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0 Nov 12 16:03:54.138144 osdx (udev-worker)[319294]: Network interface NamePolicy= disabled on kernel command line. Nov 12 16:03:54.304478 osdx systemd[1]: Started dhcpd@main.service - "DHCP Server Service instance main". Nov 12 16:03:54.306959 osdx cfgd[1453]: [229492]Completed change to active configuration Nov 12 16:03:54.308277 osdx dhcpd[319366]: Wrote 0 leases to leases file. Nov 12 16:03:54.319756 osdx OSDxCLI[229492]: User 'admin' committed the configuration. Nov 12 16:03:54.335012 osdx OSDxCLI[229492]: User 'admin' left the configuration menu. Nov 12 16:03:54.340164 osdx dhcpd[319366]: Nov 12 16:03:54.340170 osdx dhcpd[319366]: No subnet declaration for eth0 (no IPv4 addresses). Nov 12 16:03:54.340174 osdx dhcpd[319366]: ** Ignoring requests on eth0. If this is not what Nov 12 16:03:54.340177 osdx dhcpd[319366]: you want, please write a subnet declaration Nov 12 16:03:54.340179 osdx dhcpd[319366]: in your dhcpd.conf file for the network segment Nov 12 16:03:54.340183 osdx dhcpd[319366]: to which interface eth0 is attached. ** Nov 12 16:03:54.340185 osdx dhcpd[319366]: Nov 12 16:03:54.348102 osdx dhcpd[319366]: Server starting service. Nov 12 16:03:55.058266 osdx dhcpd[319366]: DHCPDISCOVER from de:ad:be:ef:6c:20 via 20.0.0.2 Nov 12 16:03:55.294372 osdx dhcpd[319366]: DHCPDISCOVER from de:ad:be:ef:6c:20 via 30.0.0.2 Nov 12 16:03:56.058871 osdx dhcpd[319366]: DHCPOFFER on 20.0.0.50 to de:ad:be:ef:6c:20 (osdx) via 20.0.0.2 Nov 12 16:03:56.059644 osdx dhcpd[319366]: DHCPREQUEST for 20.0.0.50 (10.0.0.1) from de:ad:be:ef:6c:20 (osdx) via 20.0.0.2 Nov 12 16:03:56.111092 osdx dhcpd[319366]: DHCPACK on 20.0.0.50 to de:ad:be:ef:6c:20 (osdx) via 20.0.0.2 Nov 12 16:03:56.294895 osdx dhcpd[319366]: DHCPOFFER on 30.0.0.50 to de:ad:be:ef:6c:20 (osdx) via 30.0.0.2 Nov 12 16:03:56.295832 osdx dhcpd[319366]: DHCPREQUEST for 30.0.0.50 (10.0.0.1) from de:ad:be:ef:6c:20 (osdx) via 30.0.0.2 Nov 12 16:03:56.311095 osdx dhcpd[319366]: DHCPACK on 30.0.0.50 to de:ad:be:ef:6c:20 (osdx) via 30.0.0.2