Dhcp Address

This scenario shows how to obtain an IP address over DHCP (Dynamic Host Configuration Protocol).

../../../../_images/dhcp2.svg

Test DHCP Client

Description

DUT0 is configured to obtain an IP address over DHCP.

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 bridge br0 address dhcp
set interfaces ethernet eth0 bridge-group bridge br0

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

192.168.100.50/24
Show output
--------------------------------------------------------------------------------------------------------------
Name  Idx           IP Address           Admin  Oper  Link  MTU   Vrf  Upper  Lower   Type       Phys addr
--------------------------------------------------------------------------------------------------------------
 br0  387  192.168.100.50/24             up     up    up    1500                     bridge  de:ad:be:ef:6c:10
           fe80::d478:d8ff:fe61:d99f/64

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

192.168.100.50
Show output
Interface:     br0
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:   Thu Jan 25 13:21:52 2024
Reason:        BOUND

Step 5: Run command protocols 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, br0.*
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

S>* 0.0.0.0/0 [1/0] via 192.168.100.1, br0, weight 1, 00:00:01
C>* 192.168.100.0/24 is directly connected, br0, 00:00:01

Step 6: Ping IP address 192.168.100.1 from DUT0:

admin@DUT0$ ping 192.168.100.1 count 1 size 56 timeout 1
Show output
PING 192.168.100.1 (192.168.100.1) 56(84) bytes of data.
64 bytes from 192.168.100.1: icmp_seq=1 ttl=64 time=0.315 ms

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

Step 7: Ping IP address 10.0.0.1 from DUT0:

admin@DUT0$ ping 10.0.0.1 count 1 size 56 timeout 1
Show 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.384 ms

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