Skip to content

IP Service

[Command]
show ip interfaces

[Purpose]
Display the IP address configured for the interface

[View]
System view

[Use Cases]

sonic# show ip interfaces
Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP
----------- -------- ----------------- ------------ -------------- ---------
0/49 30.11.13.10/30 up/up N/A N/A
0/50 30.11.13.138/30 up/up N/A N/A
loopback0 30.11.0.84/32 up/up N/A N/A
vlan400 30.11.64.1/32 up/up N/A N/A
vlan800 30.11.14.254/32 up/up N/A N/A
mgmt mgmt 192.168.1.10/24 up/up N/A N/A

[Command]
ip address A.B.C.D/M no ip address A.B.C.D/M

[Purpose]
Add an IP address to the interface

[Parameter]

ParameterDescription
A.B.C.D/MIP address with prefix length

[View]
Interface view

[Use Cases]

sonic# configure terminal
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 3.3.3.6/24
sonic(config-if-2)# show this
!
interface ethernet 2
ip address 3.3.3.6/24

[Command]
ip address dhcp-alloc

[Purpose]
Enable the device to act as a DHCP client to dynamically obtain an IP address.

[View]
Interface view

[Use Cases]

sonic# configure terminal
sonic(config)# interface vlan 10
sonic(config-vlanif-10)# ip address dhcp-alloc

[Command]
mac-address HH:HH:HH:HH:HH:HH no mac-address

[Purpose]
Configure MAC addresses for layer 3 ports

[Parameter]

ParameterDescription
HH:HH:HH:HH:HH:HHMAC address

[View]
Interface view

[Notes]
By default, all Layer 3 interfaces on the device have the same MAC address. The first 32bits of user-defined Layer 3 interface MAC addresses need to be consistent.

[Use Cases]

sonic# configure terminal
sonic(config)# interface ethernet 2
sonic(config-if-2)# mac-address 00:00:00:37:67:af
sonic(config-if-2)# show this
!
interface ethernet 2
mac-address 00:00:00:37:67:af

[Command]
show arp

[Purpose]
Show IP ARP table

[View]
System view

[Use Cases]

sonic# show arp
Address MacAddress Iface vlan Type
------------- ----------------- ------- ---- --------
192.168.0.1 6c:b3:11:33:aa:6c mgmt - Dynamic
192.168.0.237 8c:ec:4b:67:ae:42 mgmt - Dynamic
192.168.14.35 00:0c:29:89:bc:9b mgmt - Dynamic
Total number of entries 3

[Command]
show arp-proxy count [ second ]

[Purpose]
Show the number of ARP proxy replies

[Parameter]

ParameterDescription
secondSpecify the number of seconds to view, range: 1-3600

[View]
System view

[Use Cases]

sonic# show arp-proxy count

[Command]
show interface arp-proxy status

[Purpose]
Show interface ARP proxy status

[View]
System view

[Use Cases]

sonic# show interface arp-proxy status
+--------------+------------+
| Interfaces | Status |
+==============+============+
| Ethernet49 | disable |
+--------------+------------+
| Ethernet50 | disable |
+--------------+------------+
| Vlan400 | anycast_gw |
+--------------+------------+

[Command]
clear neighbor {all|static|dynamic}
clear neighbor interface { interface_type } interface_name

[Purpose]
Clear ARP, NDP table entries

[Parameter]

ParameterDescription
interface_typeInterface type, optional ethernet, vlan, link-aggregation
interface_nameoptional interface_num, vlan_id, lag_id

[View]
System view

[Use Cases]

sonic# clear neighbor all

[Command]
arp static A.B.C.D HH:HH:HH:HH:HH:HH { interface_type } interface_name
no arp static A.B.C.D { interface_type } interface_name

[Purpose]
Configure static ARP

[Parameter]

ParameterDescription
A.B.C.DIP address
HH:HH:HH:HH:HH:HHMAC address
interface_typeInterface type, optional ethernet, vlan, link-aggregation
interface_nameInterface name, optional interface_num, vlan_id, lag_id

[View]
System configuration view

[Use Cases]

sonic# configure terminal
sonic(config)# arp static 3.3.3.3 00:00:00:00:00:01 vlan 5
sonic(config)# arp static 4.4.4.4 00:00:00:00:00:02 ethernet 1
sonic(config)# arp static 5.5.5.5 00:00:00:00:00:03 link-aggregation 1

[Command]
arp timeout expire_time

[Purpose]
Configure ARP table entry aging time

[Parameter]

ParameterDescription
expire_timeTime value, range 60-7200, unit s

[View]
System configuration view

[Use Cases]

sonic# configure terminal
sonic(config)# arp timeout 500

[Command]
arp-proxy mode { mode_type }
no arp-proxy

[Purpose]
Enable the ARP proxy function of the interface

[Parameter]

ParameterDescription
mode_typedefault/evpn/anycast_gw,default mode by “default”.

[View]
Interface view

