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
|
前提条件
我们使用标准接口命名来演示概念。请参阅戴尔文章202172 Dell Networking S 系列:基本接口配置 - SONiC 4.0 ,了解有关接口命名的更多信息 |
索引
分配 IP 地址。
配置语法
| 命令 | 说明 |
|---|---|
admin@DELLSONiC:~$ sonic-cli |
进入戴尔管理命令行界面 |
DELLSONiC# configure terminal |
进入配置模式 |
DELLSONiC(config)# interface <Eth slot/port><Vlan ID><PortChannel ID><Eth slot/port.subport><Loopback ID> |
配置接口、VLAN、PortChannel、子接口、环回。 |
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 |
进入戴尔管理命令行界面 |
DELLSONiC# configure terminal |
进入配置模式 |
DELLSONiC# show ip interfaces |
显示接口中配置的 IP。 |
DELLSONiC# show running-configuration interface <Eth slot/port><Vlan ID><PortChannel ID><Loopback ID> |
显示接口配置 |
让我们在接口以太网 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# |
让我们使用 IP 地址 10.0.0.1/24 配置 VLAN 1 上的 IP 地址。
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 |
让我们使用 IP 地址 10.0.0.1/24 配置 PortChannel 1 上的 IP 地址。
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# |
让我们使用 IP 地址 10.0.0.1/32 配置环回 1 上的 IP 地址。
提醒:环回仅支持 /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 |
进入戴尔管理命令行界面 |
DELLSONiC# configure terminal |
进入配置模式 |
DELLSONiC(config)# interface <Eth slot/port><Vlan ID><PortChannel ID><Eth slot/port.subport> |
配置接口、VLAN、PortChannel、子接口。 |
DELLSONiC(conf-if-XXXX)# mtu <MTU> |
配置 MTU更改 MTU(1312 至 9216)。默认值:9100 |
DELLSONiC(conf-if-XXXX)# no mtu |
在界面中配置默认 MTU(默认值为 9100)。 |
用于验证 MTU 的 Show 命令。
| 命令 | 说明 |
|---|---|
admin@DELLSONiC:~$ sonic-cli |
进入戴尔管理命令行界面 |
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 字节。
让我们在接口以太网 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 |
我们为 PortChannel 1 配置 MTU 1500。
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.