DELL Networking SONiC:如何在第 3 層介面中設定 IPv4 位址和最大傳輸單元

Summary: 本文說明如何在 Dell Networking SONiC 中設定 IPv4 位址和最大傳輸單元 (MTU) 介面。本文使用執行 Dell SONiC 4.1 的交換器。

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

 
先決條件
我們使用標準介面命名來演示概念。請參閱 Dell 文章202172 Dell Networking S 系列:基本介面組態 - SONiC 4.0 ,以取得有關介面命名的詳細資訊


索引

指派 IP 位址。

MTU
 

指派 IP 位址。

組態語法
命令 說明
admin@DELLSONiC:~$ sonic-cli
進入 Dell 管理命令行介面
DELLSONiC# configure terminal
進入組態模式
DELLSONiC(config)# interface <Eth slot/port><Vlan ID><PortChannel ID><Eth slot/port.subport><Loopback ID>
設定介面、VLAN、連接埠通道、子介面、迴路。
DELLSONiC(conf-if-XXXX)# ip address A.B.C.D/mask
設定遮罩 IP 位址。
DELLSONiC(conf-if-XXXX)# no ip address A.B.C.D/mask
移除 IP 位址。
DELLSONiC(conf-if-XXXX)# no shutdown
如果介面已關閉,請取消關閉介面。

顯示命令以驗證 IP 位址。
命令 說明
admin@DELLSONiC:~$ sonic-cli
進入 Dell 管理命令行介面
DELLSONiC# configure terminal
進入組態模式
DELLSONiC# show ip interfaces
顯示在介面中設定的IP。
DELLSONiC# show running-configuration interface <Eth slot/port><Vlan ID><PortChannel ID><Loopback ID> 
顯示介面組態
 
讓我們在介面 Eth 1/1 上配置一個 IP 位址,IP 位址為 10.0.0.1/24。
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# interface Eth 1/1
DELLSONiC(config-if-Eth1/1)# ip address 10.0.0.1/24
DELLSONiC(config-if-Eth1/1)# end
DELLSONiC#

讓我們來驗證組態
DELLSONiC# show ip interfaces
Flags: U-Unnumbered interface, A-Anycast IP
-----------------------------------------------------------------------------------------------------------------
Interface            IP address/mask                              VRF                 Admin/Oper     Flags
-----------------------------------------------------------------------------------------------------------------
Eth1/1               10.0.0.1/24                                                      up/up
DELLSONiC# show running-configuration interface Eth 1/1
!
interface Eth1/1
 mtu 9100
 no shutdown
 ip address 10.0.0.1/24
DELLSONiC#

 

我們會將 VLAN 1 上的 IP 位址配置為 IP 位址 10.0.0.1/24。
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# interface Vlan 1
DELLSONiC(config-if-Vlan1)# ip address 10.0.0.1/24
DELLSONiC(config-if-Vlan1)# end
DELLSONiC#

讓我們來驗證組態
DELLSONiC# show ip interfaces
Flags: U-Unnumbered interface, A-Anycast IP
-----------------------------------------------------------------------------------------------------------------
Interface            IP address/mask                              VRF                 Admin/Oper     Flags
-----------------------------------------------------------------------------------------------------------------
Vlan1                10.0.0.1/24                                                      up/up
DELLSONiC# show running-configuration interface Vlan 1
!
interface Vlan1
 ip address 10.0.0.1/24
 
讓我們將連接埠通道 1 上的 IP 位址配置為 IP 位址 10.0.0.1/24。
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# interface PortChannel 1
DELLSONiC(config-if-po1)# ip address 10.0.0.1/24
DELLSONiC(config-if-po1)# end

讓我們來驗證組態
DELLSONiC# show ip interfaces
Flags: U-Unnumbered interface, A-Anycast IP
-----------------------------------------------------------------------------------------------------------------
Interface            IP address/mask                              VRF                 Admin/Oper     Flags
-----------------------------------------------------------------------------------------------------------------
PortChannel1         10.0.0.1/24                                                      up/up
DELLSONiC# show running-configuration interface PortChannel 1
!
interface PortChannel1
 no shutdown
 ip address 10.0.0.1/24
DELLSONiC#

 

讓我們將環回 1 上的 IP 位址配置為 IP 位址 10.0.0.1/32。
 
注意:回送僅支援 /32 首碼長度或子網。
 
 
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# interface Loopback 1
DELLSONiC(config-if-lo1)# ip address 10.0.0.1/32
DELLSONiC(config-if-lo1)# end
DELLSONiC#

讓我們來驗證組態
DELLSONiC# show ip interfaces
Flags: U-Unnumbered interface, A-Anycast IP
-----------------------------------------------------------------------------------------------------------------
Interface            IP address/mask                              VRF                 Admin/Oper     Flags
-----------------------------------------------------------------------------------------------------------------
Loopback1            10.0.0.1/32                                                      up/up
DELLSONiC# show running-configuration interface Loopback 1
!
interface Loopback 1
 ip address 10.0.0.1/32
DELLSONiC#
 

指派任一傳播 IP 位址

請參閱文章 Dell Networking SONiC 如何設定靜態任播閘道 (任播位址),以瞭解如何設定任一傳送位址。 

 

MTU

組態語法
命令 說明
admin@DELLSONiC:~$ sonic-cli
進入 Dell 管理命令行介面
DELLSONiC# configure terminal
進入組態模式
DELLSONiC(config)# interface <Eth slot/port><Vlan ID><PortChannel ID><Eth slot/port.subport>
設定介面、VLAN、連接埠通道、子介面。
DELLSONiC(conf-if-XXXX)# mtu <MTU>
設定 MTU:變更 MTU (1312 至 9216)。預設值:9100
DELLSONiC(conf-if-XXXX)# no mtu
在介面中設定預設 MTU (預設為 9100)。

