2024年4月18日发(作者:)
Centos7配置vlan及bond4
*基于鲲鹏服务器2(Centos7)和H3C核心交换机(S7503E),双线bond mode=4,lacp动态协商;透传多
vlan,实现一台设备支持多个ip网段。
连接拓扑
交换机配置
ip配置
[ZYH-HXSW]int vlan 500
interface Vlan-interface500
description to-新增服务器
ip address 10.255.50.254 255.255.255.0
#
[ZYH-HXSW-Vlan-interface500]int vlan 600
interface Vlan-interface600
description to-旧办公室服务器
ip address 10.255.60.254 255.255.255.0
#
[ZYH-HXSW-Vlan-interface600]int vlan 700
interface Vlan-interface700
description to-托管服务器
ip address 10.255.70.254 255.255.255.0
#
链路聚合配置:
交换机连接 服务器端口为G1/0/23、G1/0/24
*配置为动态聚合lacp
interface Bridge-Aggregation23
description kunpeng2-1/0/23&24
port link-type trunk
port trunk permit vlan 1 500 600 700
port trunk pvid vlan 500
link-aggregation mode dynamic
#
interface GigabitEthernet1/0/23
port link-mode bridge
description to-huawei-kunpeng-server-enp125s0f2
port link-type trunk
port trunk permit vlan 1 500 600 700
port trunk pvid vlan 500
stp edged-port
port link-aggregation group 23
#
interface GigabitEthernet1/0/24
port link-mode bridge
description to-huawei-kunpeng-server-enp125s0f3
port link-type trunk
port trunk permit vlan 1 500 600 700
port trunk pvid vlan 500
stp edged-port
port link-aggregation group 23
鲲鹏服务器配置
bond配置
网口连接使用enp125s0f2、enp125s0f3网口。
注:bond网口,ip配置非必须
注意:BONDING_OPTS="mode=4 miimon=100",“mode=4 miimon=100”应小写,不要大写
[root@kunpeng-2 network-scripts]# cat ifcfg-bond0
DEVICE=bond0
TYPE=Bond
BONDING MASTER=yes
BOOTPROTO=none
USERCTL=no
ONBOOT=yes
BONDING_OPTS="mode=4 miimon=100"
#BRIDGE=virbr1
IPADDR=10.255.50.17
NETMASK=255.255.255.0
GATEWAY=10.255.50.254
#
bond网卡接口1
注:NAME=bond0.1用于bond0使用物理网卡命名,可用nmcli con sh查看
[root@kunpeng-2 network-scripts]# cat ifcfg-enp125s0f2
DEVICE=enp125s0f2
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
NAME=bond0.1
ONBOOT=yes
#
bond网卡接口2
[root@kunpeng-2 network-scripts]# cat ifcfg-enp125s0f3
DEVICE=enp125s0f3
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
NAME=bond0.2
ONBOOT=yes
#
vlan配置
vlan600
注意:配置文件名称必须为:,设备DEVICE=,否则不生效。
[root@kunpeng-2 network-scripts]# cat ifcfg-bond0.600
DEVICE=bond0.600
VLAN=yes
BOOTPROTO=none
#USERCTL=no
ONBOOT=yes
#BRIDGE=virbr600
IPADDR=10.255.60.10
NETMASK=255.255.255.0
#GATEWAY=10.255.60.254
#
vlan700
[root@kunpeng-2 network-scripts]# cat ifcfg-bond0.700
DEVICE=bond0.700
VLAN=yes
BOOTPROTO=none
#USERCTL=no
ONBOOT=yes
#BRIDGE=virbr600
IPADDR=10.255.70.10
NETMASK=255.255.255.0
GATEWAY=10.255.70.254
DNS1=114.114.114.114
注意:同一操作系统不应有多个默认路由,即多个网卡配置中只能其中一个配置内写GATEWAY,其他应
采用静态中心的形式,否则不能正常访问。
发布评论