[Usage Scenario] In scenarios where Layer 2 broadcast isolation is enabled, allowing communication between devices in the same LAN requires a common approach. One common method is to enable ARP proxy on the interface acting as the gateway. This allows the gateway’s MAC address to be sent to devices initiating ARP requests, effectively converting local Layer 2 communication into Layer 3 routed communication.

In a VxLAN scenario, enabling the arp-proxy evpn mode allows the local VTEP to use the ARP information synchronized from the remote end via EVPN to perform proxy responses for local terminal ARP requests

[Notes]
On devices with ARP proxy enabled, you may need to use the arp-to-host convert enable command to convert learned ARP entries into host routes, ensuring proper routing.

[Use Cases]

sonic# configure terminal
sonic(config)# interface vlan 400
sonic(config-vlanif-400)# arp-proxy mode anycast_gw

[Command]
arp broadcast {copy|trap}

[Purpose]
Configure the handling actions for ARP broadcast messages on the device.

[Parameter]

ParameterDescription
copyCopy ARP broadcast messages, one for CPU processing and another broadcast to other interfaces
trapOnly send ARP messages to the CPU for processing

[View]
System configuration view

[Usage Scenario] This command is commonly used in conjunction with the “broadcast drop” command to change the processing method of ARP messages to only send to the CPU without forwarding, completely isolating Layer 2 broadcast messages between terminals.

[Use Cases]

sonic# configure terminal
sonic(config)# arp broadcast trap

[Command]
arp-to-host convert enable {default| vrf_name } [ metric ]
no arp-to-host convert enable {default| vrf_name }

[Purpose]
Turn on ARP-TO-HOST function

[Parameter]

ParameterDescription
vrf_nameVRF name, the default VRF is “default”
metricmetric for hostroute, range 1-4294967295, default 5200

[View]
System configuration view

[Usage Scenario] Enabling this feature ensures that ARP (Address Resolution Protocol) and NDP (Neighbor Discovery Protocol) entries that match the ARP-TO-HOST policy are converted into host routes. This allows for more efficient routing and management of ARP and NDP entries.

[Use Cases]

sonic# configure terminal
sonic(config)# arp-to-host convert enable default

[Command]
arp-to-host policy default-policy vlan {permit|deny|pass}
arp-to-host policy default-policy network vrf vrfname {permit|deny}
arp-to-host policy vlan vlan_id {permit|deny|pass}
arp-to-host policy network A.B.C.D/M vrf vrfname {permit|deny}
no arp-to-host policy default-policy {vlan |network vrf vrfname }
no arp-to-host policy {vlan vlan_id |network A.B.C.D/M vrf vrfname }

[Purpose]
Configure the ARP-TO-HOST interface routing policy

[Parameter]

ParameterDescription
vlanFilter ARP/ND table entries by VLAN
A.B.C.D/MFilter ARP/ND table entries by network segment
vrfnameVRF name, the default VRF is “default”
vlan_idrange 1-4094

[View]
System configuration view

[Notes]
If the neighbor table entry matches the configured segment, it will be processed according to the policy action, permit means allowed to convert to host route, deny means not allowed. Table entries that not hit the network policy will be processed by the default policy in the same way as above.

[Use Cases]

sonic# configure terminal
sonic(config)# arp-to-host policy network 10.50.1.5/24 vrf 1 permit

[Command]
show dhcp relay config

[Purpose]
Display DHCP relay related configuration

[View]
System view

[Use Cases]

sonic# show dhcp relay config
+-----------+-----------+-------------------+-----------+---------------------+
| Name | down link | up link | loopback | server |
+===========+===========+===================+===========+=====================+
| test1(v4) |Vlan800 | Ethernet49 | Loopback0 | 150.1.0.1,151.1.0.1 |
+-----------+-----------+-------------------+-----------+---------------------+
| test2(v6) |Vlan800 | Ethernet49 | Loopback0 | 4005::1 |
+-----------+-----------+-------------------+-----------+---------------------+

[Command]
dhcp-relay name {v4|v6}
no dhcp-relay name {v4|v6}

[Purpose]
Configuring DHCP relay instance

[Parameter]

ParameterDescription
nameDHCP Relay name

[View]
System configuration view

[Usage Scenario] When users and DHCP servers are in different broadcast domains (different subnets), the device can act as a DHCP relay agent to encapsulate the user’s DHCP request broadcast message into a unicast message and send it to the DHCP server.

[Notes]
The device supports the configuration of multiple DHCP instances as DHCP relay for the scenario that different terminals use different DHCP Server.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test__v4)#

[Command]
down_link interface vlan vlan_id
no down_link interface vlan vlan_id

[Purpose]
Specify the interface ID of the connected terminal in the relay instance

[Parameter]

ParameterDescription
vlan_idVLAN ID of the physical port to which the terminal is connected

[View]
DHCP-relay view

[Usage Scenario] To allow users who need to obtain IP addresses dynamically, specify the VLAN where these users are located as the downstream interface of the Relay instance. All users within this VLAN can then obtain IP addresses from the DHCP server configured within this instance.

