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
----------- -------- ------------------- ------------ -------------- -------------
Ethernet1 192.168.2.217/24 up/up N/A N/A
Ethernet4 100.1.1.1/24 up/up N/A N/A
loopback0 10.1.0.1/32 up/up N/A N/A
docker0 240.127.1.1/24 up/down N/A N/A
lo 127.0.0.1/16 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]

A.B.C.D/M IP 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]

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 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
----------- ----------------- --------- ------
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

[Command]

clear neighbor all

[Purpose]

Clear ARP, NDP table entries

[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]

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 terminal
sonic(config)# arp static 3.3.3.3 00:00:00:00:00:01 interface vlan 5
sonic(config)# arp static 4.4.4.4 00:00:00:00:00:02 interface ethernet 1
sonic(config)# arp static 5.5.5.5 00:00:00:00:00:03 interface link-aggregation 1

[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 terminal
sonic(config)# arp timeout 500

[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 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 terminal
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test_v4)#

[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 terminal
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test_v4)# down_link interface vlan 10
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 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

[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

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 100
sonic(config-vlanif-100)# dhcp option encapsulation remote-id clientUser

[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 terminal
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test_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
+===========+===============+===============+================+=================
| 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 |
+-----------------------+-------------------+-----------+-----------------+

[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 ip-address mask

[Purpose]

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

[Parameter]

ParameterDescription
ip-addressSupports configuration of IPv4 and IPv6 addresses in the format of A.B.C.D/A::B
MaskIPv4 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 terminal
sonic(config)# dhcp pool test
sonic(config-dhcp-pool-test)# network 192.168.0.0 255.255.0.0

[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 terminal
sonic(config)# dhcp pool test
sonic(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 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]

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 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]

A.B.C.D IP 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]

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 1
sonic(config-dhcp-pool-1)# option43 hex 8007000001ac100102

[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 1
sonic(config-dhcp-pool-1)# bootfile-name test.json

[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 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]

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 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 ID option 93 hex VALUE

if-match rule ID option 82 remote-id VALUE

[Purpose]

Configuring matching rules for DHCP user classes

[Parameter]

ParameterDescription
IDRule ID, the range of values from 1 to 16. A smaller number indicates a higher priority
VALUESpecifies 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 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]

ID The 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]

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 test
sonic (config-dhcp-pool-test)# class pc option-group 1
sonic (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 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]

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 terminal
sonic(config)# dhcp pool test
sonic(config-dhcp-pool-test)# failover test

[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 ceshi
sonic(config-dhcp-failover-ceshi)# address Loopback0

[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 ceshi
sonic(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 ceshi
sonic(config-dhcp-failover-ceshi)# role primary

[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 ceshi
sonic(config-dhcp-failover-ceshi)# max-response-delay 30

[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 ceshi
sonic(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 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 Admin/Oper
--------- -------- ------------------- ------------
vlan43 FD00:43::1/112 up/up

[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 ndp
Address MacAddress Iface Vlan Status
---------------------- ----------------- ---------- ------ ---------
2022::9300 18:17:25:37:65:08 Ethernet5 - REACHABLE
2022::9310 18:17:25:37:67:22 Ethernet4 - REACHABLE
fd00:400::ae2b 94:e6:f7:25:3b:3b Ethernet11 400 REACHABLE

[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 terminal
sonic(config)# vlan 100
sonic(config-vlanif-100)# ip address fd00::1000/64

[Command]

show nat config

[Purpose]

Display NAT configuration information

[View]

System view

[Use Cases]

sonic# show nat config
Global Values
Admin Mode : disabled
Global Timeout : 600 secs
TCP Timeout : 86400 secs
UDP Timeout : 300 secs
Static Entries
Nat Type IP Protocol Global IP Global Port Local IP Local Port Twice-NAT Id
---------- ------------- ----------- ------------- ---------- ------------ ---------------
Pool Entries
Pool Name Global IP Range Global Port Range
----------- ----------------- -------------------
NAT Bindings
Binding Name Pool Name Access-List Nat Type Twice-NAT Id
-------------- ----------- ------------- ---------- --------------
NAT Zones
Port Zone
--------- ------
Ethernet8 0
Loopback0 0
Vlan4000 0

[Command]

show nat translations

[Purpose]

Display NAT translations information

[View]

System view

[Use Cases]

sonic# show nat translations
Static NAT Entries ..................... 2
Static NAPT Entries ..................... 0
Dynamic NAT Entries ..................... 0
Dynamic NAPT Entries ..................... 0
Static Twice NAT Entries ..................... 0
Static Twice NAPT Entries ..................... 0
Dynamic Twice NAT Entries ..................... 0
Dynamic Twice NAPT Entries ..................... 0
Total SNAT/SNAPT Entries ..................... 1
Total DNAT/DNAPT Entries ..................... 1
Total Entries ..................... 2
Protocol Source Destination Translated Source Translated Destination
---------- -------- ------------- ------------------- ------------------------
all --- 192.168.1.1 --- 1.1.1.1
all 1.1.1.1 --- 192.168.1.1 ---

[Command]

show nat translations_count

[Purpose]

Display NAT translations counts

[View]

System view

[Use Cases]

sonic# show nat translations_count
Static NAT Entries ..................... 2
Static NAPT Entries ..................... 0
Dynamic NAT Entries ..................... 0
Dynamic NAPT Entries ..................... 0
Static Twice NAT Entries ..................... 0
Static Twice NAPT Entries ..................... 0
Dynamic Twice NAT Entries ..................... 0
Dynamic Twice NAPT Entries ..................... 0
Total SNAT/SNAPT Entries ..................... 1
Total DNAT/DNAPT Entries ..................... 1
Total Entries ..................... 2

[Command]

show nat statistics

[Purpose]

Display nat hit statistics

[View]

System configuration view

[Use Cases]

sonic# show nat statistics
Protocol Source Destination Packets Bytes
---------- -------- ------------- --------- -------
all --- 192.168.1.1 0 0
all 1.1.1.1 --- 0 0

[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

[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

[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

[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 terminal
sonic(config)# interface dialer 1

[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 terminal
sonic(config)# interface dialer 1
sonic(config-dialerif-1)# ppp chap username test1 1234

[Command]

mtu MTU

[Purpose]

Configure MTU value

[Parameter]

mtu range of configuration:1312~10218

[View]

Dial up interface view

[Use Cases]

sonic# configure terminal
sonic(config)# interface dialer 1
sonic(config-dialerif-1)# mtu 9216

[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 terminal
sonic(config)# interface dialer 1
sonic(config-dialerif-1)# tcp-mss-clamp 1500

[Command]

nat-zone id

[Purpose]

Configure nat zone

[Parameter]

id range of configuration:0~3

[View]

Dial up interface view

[Use Cases]

sonic# configure terminal
sonic(config)# interface dialer 1
sonic(config-dialerif-1)# nat-zone 1

[Command]

pppoe-client id

[Purpose]

Port binding pppoe client configuration

[Parameter]

id range of configuration:0~7

[View]

Interface view

[Use Cases]

sonic# configure terminal
sonic(config)# interface ethernet 1
sonic(config-if-1)# pppoe-client 1