Fallback
This scenario shows how to configure an Ethernet interface with DHCP and with a fallback IP address.
Test DHCP client
Description
Initially, DHCP-Server (DUT1) is disabled. Since no IP address is received on the client-side (DUT0), the fallback IP address is used instead. Once DHCP-Server is enabled, DUT0 starts using the new IP address.
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 set service dhcp-server disable
Step 2: Set the following configuration in DUT0
:
set interfaces ethernet eth0 address dhcp set interfaces ethernet eth0 dhcp client fallback 192.168.100.100/24
Step 3: Run command interfaces ethernet show
at DUT0
and check if output contains the following tokens:
192.168.100.100/24Show output
----------------------------------------------------------------- Name IP Address Admin Oper Vrf Description ----------------------------------------------------------------- eth0 192.168.100.100/24 up up fe80::dcad:beff:feef:6c10/64 eth1 down down
Step 4: Ping IP address 192.168.100.1
from DUT0
:
admin@DUT0$ ping 192.168.100.1 count 1 size 56 timeout 1Show 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.607 ms --- 192.168.100.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.607/0.607/0.607/0.000 ms
Step 5: Set the following configuration in DUT1
:
del service dhcp-server disable
Step 6: Run command service dhcp-client renew interface eth0
at DUT0
and expect this output:
Show output
Renewing DHCP lease on interface eth0...
Step 7: Run command interfaces ethernet show
at DUT0
and check if output contains the following tokens:
192.168.100.50/24Show output
----------------------------------------------------------------- Name IP Address Admin Oper Vrf Description ----------------------------------------------------------------- eth0 192.168.100.50/24 up up fe80::dcad:beff:feef:6c10/64 eth1 down down
Step 8: Ping IP address 192.168.100.1
from DUT0
:
admin@DUT0$ ping 192.168.100.1 count 1 size 56 timeout 1Show 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.338 ms --- 192.168.100.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.338/0.338/0.338/0.000 ms