[Notes]
Multiple VLAN interfaces are supported to be configured under the same instance. Modify down link interface related content, such as: SVI port corresponding VLAN add member interface, modify the interface IP address, MAC address, etc., need to reconfigure Relay instance.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test__v4)# down_link interface vlan 10

[Command]
up_link interface { interface_type } { interface_name }
no up_link interface { interface_type } { interface_name }

[Purpose]
Specify the interface ID of the Relay instance to which the DHCP server is connected

[Parameter]

ParameterDescription
interface_typeSupported configurations:ethernet, link-aggregation, vlan
interface_nameSupported configurations: ethernet_num, lag_id, vlan_id

[View]
DHCP-relay view

[Usage Scenario] In a DHCP relay environment, to ensure that only legitimate DHCP response packets from a specified interface are accepted, you can use this command to specify the interface. This prevents illegal servers from providing unauthorized IP addresses to users, thereby maintaining network security.

[Notes]
Multiple interfaces are supported to be configured under the same instance.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test__v4)# up_link interface ethernet 1

[Command]
server_ip { A.B.C.D | A:B:C:D:E:F:G:H }
no server_ip { A.B.C.D | A:B:C:D:E:F:G:H }

[Purpose]
Specify the DHCP server IP address of the relay instance

[Parameter]

ParameterDescription
A.B.C.Dipv4 address
A:B:C:D:E:F:G:Hipv6 address

[View]
DHCP-relay view

[Notes]
Up to two DHCP Serve configurations are supported under the same instance. The DHCP Server under different instances can be different. The relay will send DHCP request packets to all DHCP servers and forward all received response packets to the client. The client will then choose from these responses.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test __v4)# server_ip 150.1.0.1

[Command]
loopback_interface loopback loopback_id
no loopback_interface loopback loopback_id

[Purpose]
To configure the DHCP relay packet’s relay agent address as the IP address of a Loopback interface

[View]
DHCP-relay view

[Usage Scenario] In scenarios where users utilize a distributed gateway, if the DHCP relay still uses the user gateway’s IP address as the Relay Agent IP address, the DHCP server will be unable to communicate with the relay through that IP address, resulting in unreachable response packets. Users can use this command to specify the Relay Agent IP address as the IP address of a Loopback interface that uniquely identifies a device. This allows the DHCP server to forward response packets to the requesting DHCP relay.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test __v4)# loopback_interface loopback 0

[Command]
dhcp-agent address A.B.C.D

[Purpose]
Specify the DHCP Server IP address of the Relay instance

[View]
Interface vlan view

[Usage Scenario] By default, DHCP relays insert the option82 field into DHCP request packets, populating the DHCP relay interface’s IP address with the “link-selection” field within option82. DHCP servers use this field to select an IP address pool for allocation. However, some DHCP servers do not support parsing the “link-selection” field. In such cases, you need to configure this command to specify the Relay Agent IP so that the server can select an IP address pool based on this field.

[Notes]
When used in a distributed gateway scenario, different relay devices should be configured with different IP addresses to ensure that the DHCP server can forward response packets to the originating DHCP relay.

[Use Cases]

sonic# configure terminal
sonic(config)# interface vlan 100
sonic(config-vlanif-100)# dhcp-agent address 192.168.1.10

[Command]
no_option82
no no_option82

[Purpose]
Enable no option82 mode

[View]
DHCP-relay view

[Notes]
After configuring this command, DHCP relay will no longer include the option82 field in forwarded DHCP packets. This command should be used in conjunction with the dhcp-agent address command.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test __v4)# no_option82

[Command]
dhcp option82 encapsulation remote-id value

[Purpose]
Configuring the addition of the “remote-id” sub-option in option82

[View]
interface vlan view

[Usage Scenario] To configure the addition of the “remote-id” sub-option in Option 82, you may need to specify the relevant settings based on your networking equipment or DHCP server software. In general, Option 82 is often associated with DHCP and is used to carry additional information about the client.

[Use Cases]

sonic(config)# interface vlan 100
sonic(config-vlanif-100)# dhcp option encapsulation remote-id clientUser

[Command]
source_ip A.B.C.D
no source_ip

[Purpose]
Specify the source IP for DHCP message interactions.

[View]
DHCP-relay view

[Usage Scenario] This command allows you to specify the Ethernet layer source IP address for DHCP relay messages.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test1__v4)# source_ip 30.102.0.216

[Command]
show dhcp pool info ip-version {v4|v6}

[Purpose]
View the status and configuration of the created DHCP address pool

[View]
System view

[Use Cases]

sonic# show dhcp pool info ip-version v4
+-----------+---------------+---------------+----------------+-----------------+-----------------------+-------------------+-----------+-----------------+
| Pool Name | Network | Mask | Lease Start | Lease End | Default Lease Time(s) | Max Lease Time(s) | Bind Info | DNS |
+===========+===============+===============+================+=================+=======================+===================+===========+=================+
| test | 192.168.200.0 | 255.255.255.0 | 192.168.200.10 | 192.168.200.100 | 6000 | 12000 | Vlan43 | 114.114.114.114 |
+-----------+---------------+---------------+----------------+-----------------+-----------------------+-------------------+-----------+-----------------+