顯示用於驗證 MTU 的命令。
命令 說明
admin@DELLSONiC:~$ sonic-cli
進入 Dell 管理命令行介面
DELLSONiC# configure terminal
進入組態模式
DELLSONiC# show interface <Eth slot/port><Vlan ID><PortChannel ID>
顯示介面詳細資料。
DELLSONiC# show running-configuration interface <Eth slot/port><Vlan ID><PortChannel ID>
顯示介面組態
DELLSONiC#show interface status
顯示介面狀態

 

  • MTU 組態注意事項

    • 請先在 VLAN 成員上設定 MTU,再設定 VLAN MTU。VLAN 的所有成員都必須具有相同的 MTU 值。標記成員的連結 MTU 必須比未標記成員高 4 位元組才能用於數據包標記。
    • 在配置埠通道 MTU 之前,請先在埠通道成員上配置 MTU。埠通道的所有成員必須具有相同的 MTU 值。標記成員的連結 MTU 必須比未標記成員高 4 位元組才能用於數據包標記。
    • 確保埠通道成員的 MTU 大於或等於埠通道 MTU。如果在配置埠通道 MTU 後在埠通道成員上配置 MTU,則埠通道 MTU 可能無法更新。系統選擇在埠通道或埠通道成員上配置的最低 MTU 值作為埠通道 MTU。例如,埠通道包含鏈路 MTU 為 1522、IP MTU 為 1500 的已標記成員,以及鏈路 MTU 為 1518、IP MTU 為 1500 的未標記成員。連接埠通道的連結 MTU 不能高於 1518 位元組,其 IP MTU 也不能高於 1500 位元組。
讓我們在介面 Eth 1/1 中配置 MTU
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# interface Eth 1/1
DELLSONiC(config-if-Eth1/1)# mtu 1500
DELLSONiC(config-if-Eth1/1)# end

讓我們驗證一下組態 (為簡潔起見,輸出已變更)。
DELLSONiC# show interface status
--------------------------------------------------------------------------------------------------------------------------------------
Name                Description                   Oper           Reason         AutoNeg   Speed          MTU            Alternate Name
--------------------------------------------------------------------------------------------------------------------------------------
Eth1/1              -                             up             oper-up        off       25000          1500           Ethernet0
DELLSONiC# show running-configuration interface Eth 1/1
!
interface Eth1/1
 mtu 1500
 no shutdown
DELLSONiC# show interface Eth 1/1

Eth1/1 is up, line protocol is up, reason oper-up
Hardware is Eth, address is xx:xx:xx:xx:xx:xx
Mode of IPV4 address assignment: not-set
Mode of IPV6 address assignment: not-set
Interface IPv6 oper status: Disabled
IP MTU 1500 bytes
LineSpeed 25GB, Auto-negotiation off
Link-training: off

 

我們會在 VLAN 介面中設定 MTU
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# interface Vlan 1
DELLSONiC(config-if-Vlan1)# mtu 1500
DELLSONiC(config-if-Vlan1)# end
DELLSONiC#

讓我們驗證一下組態 (為簡潔起見,輸出已變更)。
DELLSONiC# show interface Vlan 1

Vlan1 is up, line protocol is up
Hardware is Vlan, address is xx:xx:xx:xx:xx:xx
Mode of IPV4 address assignment: not-set
Mode of IPV6 address assignment: not-set
Interface IPv6 oper status: Disabled
IP MTU 1500 bytes
Time since last interface status change: 02:33:17
DELLSONiC# show running-configuration interface Vlan 1
!
interface Vlan1
 mtu 1500

 

我們會使用 MTU 1500 配置連接埠通道 1
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# interface PortChannel 1
DELLSONiC(config-if-po1)# mtu 1500
DELLSONiC(config-if-po1)# end
DELLSONiC#

讓我們驗證一下組態 (為簡潔起見,輸出已變更)。
DELLSONiC# show running-configuration interface PortChannel 1
!
interface PortChannel1 mode on
 mtu 1500
 no shutdown
DELLSONiC# show interface status
--------------------------------------------------------------------------------------------------------------------------------------
Name                Description                   Oper           Reason         AutoNeg   Speed          MTU            Alternate Name
--------------------------------------------------------------------------------------------------------------------------------------
Eth1/1              -                             up             oper-up        off       25000          1500           Ethernet0
Eth1/2              -                             up             oper-up        off       25000          1500           Ethernet1


PortChannel1        -                             up             oper-up        -         25000          1500           -
DELLSONiC# show interface PortChannel 1
PortChannel1 is up, line protocol is up, reason oper-up, mode Static
Hardware is PortChannel, address is xx:xx:xx:xx:xx:xx
Minimum number of links to bring PortChannel up is 1
Mode of IPV4 address assignment: not-set
Mode of IPV6 address assignment: not-set
Graceful shutdown: Disabled
MTU 1500
LineSpeed 25.0GB
Events:

Affected Products

Enterprise SONiC Distribution, PowerSwitch E3200-ON Series, Dell EMC Networking N3200-ON, PowerSwitch S5212F-ON, PowerSwitch S5224F-ON, PowerSwitch S5232F-ON, PowerSwitch S5248F-ON, PowerSwitch S5296F-ON, PowerSwitch Z9264F-ON, PowerSwitch Z9332F-ON , PowerSwitch Z9432F-ON ...
Article Properties
Article Number: 000218581
Article Type: How To
Last Modified: 10 Apr 2024
Version:  5
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.