IP Service
IPv4 Configuration
Section titled “IPv4 Configuration”show ip interface
Section titled “show ip interface”[Command]
show ip interfaces
[Purpose]
Display the IP address configured for the interface
[View]
System view
[Use Cases]
sonic# show ip interfacesInterface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP----------- -------- ------------------- ------------ -------------- -------------Ethernet1 192.168.2.217/24 up/up N/A N/AEthernet4 100.1.1.1/24 up/up N/A N/Aloopback0 10.1.0.1/32 up/up N/A N/Adocker0 240.127.1.1/24 up/down N/A N/Alo 127.0.0.1/16 up/up N/A N/A
ip address A.B.C.D/M
Section titled “ip address A.B.C.D/M”[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]
A.B.C.D/M IP address with prefix length
[View]
Interface view
[Use Cases]
sonic# configure terminalsonic(config)# interface ethernet 2sonic(config-if-2)# ip address 3.3.3.6/24sonic(config-if-2)# show this!interface ethernet 2ip address 3.3.3.6/24
ip address dhcp-alloc
Section titled “ip address dhcp-alloc”[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 terminalsonic(config)# interface vlan 10sonic(config-vlanif-10)# ip address dhcp-alloc
mac_address HH:HH:HH:HH:HH:HH
Section titled “mac_address HH:HH:HH:HH:HH:HH”[Command]
mac_address HH:HH:HH:HH:HH:HH
no mac-address
[Purpose]
Configure MAC addresses for layer 3 ports
[Parameter]
HH:HH:HH:HH:HH:HH MAC 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 terminalsonic(config)# interface ethernet 2sonic(config-if-2)# mac-address 00:00:00:37:67:afsonic(config-if-2)# show this!interface ethernet 2mac-address 00:00:00:37:67:af
ARP Configuration
Section titled “ARP Configuration”show arp
Section titled “show arp”[Command]
show arp
[Purpose]
Show IP ARP table
[View]
System view
[Use Cases]
sonic# show arpAddress MacAddress Iface Vlan----------- ----------------- --------- ------100.1.1.2 60:eb:5a:01:6c:99 Ethernet4 -192.168.2.1 60:eb:5a:01:10:ca Ethernet1 -Total number of entries 2
clear neighbor
Section titled “clear neighbor”[Command]
clear neighbor all
[Purpose]
Clear ARP, NDP table entries
[View]
System view
[Use Cases]
sonic# clear neighbor all
arp static
Section titled “arp static”[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]
A.B.C.D IP address
HH:HH:HH:HH:HH:HH MAC address
interface-type Interface type, optional ethernet, vlan, link-aggregation
interface-name Interface name
[View]
System configuration view
[Use Cases]
sonic# configure terminalsonic(config)# arp static 3.3.3.3 00:00:00:00:00:01 interface vlan 5sonic(config)# arp static 4.4.4.4 00:00:00:00:00:02 interface ethernet 1sonic(config)# arp static 5.5.5.5 00:00:00:00:00:03 interface link-aggregation 1
arp timeout expire-time
Section titled “arp timeout expire-time”[Command]
arp timeout expire-time
[Purpose]
Configure ARP table entry aging time
[Parameter]
expire-time Time value, range 60-7200, unit s
[View]
System configuration view
[Use Cases]
sonic# configure terminalsonic(config)# arp timeout 500
DHCP Relay Configuration
Section titled “DHCP Relay Configuration”show dhcp relay config
Section titled “show dhcp relay config”[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 |+-----------+-----------+-------------------+-----------+---------------------+
dhcp-relay relay-name {v4|v6}
Section titled “dhcp-relay relay-name {v4|v6}”[Command]
dhcp-relay relay-name {v4|v6}
no dhcp-relay relay-name {v4|v6}
[Purpose]
Configuring DHCP relay instance
[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 terminalsonic(config)# dhcp-relay test v4sonic(config-dhcp-relay-test_v4)#
down_link interface vlan vlan-id
Section titled “down_link interface vlan vlan-id”[Command]
dhcp_link interface vlan vlan-id
no dhcp_link interface vlan vlan-id
[Purpose]
Specify the interface ID of the connected terminal in the relay instance
[Parameter]
vlan-id VLAN 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 terminalsonic(config)# dhcp-relay test v4sonic(config-dhcp-relay-test_v4)# down_link interface vlan 10
up_link interface interface-type interface-name
Section titled “up_link interface interface-type interface-name”[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]
interface-type Supported configurations:ethernet,link-aggregation,VLAN
[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 terminalsonic(config)# dhcp-relay test v4sonic(config-dhcp-relay-test_v4)# up_link interface ethernet 1
server_ip {A.B.C.D|A:B:C:D:E:F:G:H}
Section titled “server_ip {A.B.C.D|A:B:C:D:E:F:G:H}”[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
[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 terminalsonic(config)# dhcp-relay test v4sonic(config-dhcp-relay-test_v4)# server_ip 150.1.0.1
loopback_interface loopback loopback_id
Section titled “loopback_interface loopback loopback_id”[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 terminalsonic(config)# dhcp-relay test v4sonic(config-dhcp-relay-test_v4)# loopback_interface loopback 0
dhcp-agent address A.B.C.D
Section titled “dhcp-agent address A.B.C.D”[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 terminalsonic(config)# interface vlan 100sonic(config-vlanif-100)# dhcp-agent address 192.168.1.10
no_option82
Section titled “no_option82”[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 terminalsonic(config)# dhcp-relay test v4sonic(config-dhcp-relay-test_v4)# no_option82
dhcp option82 encapsulation remote-id VALUE
Section titled “dhcp option82 encapsulation remote-id VALUE”[Command]
dhcp option82 encapsulation remote-id VALUE
[Purpose]
Configuring the addition of the “remote-id” sub-option in option82
[View]
DHCP-relay 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 100sonic(config-vlanif-100)# dhcp option encapsulation remote-id clientUser
source_ip
Section titled “source_ip”[Command]
source_ip
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 terminalsonic(config)# dhcp-relay test v4sonic(config-dhcp-relay-test_v4)# source_ip 30.102.0.216
DHCP Server Configuration
Section titled “DHCP Server Configuration”show dhcp pool info ip-version {v4|v6}
Section titled “show dhcp pool info ip-version {v4|v6}”[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+===========+===============+===============+================+=================| test | 192.168.200.0 | 255.255.255.0 | 192.168.200.10 | 192.168.200.100+-----------+---------------+---------------+----------------+-----------------+-----------------------+-------------------+-----------+-----------------+| Default Lease Time(s) | Max Lease Time(s) | Bind Info | DNS |+=======================+===================+===========+=================+| 6000 | 12000 | Vlan43 | 114.114.114.114 |+-----------------------+-------------------+-----------+-----------------+
show dhcp pool ip-in-use [A.B.C.D/A::B]
Section titled “show dhcp pool ip-in-use [A.B.C.D/A::B]”[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-useReading leases from /var/lib/dhcp/dhcpd.leasesIP 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:0020.1.1.23 00:00:12:01:01:03 XINERTEL active 2024-02-26 09:27:00 2024-02-26 09:37:0020.1.1.22 00:00:12:01:01:02 XINERTEL active 2024-02-26 09:27:00 2024-02-26 09:37:00total lease :3
show dhcp pool expired [A.B.C.D/A::B]
Section titled “show dhcp pool expired [A.B.C.D/A::B]”[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 expiredReading leases from /var/lib/dhcp/dhcpd.leasesIP 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:3020.1.1.9 00:00:02:01:01:09 -NA- free 2024-02-26 09:09:57 2024-02-26 09:11:30total lease :2
show dhcp class
Section titled “show dhcp class”[Command]
show dhcp class
[Purpose]
Display DHCP class
[View]
System view
[Use Cases]
sonic# show dhcp classdhcp class pcif-match rule 1 option 93 hex 0000dhcp class test1dhcp class x86if-match rule 1 option 93 hex 0001
show dhcp option-group
Section titled “show dhcp option-group”[Command]
show dhcp option-group
[Purpose]
Display dhcp option-group
[View]
System view
[Use Cases]
sonic# show dhcp option-groupdhcp option-group 1bootfile-name ftp://teraspek:teraspek@150.1.0.1/test.txtoption43 hex 8888 forcetftp-server 150.1.0.1dhcp option-group 2bootfile-name ftp://teraspek:teraspek@150.1.0.1/ppap.txtoption43 hex 8888 forcetftp-server 150.1.0.1
show dhcp failover info
Section titled “show dhcp failover info”[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 : ceshiLocal-address : 30.102.0.230Peer-address : 30.102.0.216Role : primaryMax_response_delay : 60Heartbeat_inteval : 20Local-state : normalPeer-state : normalSplit : 50%
dhcp pool
Section titled “dhcp pool”[Command]
dhcp pool name
no dhcp pool name
[Purpose]
Create address pools
[View]
System configuration view
[Use Cases]
sonic# configure terminalsonic(config)# dhcp pool testsonic(config-dhcp-pool-test)#
network ip-address mask
Section titled “network ip-address mask”[Command]
network ip-address mask
[Purpose]
Specify the network segment where the DHCP server assigns the IP address to the Client
[Parameter]
Parameter | Description |
---|---|
ip-address | Supports configuration of IPv4 and IPv6 addresses in the format of A.B.C.D/A::B |
Mask | IPv4 subnet mask in dotted decimal format; IPv6 network prefix in X:X:X:X:X:X:X:X |
[View]
DHCP view
[Notes]
When creating DHCP address pools, it is advisable to prioritize the configuration of this command.
[Use Cases]
sonic# configure terminalsonic(config)# dhcp pool testsonic(config-dhcp-pool-test)# network 192.168.0.0 255.255.0.0
address-pool
Section titled “address-pool”[Command]
address-pool ip-address ip-address
[Purpose]
Specify the range of IP addresses assigned to client by DHCP server
[Parameter]
ip-address Start 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 terminalsonic(config)# dhcp pool testsonic(config-dhcp-pool-test)# address-pool 192.168.1.1 192.168.10.1
[Command]
dns ip-address
[Purpose]
Specify the DNS server address
[Parameter]
ip-address The format is: A.B.C.D/A::B
[View]
DHCP view
[Use Cases]
sonic# configure terminalsonic(config)# dhcp pool testsonic(config-dhcp-pool-test)# dns 8.8.8.8
lease-time
Section titled “lease-time”[Command]
lease-time default-time max-time
[Purpose]
Specify IP address lease time
[Parameter]
default-time Default lease time
max-time Maximum 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 terminalsonic(config)# dhcp pool testsonic(config-dhcp-pool-test)# lease-time 6000 12000
routers
Section titled “routers”[Command]
routers A.B.C.D
[Purpose]
Specify the gateway address assigned to the DHCP client by the DHCP server
[Parameter]
A.B.C.D IP address
[View]
DHCP view
[Use Cases]
sonic# configure terminalsonic(config)# dhcp pool testsonic(config-dhcp-pool-test)# routers 192.168.1.1
option43 hex value
Section titled “option43 hex value”[Command]
option43 hex value
[Purpose]
Enable the option43 function of DHCP Server
[Parameter]
value Hexadecimal 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 1sonic(config-dhcp-pool-1)# option43 hex 8007000001ac100102
bootfile-name bootfile
Section titled “bootfile-name bootfile”[Command]
bootfile-name bootfile
[Purpose]
Configure the boot configuration file name for DHCP clients
[Parameter]
bootfile String 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 1sonic(config-dhcp-pool-1)# bootfile-name test.json
next-server ip-address
Section titled “next-server ip-address”[Command]
next-server ip-address
[Purpose]
Configure the network server IP address to be used by DHCP client during the startup process
[Parameter]
ip-address Specifies 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 1sonic(config-dhcp-pool-1)# next-server 192.168.0.10
tftp-server server-name
Section titled “tftp-server server-name”[Command]
tftp-server server-name
[Purpose]
Configure the TFTP Server Address for DHCP Clients
[Parameter]
server-name A 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 1sonic(config-dhcp-pool-1)# tftp-server 192.168.0.10
dhcp select server
Section titled “dhcp select server”[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 1sonic(config-if-1)# dhcp select server
dhcp class name
Section titled “dhcp class name”[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 test1sonic(config-dhcp-class-test1)#
if-match rule ID
Section titled “if-match rule ID”[Command]
if-match rule ID option 93 hex VALUE
if-match rule ID option 82 remote-id VALUE
[Purpose]
Configuring matching rules for DHCP user classes
[Parameter]
Parameter | Description |
---|---|
ID | Rule ID, the range of values from 1 to 16. A smaller number indicates a higher priority |
VALUE | Specifies the content used to match the specified option in the message, in hexadecimal string format |
[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 test1sonic(config-dhcp-class-test1)# if-match rule 1 option 93 hex 0000
dhcp option-group ID
Section titled “dhcp option-group ID”[Command]
dhcp option-group ID
[Purpose]
Create a DHCP option group and enter the option group view
[Parameter]
ID The range of values from 1 to 65535
[View]
System configuration view
[Use Cases]
sonic(config)# dhcp option-group 1sonic(config-dhcp-option-group-1)# bootfile-name test.txtsonic(config-dhcp-option-group-1)# tftp-server 150.1.0.1
class name option-group ID
Section titled “class name option-group ID”[Command]
class name option-group ID
[Purpose]
Bind user classes to option groups.
[Parameter]
name DHCP class name
ID Option 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 testsonic (config-dhcp-pool-test)# class pc option-group 1sonic (config-dhcp-pool-test)# class x86 option-group 2
class name address-pool ip-address-start ip-address-end
Section titled “class name address-pool ip-address-start ip-address-end”[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]
name DHCP user class name
ip-address Start 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 terminalsonic(config)# dhcp pool testsonic(config-dhcp-pool-test)# class test address-pool 192.168.1.1 192.168.10.1sonic(config-dhcp-pool-test)# class public address-pool 192.168.20.1 192.168.30.1
failover
Section titled “failover”[Command]
failover String
[Purpose]
Configure the DHCP address pool to be bound with a dual-active backup
[Parameter]
String failover 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 terminalsonic(config)# dhcp pool testsonic(config-dhcp-pool-test)# failover test
address
Section titled “address”[Command]
address
[Purpose]
This feature configures the local IP address used for protocol interactions between two DHCP servers in a DHCP failover scenario.
[Parameter]
Loopback0 Loopback0 IP address
A.B.C.D IP address of the local device interface
[View]
DHCP Failover view
[Use Cases]
sonic(config)# dhcp failover ceshisonic(config-dhcp-failover-ceshi)# address Loopback0
peer address
Section titled “peer address”[Command]
peer address
[Purpose]
This feature configures the peer IP address used for protocol interactions between two DHCP servers in a DHCP failover scenario.
[Parameter]
A.B.C.D IP address of the peer device interface
[View]
DHCP Failover view
[Use Cases]
sonic(config)# dhcp failover ceshisonic(config-dhcp-failover-ceshi)# peer address 30.102.0.216
[Command]
role
[Purpose]
Configure the server role during dual-active backup
[Parameter]
primary Primary server
Secondary backup 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 ceshisonic(config-dhcp-failover-ceshi)# role primary
max-response-delay
Section titled “max-response-delay”[Command]
max-response-delay
[Purpose]
Configure the max-response-delay for communication interruption during dual-active backup
[Parameter]
interval Time 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 ceshisonic(config-dhcp-failover-ceshi)# max-response-delay 30
auto-partner-down
Section titled “auto-partner-down”[Command]
auto-partner-down
[Purpose]
Enable the timed delay for dual-active backup
[Parameter]
second Time 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 ceshisonic(config-dhcp-failover-ceshi)# auto-partner-down 60
[Command]
split
[Purpose]
Set the server address allocation weight
[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 ceshisonic(config-dhcp-failover-ceshi)# split 80
IPv6 Configuration
Section titled “IPv6 Configuration”show ipv6 interfaces
Section titled “show ipv6 interfaces”[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 interfacesInterface Master IPv6 address/mask Admin/Oper--------- -------- ------------------- ------------vlan43 FD00:43::1/112 up/up
show ndp
Section titled “show ndp”[Command]
show ndp
show ndp ipv6-address A::B
show ndp ipv6 iface {mgmt|ethernet} interface-name
[Purpose]
View IPv6 neighbor table entry information
[View]
System view
[Use Cases]
sonic# show ndpAddress MacAddress Iface Vlan Status---------------------- ----------------- ---------- ------ ---------2022::9300 18:17:25:37:65:08 Ethernet5 - REACHABLE2022::9310 18:17:25:37:67:22 Ethernet4 - REACHABLEfd00:400::ae2b 94:e6:f7:25:3b:3b Ethernet11 400 REACHABLE
ip address A::B/mask
Section titled “ip address A::B/mask”[Command]
ip address A::B/mask
no ip address A::B/mask
[Purpose]
Specify the IPv6 address of the interface
[Parameter]
A::B/mask Total length is 128 bits in the format x:x::x:x/x
[View]
Interface view
[Use Cases]
sonic# configure terminalsonic(config)# vlan 100sonic(config-vlanif-100)# ip address fd00::1000/64
NAT Configuration
Section titled “NAT Configuration”show nat config
Section titled “show nat config”[Command]
show nat config
[Purpose]
Display NAT configuration information
[View]
System view
[Use Cases]
sonic# show nat configGlobal ValuesAdmin Mode : disabledGlobal Timeout : 600 secsTCP Timeout : 86400 secsUDP Timeout : 300 secsStatic EntriesNat Type IP Protocol Global IP Global Port Local IP Local Port Twice-NAT Id---------- ------------- ----------- ------------- ---------- ------------ ---------------Pool EntriesPool Name Global IP Range Global Port Range----------- ----------------- -------------------NAT BindingsBinding Name Pool Name Access-List Nat Type Twice-NAT Id-------------- ----------- ------------- ---------- --------------NAT ZonesPort Zone--------- ------Ethernet8 0Loopback0 0Vlan4000 0
show nat translations
Section titled “show nat translations”[Command]
show nat translations
[Purpose]
Display NAT translations information
[View]
System view
[Use Cases]
sonic# show nat translationsStatic NAT Entries ..................... 2Static NAPT Entries ..................... 0Dynamic NAT Entries ..................... 0Dynamic NAPT Entries ..................... 0Static Twice NAT Entries ..................... 0Static Twice NAPT Entries ..................... 0Dynamic Twice NAT Entries ..................... 0Dynamic Twice NAPT Entries ..................... 0Total SNAT/SNAPT Entries ..................... 1Total DNAT/DNAPT Entries ..................... 1Total Entries ..................... 2Protocol Source Destination Translated Source Translated Destination---------- -------- ------------- ------------------- ------------------------all --- 192.168.1.1 --- 1.1.1.1all 1.1.1.1 --- 192.168.1.1 ---
show nat translations_count
Section titled “show nat translations_count”[Command]
show nat translations_count
[Purpose]
Display NAT translations counts
[View]
System view
[Use Cases]
sonic# show nat translations_countStatic NAT Entries ..................... 2Static NAPT Entries ..................... 0Dynamic NAT Entries ..................... 0Dynamic NAPT Entries ..................... 0Static Twice NAT Entries ..................... 0Static Twice NAPT Entries ..................... 0Dynamic Twice NAT Entries ..................... 0Dynamic Twice NAPT Entries ..................... 0Total SNAT/SNAPT Entries ..................... 1Total DNAT/DNAPT Entries ..................... 1Total Entries ..................... 2
show nat statistics
Section titled “show nat statistics”[Command]
show nat statistics
[Purpose]
Display nat hit statistics
[View]
System configuration view
[Use Cases]
sonic# show nat statisticsProtocol Source Destination Packets Bytes---------- -------- ------------- --------- -------all --- 192.168.1.1 0 0all 1.1.1.1 --- 0 0
nat-zone 0-3
Section titled “nat-zone 0-3”[Command]
nat-zone 0-3
[Purpose]
Configure nat-zone
[Parameter]
nat-zone Interface domain. The default value is 0. When a non-zero value is configured, the NAT conversion function is enabled.
[View]
Interface view
[Use Cases]
sonic(config-if-8)# nat-zone 1
nat enable
Section titled “nat enable”[Command]
nat enable
no nat enable
[Purpose]
Enable nat function
[Parameter]
System configuration view
[Use Cases]
sonic(config)# nat enable
nat static basic global_ip local_ip {snat|dnat} tcp|udp|icmp|all [extendable|normal] [comment]
Section titled “nat static basic global_ip local_ip {snat|dnat} tcp|udp|icmp|all [extendable|normal] [comment]”[Command]
nat static basic global_ip local_ip {snat|dnat} tcp|udp|icmp|all [extendable|normal] [comment]
no nat static basic global_ip local_ip tcp|udp|icmp|all
[Purpose]
Configure static nat function
[Parameter]
global_ip global ip
local_ip local ip
snat For this session, the private network side needs to initiate the establishment first
dnat For this session, the public network side needs to initiate the establishment first
tcp|udp|icmp|all Configure corresponding conversions for different protocol types
extendable Support reusing private network port numbers
normal Normal configuration without involving port number reuse
comment Add a note (up to 63 characters) for the configured NAT session
[View]
System configuration view
[Use Cases]
sonic(config)# nat static basic 1.1.1.1 192.168.1.1 snat tcp test1
nat static {tcp|udp} global_ip global_port local_ip local_port {snat|dnat} [extendable|normal] [comment]
Section titled “nat static {tcp|udp} global_ip global_port local_ip local_port {snat|dnat} [extendable|normal] [comment]”[Command]
nat static {tcp|udp} global_ip global_port local_ip local_port {snat|dnat} [extendable|normal] [comment]
no nat static {tcp|udp} global_ip global_port local_ip local_port
[Purpose]
Configure static napt function
[Parameter]
global_ip global ip
global_port global port
local_ip local ip
local_port local port
snat For this session, the private network side needs to initiate the establishment first
dnat For this session, the public network side needs to initiate the establishment first
extendable Support reusing private network port numbers
normal Normal configuration without involving port number reuse
comment Add a note (up to 63 characters) for the configured NAT session
[View]
System configuration view
[Use Cases]
sonic(config)# nat static tcp 1.1.1.1 2000 192.168.1.1 3000 snat test1
nat pool {pool_name} start_ip [end_ip]
Section titled “nat pool {pool_name} start_ip [end_ip]”[Command]
nat pool {pool_name} start_ip [end_ip]
no nat pool {pool_name}
[Purpose]
Configure dynamic address pool
[Parameter]
pool_name address pool name
start_ip start ip of address pool
end_ip end ip of address pool
[View]
System configuration view
[Use Cases]
sonic(config)# nat pool test 1.1.1.1 1.1.1.2
nat binding {binding_name} {pool_name} [acl_name]
Section titled “nat binding {binding_name} {pool_name} [acl_name]”[Command]
nat binding {binding_name} {pool_name} [acl_name]
no nat binding {binding_name} [acl_name]
[Purpose]
Bind dynamic address pool
[Parameter]
binding_name bind name
pool_name dynamic address pool name
acl_name acl table name
[View]
System configuration view
[Use Cases]
sonic(config)# nat binding bing1 test acl1
PPPoE Configuration
Section titled “PPPoE Configuration”interface dialer dialer id
Section titled “interface dialer dialer id”[Command]
interface dialer dialer id
[Purpose]
Configure dial-up interface ID
[Parameter]
dialer id id range:0~7
[View]
System view
[Use Cases]
sonic# configure terminalsonic(config)# interface dialer 1
ppp chap username username password
Section titled “ppp chap username username password”[Command]
ppp chap username username password
[Purpose]
Configure PPP authentication username and password
[Parameter]
username username
password password
[View]
Dial up interface view
[Use Cases]
sonic# configure terminalsonic(config)# interface dialer 1sonic(config-dialerif-1)# ppp chap username test1 1234
mtu MTU
Section titled “mtu MTU”[Command]
mtu MTU
[Purpose]
Configure MTU value
[Parameter]
mtu range of configuration:1312~10218
[View]
Dial up interface view
[Use Cases]
sonic# configure terminalsonic(config)# interface dialer 1sonic(config-dialerif-1)# mtu 9216
tcp-mss-clamp Value
Section titled “tcp-mss-clamp Value”[Command]
tcp-mss-clamp Value
[Purpose]
Configure tcp-mss-clamp value
[Parameter]
tcp-mss-clamp range of configuration:536~10178
[View]
Dial up interface view
[Use Cases]
sonic# configure terminalsonic(config)# interface dialer 1sonic(config-dialerif-1)# tcp-mss-clamp 1500
nat-zone id
Section titled “nat-zone id”[Command]
nat-zone id
[Purpose]
Configure nat zone
[Parameter]
id range of configuration:0~3
[View]
Dial up interface view
[Use Cases]
sonic# configure terminalsonic(config)# interface dialer 1sonic(config-dialerif-1)# nat-zone 1
pppoe-client id
Section titled “pppoe-client id”[Command]
pppoe-client id
[Purpose]
Port binding pppoe client configuration
[Parameter]
id range of configuration:0~7
[View]
Interface view
[Use Cases]
sonic# configure terminalsonic(config)# interface ethernet 1sonic(config-if-1)# pppoe-client 1