[Command]
show dhcp pool ip-in-use [ A.B.C.D/A::B ]

[Purpose]
View DHCP address pool IP address allocation status

[View]
System view

[Usage Scenario] Display IP addresses already assigned in the DHCP pool.

[Use Cases]

sonic# show dhcp pool ip-in-use
Reading leases from /var/lib/dhcp/dhcpd.leases
IP MAC hostname binding state starts ends
=====================================================================================================
20.1.1.41 00:00:12:01:01:15 XINERTEL active 2024-02-26 09:27:00 2024-02-26 09:37:00
20.1.1.23 00:00:12:01:01:03 XINERTEL active 2024-02-26 09:27:00 2024-02-26 09:37:00
20.1.1.22 00:00:12:01:01:02 XINERTEL active 2024-02-26 09:27:00 2024-02-26 09:37:00
total lease :3

[Command]
show dhcp pool expired [ A.B.C.D/A::B ]

[Purpose]
View expired IP addresses in the DHCP address pool

[View]
System view

[Usage Scenario] Display IP addresses that were previously allocated in the DHCP address pool but have expired their lease.

[Use Cases]

sonic# show dhcp pool expired
Reading leases from /var/lib/dhcp/dhcpd.leases
IP MAC hostname binding state starts ends
=====================================================================================================
20.1.1.10 00:00:02:01:01:0a -NA- free 2024-02-26 09:09:57 2024-02-26 09:11:30
20.1.1.9 00:00:02:01:01:09 -NA- free 2024-02-26 09:09:57 2024-02-26 09:11:30
total lease :2

[Command]
show dhcp class

[Purpose]
Display DHCP class

[View]
System view

[Use Cases]

sonic# show dhcp class
dhcp class pc
if-match rule 1 option 93 hex 0000
dhcp class test1
dhcp class x86
if-match rule 1 option 93 hex 0001

[Command]
show dhcp option-group

[Purpose]
Display dhcp option-group

[View]
System view

[Use Cases]

sonic# show dhcp option-group
dhcp option-group 1
bootfile-name ftp://teraspek:teraspek@150.1.0.1/test.txt
option43 hex 8888 force
tftp-server 150.1.0.1
dhcp option-group 2
bootfile-name ftp://teraspek:teraspek@150.1.0.1/ppap.txt
option43 hex 8888 force
tftp-server 150.1.0.1

[Command]
show dhcp failover info

[Purpose]
View DHCP server dual-active backup configuration

[View]
System view

[Use Cases]

sonic# show dhcp failover info
--------------------------------------------------
Failover-name : ceshi
Local-address : 30.102.0.230
Peer-address : 30.102.0.216
Role : primary
Max_response_delay : 60
Heartbeat_inteval : 20
Local-state : normal
Peer-state : normal
Split : 50%

[Command]
dhcp pool name
no dhcp pool name

[Purpose]
Create address pools

[View]
System configuration view

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test
sonic(config-dhcp-pool-test)#

[Command]
network A.B.C.D mask

[Purpose]
Specify the network segment where the DHCP server assigns the IP address to the Client

[Parameter]

ParameterDescription
A.B.C.Dip-address
masksubnet mask

[View]
DHCP view

[Notes]
When creating DHCP address pools, it is advisable to prioritize the configuration of this command.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test
sonic(config-dhcp-pool-test)# network 192.168.0.0 255.255.0.0

[Command]
address-pool A.B.C.D A.B.C.D

[Purpose]
Specify the range of IP addresses assigned to client by DHCP server

[Parameter]

ParameterDescription
A.B.C.DStart IP address and end IP address in the format: A.B.C.D/A::B

[View]
DHCP view

[Notes]
Before specifying the address-pool range, user should first use the network command to confirm the subnet to which the addresses belong. If this address pool is already bound to a specific VLAN, any necessary modifications require unbinding and rebinding to take effect.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test
sonic(config-dhcp-pool-test)# address-pool 192.168.1.1 192.168.10.1

static-bind ip-address A.B.C.D mac-address nn:nn:nn:nn:nn:nn

Section titled “static-bind ip-address A.B.C.D mac-address nn:nn:nn:nn:nn:nn”

[Command]
static-bind ip-address A.B.C.D mac-address nn:nn:nn:nn:nn:nn

[Purpose]
configure static MAC-IP binding on the DHCP server to assign fixed IP addresses to specified terminals

[Parameter]

ParameterDescription
A.B.C.Daddress in the format: A.B.C.D
nn:nn:nn:nn:nn:nntermial mac address in the formart: HH:HH:HH:HH:HH:HH

[View]
DHCP view

