龙蜥:anolisos 7.9系统网口启用vlan
背景说明:
1、加载8021q内核模块
[root@localhost ~]# modprobe --first-time 8021q
[root@localhost ~]# lsmod | grep -i 8021q
8021q 33080 0
garp 14384 1 8021q
mrp 18542 1 8021q
[root@localhost ~]# modinfo 8021q
2、创建子接口及vlan封装
[root@localhost ~]# ip link add link ens6f0 name ens6f0.100 type vlan id 100
[root@localhost ~]# ip a
3. 启用子接口
[root@localhost ~]# ip link set ens6f0.100 up
[root@localhost ~]# ip a
4. 配置子接口IP
ip address add 172.27.100.47/24 dev ens6f0.100
ip address show ens6f0.100
重启后失效!
5、持久化子接口IP
[root@k8s-node ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens6f0.100
BOOTPROTO=none
DEVICE=ens6f0.100
ONBOOT=yes
IPADDR=172.27.100.47
PREFIX=24
NETWORK=172.27.100.0
GATEWAY=172.27.100.1
VLAN=yes
DNS1=223.5.5.5
源接口
[root@k8s-node ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens6f0
TYPE=Ethernet
BOOTPROTO=none
DEVICE=ens6f0
ONBOOT=yes
重启网络生效
systemctl restart network
参考:https://blog.csdn.net/beeworkshop/article/details/109198589