Dhcp Vrf

This scenario shows how to configure a DHCP client in a VRF-enslaved interface.

../../../../_images/topology16.svg

Test DHCP Client

Description

Two VLAN interfaces are configured in each node. In DUT0, VLAN 101 and VLAN 102 are configured on eth0 and eth1 respectively. The ‘Ping’ command is used to ensure there’s link connectivity.

Scenario

Step 1: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 192.168.100.1/24
set interfaces ethernet eth1 address 10.0.0.1/24
set service dhcp-server shared-network dhcpserver subnet 192.168.100.0/24 options default-router 192.168.100.1
set service dhcp-server shared-network dhcpserver subnet 192.168.100.0/24 start 192.168.100.50 stop 192.168.100.50

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address dhcp
set interfaces ethernet eth0 vrf RED
set system vrf RED

Step 3: Run command interfaces ethernet eth0 show at DUT0 and check if output contains the following tokens:

192.168.100.50/24
RED
Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  192.168.100.50/24             up     up    RED
      fe80::dcad:beff:feef:6c10/64

Step 4: Run command service dhcp-client show leases interface eth0 at DUT0 and check if output contains the following tokens:

192.168.100.50
Show output
Interface:     eth0
IP address:    192.168.100.50
Subnet mask:   255.255.255.0
Routers:       192.168.100.1
Name-servers:
Domain-name:
NTP servers:
DHCP server:   192.168.100.1
Lease time:    43200
Expiry date:   Tue Feb 27 06:42:53 2024
Reason:        BOUND

Step 5: Run command protocols vrf RED ip show route at DUT0 and check if output matches the following regular expressions:

S>.*0\.0\.0\.0\/0.*via 192.168.100.1, eth0.*
Show output
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
       f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

VRF RED:
S>* 0.0.0.0/0 [1/0] via 192.168.100.1, eth0, weight 1, 00:00:00
K * 0.0.0.0/0 [255/8192] unreachable (ICMP unreachable), 00:00:02
C>* 192.168.100.0/24 is directly connected, eth0, 00:00:00

Step 6: Ping IP address 192.168.100.1 from DUT0:

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

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

Step 7: Ping IP address 10.0.0.1 from DUT0:

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

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