[Notes]
Configure the MAC-IP binding with addresses outside the DHCP pool range to ensure fixed IP assignment.

[Use Cases]

sonic(config-dhcp-pool-a)# static-bind ip-address 1.1.1.11 mac-address 00:00:00:00:00:01

[Command]
dns ip_address

[Purpose]
Specify the DNS server address

[Parameter]

ParameterDescription
ip_addressThe format is: A.B.C.D/A::B

[View]
DHCP view

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test
sonic(config-dhcp-pool-test)# dns 8.8.8.8

[Command]
lease-time default_time max_time

[Purpose]
Specify IP address lease time

[Parameter]

ParameterDescription
default_timeDefault lease time
max_timeMaximum lease time

[View]
DHCP view

[Usage Scenario] Clients use IP addresses assigned by DHCP servers for network communication. When the default lease time is reached, clients must either renew their lease or obtain a new IP address from the DHCP server. If a client fails to renew its lease after the default lease time, it will continue using the IP address lease until it reaches the maximum lease time. Once the maximum lease time expires, the client must request a new IP address.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test
sonic(config-dhcp-pool-test)# lease-time 6000 12000

[Command]
routers A.B.C.D

[Purpose]
Specify the gateway address assigned to the DHCP client by the DHCP server

[Parameter]

ParameterDescription
A.B.C.DIP address

[View]
DHCP view

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test
sonic(config-dhcp-pool-test)# routers 192.168.1.1

[Command]
server_detect enable
no server_detect enable

[Purpose]
Enable DHCP server connectivity probing function

[View]
DHCP Relay view

[Use Cases]

sonic(config-dhcp-relay-dhcp_relay__v4)# server_detect enable

[Command]
server_detect interval time

[Purpose]
Configure DHCP server connectivity probe packet interval

[Parameter]

ParameterDescription
timedefault 30 seconds, range 30-3600

[View]
DHCP Relay view

[Use Cases]

sonic(config-dhcp-relay-dhcp_relay__v4)# server_detect interval 60

[Command]
option43 hex value

[Purpose]
Enable the option43 function of DHCP Server

[Parameter]

ParameterDescription
valueHexadecimal number, according to the AC format requirements of different vendors

[View]
DHCP view

[Usage Scenario] Option 43 is used to specify the IP address of the AC for the AP so that the AP can establish a connection with the AC.

[Use Cases]

sonic(config)# dhcp pool 1
sonic(config-dhcp-pool-1)# option43 hex 8007000001ac100102

[Command]
bootfile-name bootfile

no bootfile-name

[Purpose]
Configure the boot configuration file name for DHCP clients

[Parameter]

ParameterDescription
bootfileString format, case-sensitive, specifying the configuration file name

[View]
DHCP view

[Usage Scenario] DHCP servers can provide network configuration parameters needed by clients, such as boot configuration files, in addition to assigning IP addresses to clients. By configuring this command, the DHCP server includes the specified file name in OFFER and ACK messages sent to clients. Subsequently, DHCP clients can use this file name to retrieve the boot configuration file from a designated file server.

[Use Cases]

sonic(config)# dhcp pool 1
sonic(config-dhcp-pool-1)# bootfile-name test.json

[Command]
next-server ip_address

no next-server

[Purpose]
Configure the network server IP address to be used by DHCP client during the startup process

[Parameter]

ParameterDescription
ip_addressSpecifies the server IP address to be used by the DHCP client

[View]
DHCP view

[Usage Scenario] In addition to assigning IP addresses to DHCP clients, DHCP servers can also allocate server IP addresses for providing network services to DHCP clients. For example, some clients like IP phones may require connecting to a specified server to install software after obtaining an IP address automatically. By executing this command to configure the server address that the client should use after automatically obtaining an IP address, the client will request configuration information from the specified server after acquiring an IP address automatically.

[Use Cases]

sonic(config)# dhcp pool 1
sonic(config-dhcp-pool-1)# next-server 192.168.0.10

[Command]
tftp-server server_name

[Purpose]
Configure the TFTP Server Address for DHCP Clients

[Parameter]

ParameterDescription
server_nameA case-sensitive string specifying the TFTP server address or domain name used by DHCP clients

[View]
DHCP view

[Usage Scenario] After booting up, devices may need to access configuration files from a TFTP server. By configuring this option, DHCP clients can obtain the IP address of a TFTP server while acquiring an IP address, enabling them to access the server after booting up to retrieve necessary information.

[Use Cases]

sonic(config)# dhcp pool 1
sonic(config-dhcp-pool-1)# tftp-server 192.168.0.10

[Command]
dhcp select server

[Purpose]
Enable the DHCP server feature on the interface using the global address pool

[View]
Interface view

[Notes]
This command is used for the DHCP server. When the DHCP server receives a DHCP message from a DHCP client, it will look up a suitable IP address from the address pool to assign to the client.

[Use Cases]

sonic(config)# interface ethernet 1
sonic(config-if-1)# dhcp select server

[Command]
dhcp class name

