标签:交换机配置 文件 复制 gate dev config roo VID ref
1:首先yum install vconfig安装vconfig[root@localhost ~]#cp /etc/sysconfig/network-scripts/ifcfg-em2 etc/sysconfig/network-scripts/ifcfg-em2.10
[root@localhost ~]#cp /etc/sysconfig/network-scripts/ifcfg-em2 /etc/sysconfig/network-scripts/ifcfg-em2.20
3:(1)编辑[root@localhost ~]#vi etc/sysconfig/network-scripts/ifcfg-em2.10
TYPE=Vlan
VLAN=yes
VLAN_ID=10
BOOTPROTO=none
#UUID="4d878421-3a26-4150-b3aa-d75d3802ebe2" (特别注意注销MAC)
DEVICE="em2.10" (设备名记得更改)
NAME="em2.10"
ONBOOT="yes"
IPADDR=192.168.1.100
PREFIX=24
GATEWAY=192.168.1.1
(2)编辑[root@localhost ~]#vi etc/sysconfig/network-scripts/ifcfg-em2.20
TYPE=Vlan
VLAN=yes
VLAN_ID=10
BOOTPROTO=none
#UUID="4d878421-3a26-4150-b3aa-d75d3802ebe2" (特别注意注销MAC)
DEVICE="em2.20" (设备名记得更改)
NAME="em2.20"
ONBOOT="yes"
IPADDR=192.168.1.200
PREFIX=24
4:ipdown em2.10 关闭em2.10
ipdown em2.20 关闭em2.20
ipup em2.10 打开em2.10
ipup em2.20 打开em2.20
5 :查看交换机配置是否成功
[root@localhost ~]# cat /proc/net/vlan/config
VLAN Dev name | VLAN ID
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
em.20 | 20 | em2
em.10 | 10 | em2
标签:交换机配置 文件 复制 gate dev config roo VID ref
原文地址:https://blog.51cto.com/10720233/2557191