当前位置:首页>Linux>Linux 网络配置TRUNK模式网卡

Linux 网络配置TRUNK模式网卡

  • 2026-09-10 23:27:33
Linux 网络配置TRUNK模式网卡

确认需要配置的网卡名称;

#nmcli show dev    

enp23s0f0

enp65s0f0

加载

#modprobe 8021q

在交换机端对应主机所连接的端口,模式改成 trunk, 创建相应的VLAN ID, 本次创建VLAN10,  VLAN20; 

# 创建 VLAN 10 接口

nmcli con add type vlan con-name vlan10 dev enp23s0f0 id 10 ip4 172.19.10.20/24

# 创建 VLAN 20 接口

nmcli con add type vlan con-name vlan20 dev eth0 id 20 ip4 192.168.20.100/24

# 启用连接

nmcli con up vlan10

nmcli con up vlan20

# 查看配置

nmcli con show

最新文章

随机文章