[Purpose]
Creating a DHCP user class

[View]
System configuration view

[Usage Scenario] Creating a DHCP user class involves configuring a set of parameters and options that are associated with a specific class of DHCP clients

[Use Cases]

sonic(config)# dhcp class test1
sonic(config-dhcp-class-test1)#

[Command]
if-match rule rule_idoption 93 hex value
if-match rule rule_id option 82 remote-id value

[Purpose]
Configuring matching rules for DHCP user classes

[Parameter]

ParameterDescription
rule_idrange 1-16, the higher number has higher priority

[View]
DHCP class view

[Usage Scenario] The DHCP server determines the DHCP user class to which a DHCP client belongs by matching the messages sent by the DHCP client with the rules configured in this command. Within the DHCP user class view, multiple matching rules can be configured by repeatedly executing the “if-match” command. As long as any rule successfully matches, the DHCP client is considered part of that user class, and the contents bound to the option-group for that user class can be assigned to the client.

[Notes]
Currently, only filtering of option 93 is supported.

[Use Cases]

sonic(config)# dhcp class test1
sonic(config-dhcp-class-test1)# if-match rule 1 option 93 hex 0000

[Command]
dhcp option-group id

[Purpose]
Create a DHCP option group and enter the option group view

[Parameter]

ParameterDescription
idThe range of values from 1 to 65535

[View]
System configuration view

[Use Cases]

sonic(config)# dhcp option-group 1
sonic(config-dhcp-option-group-1)# bootfile-name test.txt
sonic(config-dhcp-option-group-1)# tftp-server 150.1.0.1

[Command]
class name option-group id

[Purpose]
Bind user classes to option groups.

[Parameter]

ParameterDescription
nameDHCP class name
idOption group ID

[View]
DHCP view

[Notes]
A DHCP user class can only be associated with one DHCP option group

[Use Cases]

sonic(config)# dhcp pool test
sonic (config-dhcp-pool-test)# class pc option-group 1
sonic (config-dhcp-pool-test)# class x86 option-group 2

[Command]
class name address-pool ip_address_start ip_address_end

[Purpose] Configure the assignment of specific address pools based on the user class of the DHCP address pool.

[Parameter]

ParameterDescription
nameDHCP user class name
ip_addressStart IP address and end IP address in the format: A.B.C.D/A::B

[View]
DHCP view

[Notes]
Before specifying the address-pool range, user should first use the network command to confirm the subnet to which the addresses belong. If this address pool is already bound to a specific VLAN, any necessary modifications require unbinding and rebinding to take effect.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test
sonic(config-dhcp-pool-test)# class test address-pool 192.168.1.1 192.168.10.1
sonic(config-dhcp-pool-test)# class public address-pool 192.168.20.1 192.168.30.1

[Command]
failover String

[Purpose]
Configure the DHCP address pool to be bound with a dual-active backup

[Parameter]

ParameterDescription
Stringfailover name

[View]
DHCP view

[Usage Scenario] This scenario applies to environments like MC-LAG where dual-device load balancing is implemented. In such setups, DHCP servers are deployed on two devices that share the same address pool. If one of the servers fails, the other server takes over and manages the allocation of all DHCP addresses from the shared pool. This redundancy ensures continuous availability and reliability of IP address assignments for network clients.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test
sonic(config-dhcp-pool-test)# failover test

[Command]
address loopback 0

[Purpose]
This command specifies the source IP address for DHCP server high-availability protocol interaction as the local Loopback0 address.

[View]
DHCP Failover view

[Use Cases]

sonic(config)# dhcp failover ceshi
sonic(config-dhcp-failover-ceshi)# address loopback 0

[Command]
peer address A.B.C.D

[Purpose]
This command specifies the destination IP address for DHCP server high-availability protocol interaction.

[Parameter]

ParameterDescription
A.B.C.DIP address of the peer device interface

[View]
DHCP Failover view

[Use Cases]

sonic(config)# dhcp failover ceshi
sonic(config-dhcp-failover-ceshi)# peer address 30.102.0.216

[Command]
role {primary|secondary}

[Purpose]
Configure the server role during dual-active backup

[Parameter]

ParameterDescription
primaryPrimary server
secondarybackup server

[View]
DHCP Failover view

[Notes]
The primary DHCP server allows you to specify a split value, which determines the percentage of the address pool it will manage.

[Use Cases]

sonic(config)# dhcp failover ceshi
sonic(config-dhcp-failover-ceshi)# role primary

[Command]
max-response-delay interval

[Purpose]
Configure the max-response-delay for communication interruption during dual-active backup

[Parameter]

ParameterDescription
intervalTime interval, range 30-3600 seconds, default is 60 seconds

[View]
DHCP Failover view

[Usage Scenario] If a server does not receive messages from its failover peer after the set time, it considers the communication link between the two servers interrupted. Each server then manages its own address pool. When receiving a DHCP request from a client, both servers will allocate different IP addresses, with the client confirming the address from the first DHCP relay message. Once communication between the DHCP servers is restored, they will synchronize the address allocation that occurred during the failure

