Local-Vrf

This scenario shows how to configure a DHCP relay agent so that it forwards DHCP requests. The DHCP relay instance is bound to a a VRF with the local-vrf configuration command.

../../../../_images/toplogy.svg

Test DHCP Relay

Description

This example shows how to configure a DHCP relay instance in DUT0 to forward DHCP requests from DUT2 to DUT1. A VRF is configured in DUT0.

Scenario

Step 1: Set the following configuration in DUT0:

set interfaces ethernet eth0 vif 100 address 10.0.0.2/24
set interfaces ethernet eth0 vif 100 vrf VRF
set interfaces ethernet eth1 vif 200 address 20.0.0.2/24
set interfaces ethernet eth1 vif 200 vrf VRF
set service dhcp-relay INS downstream-interface eth1.200
set service dhcp-relay INS local-vrf VRF
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'
set system vrf VRF

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 vrf VRF count 1 size 56 timeout 1
Show output
ping: Warning: source address might be selected on device other than: VRF
PING 10.0.0.1 (10.0.0.1) from 10.0.0.2 VRF: 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.344 ms

--- 10.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.344/0.344/0.344/0.000 ms

Step 5: Run command interfaces ethernet show at DUT2 and check if output contains the following tokens:

20.0.0.50
Show output
---------------------------------------------------------------------
  Name             IP Address           Admin  Oper  Vrf  Description
---------------------------------------------------------------------
    eth0  fe80::dcad:beff:feef:6c30/64  up     up
eth0.200  20.0.0.50/24                  up     up
          fe80::dcad:beff:feef:6c30/64
    eth1                                down   down

Test DHCP Relay With GRE Tunnel

Description

This example shows how to configure a DHCP relay that forwards DHCP requests to the DHCP server through a GRE tunnel (upstream). The GRE tunnel is also bound to a VRF.

Scenario

Step 1: Set the following configuration in DUT0:

set interfaces ethernet eth0 vif 100 address 10.0.0.2/24
set interfaces ethernet eth0 vif 100 vrf VRF
set interfaces ethernet eth1 vif 200 address 20.0.0.2/24
set interfaces ethernet eth1 vif 200 vrf VRF
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 interfaces tunnel tun1 vrf VRF
set service dhcp-relay INS downstream-interface eth1.200
set service dhcp-relay INS local-vrf VRF
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'
set system vrf VRF

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 vrf VRF count 1 size 56 timeout 1
Show output
ping: Warning: source address might be selected on device other than: VRF
PING 10.0.0.1 (10.0.0.1) from 10.0.0.2 VRF: 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.343 ms

--- 10.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.343/0.343/0.343/0.000 ms

Step 5: Ping IP address 1.0.0.1 from DUT0:

admin@DUT0$ ping 1.0.0.1 vrf VRF count 1 size 56 timeout 1
Show output
ping: Warning: source address might be selected on device other than: VRF
PING 1.0.0.1 (1.0.0.1) from 1.0.0.2 VRF: 56(84) bytes of data.
64 bytes from 1.0.0.1: icmp_seq=1 ttl=64 time=0.317 ms

--- 1.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.317/0.317/0.317/0.000 ms

Step 6: Run command interfaces ethernet show at DUT2 and check if output contains the following tokens:

20.0.0.50
Show output
---------------------------------------------------------------------
  Name             IP Address           Admin  Oper  Vrf  Description
---------------------------------------------------------------------
    eth0  fe80::dcad:beff:feef:6c30/64  up     up
eth0.200  20.0.0.50/24                  up     up
          fe80::dcad:beff:feef:6c30/64
    eth1                                down   down