[Use Cases]

sonic(config)# dhcp failover ceshi
sonic(config-dhcp-failover-ceshi)# max-response-delay 30

[Command]
auto-partner-down second

[Purpose]
Enable the timed delay for dual-active backup

[Parameter]

ParameterDescription
secondTime interval, range 1-3600

[View]
DHCP Failover view

[Usage Scenario] When the two servers are in a state of communication link interruption, after the configured delay timer, the servers will automatically enter the partner-down state. The surviving DHCP server will consider its peer to be down. After the lease time configured for the address pool, the active server will have full authority to allocate addresses from the entire address pool to clients.

[Use Cases]

sonic(config)# dhcp failover ceshi
sonic(config-dhcp-failover-ceshi)# auto-partner-down 60

[Command]
split percent

[Purpose]
Set the server address allocation weight

[Parameter]

ParameterDescription
percentload balancing split percent,range 0-100

[View]
DHCP Failover view

[Usage Scenario] When the two servers can achieve load balancing and failover, they calculate a hash value in the range of 1-255 based on the client identifier field in the DHCP request message. These 255 values are divided according to the configured weight ratio. For example, if the primary server’s weight is set to 80 and the backup server’s weight is set to 20, then 80% of these 255 values will be allocated to the primary server, and the remaining 20% will go to the backup server.

[Use Cases]

sonic(config)# dhcp failover ceshi
sonic(config-dhcp-failover-ceshi)# split 80

[Command]
show ipv6 interfaces

[Purpose]
View IPv6 address information

[View]
System view

[Notes]
The physical state of the interface is admin.

[Use Cases]

sonic# show ipv6 interfaces
Interface Master IPv6 address/mask MAC Address Admin/Oper
----------- -------- ------------------- ----------------- ------------
vlan10 2001::1008/64 60:eb:5a:01:1c:93 up/up

[Command]
show ndp
show ndp ipv6-address A::B
show ndp iface {mgmt|ethernet interface_num } ipv6-address A::B

[Purpose]
View IPv6 neighbor table entry information

[View]
System view

[Use Cases]

sonic# show ndp
Address MacAddress Iface Vlan Status
---------------------- ----------------- ---------- ------ ---------
2022::9300 18:17:25:37:65:08 Ethernet50 - REACHABLE
2022::9310 18:17:25:37:67:22 Ethernet49 - REACHABLE
fd00:400::ae2b 94:e6:f7:25:3b:3b Ethernet11 400 REACHABLE

[Command]
show nd ipv6 mac-check

[Purpose]
Show IPv6 MAC address detection configuration

[View]
System view

[Use Cases]

sonic# show nd ipv6 mac-check
+-----------+
| enabled |
+===========+
| false |
+-----------+

[Command]
show nd rate-limit

[Purpose]
Show ND packets speed limit configuration

[View]
System view

[Use Cases]

sonic# show nd rate-limit
+--------------+
| rate-limit |
+==============+
| 2000 pps |
+--------------+

[Command]
ip address A::B/mask
no ip address A::B/mask

[Purpose]
Specify the IPv6 address of the interface

[Parameter]

ParameterDescription
A::B/maskTotal length is 128 bits in the format

[View]
Interface view

[Use Cases]

sonic# configure terminal
sonic(config)# interface vlan 100
sonic(config-vlanif-100)# ip address fd00::1000/64

[Command]
ipv6 use-link-local
no ipv6 use-link-local

[Purpose]
Use the interface’s IPv6 link-local address for BGP neighbor session establishment.

[View]
Interface view、lag view

[Use Cases]

sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# ipv6 use-link-local

[Command]
nd ra
no nd ra

[Purpose]
Enable the interface to send RA packets

[View]
System configuration view

[Usage Scenario] Enabling this configuration causes the device to periodically broadcast RA messages. These messages contain information about IPv6 address prefixes and the Autonomous Address Configuration (Autoconfig) flag set to disabled. End-user devices connected to this router will generate IPv6 addresses using stateless configuration methods, as they will not rely on automatic address assignment.

[Use Cases]

sonic# configure terminal
sonic(config)# nd ra

[Command]
nd ra autonomous {on|off }

[Purpose]
Set the flag bit of the stateless auto-configuration address in the RA packets

[View]
Vlan view, System configuration view

[Notes]
The default state is off, and the flag bit is 0.

[Use Cases]

sonic# configure terminal
sonic(config)# vlan 100
sonic(config-vlan-100)# nd ra autonomous on

[Command]
nd ra dns-server A::B no nd ra dns-server A::B

[Purpose]
Set the DNS server address in the RA packets

[View]
Vlan view, System configuration view

[Use Cases]

sonic# configure terminal
sonic(config)# vlan 100
sonic(config-vlan-100)# nd ra dns-server 2400:3200:baba::1

[Command]
nd ra link-mtu mtu

[Purpose]
Set the link_mtu in the RA packet

[Parameter]

ParameterDescription
mtuValue range 0/1280-1500

[View]
Vlan view, System configuration view

[Usage Scenario] When enabled, this configuration specifies that the device includes an MTU option in its Router Advertisement (RA) messages. The value of the MTU option should match the MTU configured on the interface. Hosts receiving these RA messages will adjust the size of their transmitted packets based on the provided MTU value.

[Use Cases]

sonic# configure terminal
sonic(config)# vlan 100
sonic(config-vlan-100)# nd ra link-mtu 1500

[Command]
nd ra managed-flag {on|off}

[Purpose]
Set the flag bit of the stateful auto-configuration address in RA packet (FLAG M)

[View]
Vlan view, System configuration view

[Usage Scenario] The managed-flag in an RA (Router Advertisement) message for IPv6 is a flag that indicates whether hosts receiving the RA message should use DHCPv6 (Dynamic Host Configuration Protocol for IPv6) to obtain additional network configuration information, such as IPv6 addresses, DNS servers, and more. When the managed-flag is set to 1 in an RA message, it means that hosts receiving this message should use DHCPv6 to acquire IPv6 addresses and other configuration information. This is typically used in specific network deployment scenarios where more fine-grained address management or specific network policies are required. If the managed-flag is set to 0, then hosts receiving the RA message can use automatic configuration methods, such as SLAAC (Stateless Address Autoconfiguration), to generate IPv6 addresses without the need for DHCPv6. This is suitable for many typical IPv6 network deployments, where DHCPv6 is primarily used for distributing other configuration options rather than assigning IPv6 addresses.

[Use Cases]

sonic# configure terminal
sonic(config)# vlan 100
sonic(config-vlan-100)# nd ra managed-flag on

[Command]
nd ra other-flag {on|off}

[Purpose]
Set the flag bit for stateful auto-configuration of other information in RA packet (FLAG O)

[View]
Vlan view, System configuration view

[Usage Scenario] The “O” flag, which stands for the “other-flag” field in IPv6 Router Advertisement (RA) messages, is used to indicate whether hosts receiving the RA message should use other protocols for configuration. When the “O” flag (other-flag) in an RA message is set to 1, it means that hosts receiving this message should use other protocols to obtain additional network configuration information instead of using DHCPv6. This other protocol could be a custom protocol specific to the network environment or another configuration protocol. Setting the “O” flag allows network administrators to specify how hosts should obtain additional configuration information in special situations, not limited to the use of DHCPv6 or SLAAC. If the “O” flag is set to 0, then hosts receiving the RA message can follow standard IPv6 auto-configuration methods like SLAAC to generate IPv6 addresses, or they can use DHCPv6 to obtain configuration information, depending on the setting of the managed-flag field.

[Use Cases]

sonic# configure terminal
sonic(config)# vlan 100
sonic(config-vlan-100)# nd ra other-flag on

[Command]
nd ra prefix A::B/mask
no nd ra prefix A::B/mask

[Purpose]
Set the prefix information in RA packet

[Parameter]

ParameterDescription
A::B/maskThe format is X:X:X:X:X:X:X:X/x

[View]
Vlan view, System configuration view

[Usage Scenario] In the default configuration, Router Advertisement (RA) messages do not automatically include address prefixes; you need to specify them manually. When a host receives an RA message that carries prefix information, it will update its local prefix information accordingly..

[Use Cases]

sonic# configure terminal
sonic(config)# vlan 100
sonic(config-vlan-100)# nd ra prefix fd00:100::/64

[Command]
nd ra route-information A::B/mask [preference {low|medium|high}]
no nd route-information A::B/mask

[Purpose]
Set the routing option information in RA packet

[Parameter]

ParameterDescription
A::B/maskThe format is X:X:X:X:X:X:X:X/x

[View]
Vlan view, System configuration view

[Usage Scenario] The RA packet contains routing option information, through which the device will publish specific routing information to the hosts of this segment. By default, the routing priority is medium.

[Use Cases]

sonic# configure terminal
sonic(config)# vlan 100
sonic(config-vlan-100)# nd ra route-information fd00:100::/64
sonic(config-vlan-100)# nd ra route-information ::/0 preference high

[Command]
nd rate-limit value

[Purpose]
Configure the device’s speed limit policy for IPv6 NDP interaction packet, by default, the speed limit rate is 2000pps

[Parameter]

ParameterDescription
valueValue range: 100-1000, precision: 100, unit: pps

[View]
System configuration view

[Use Cases]

sonic(config)# nd rate-limit 1000

[Command]
nd ipv6 mac-check enable
no nd ipv6 mac-check enable

[Purpose]
Enable detection of the legitimacy of ND interaction packet

[View]
System configuration view

[Usage Scenario] Detect whether the link-layer address and SMAC of the NDP interaction packet are the same, and if they are different, they are regarded as illegal packet.

[Use Cases]

sonic(config)# nd ipv6 mac-check enable