centos7网卡配置vlan

添加VLAN ID 为2000网络

[root@localhost network-scripts]# cat ifcfg-eno1 
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=eno1
UUID=542ca061-4b34-4b18-ab4a-946eef1d9449
DEVICE=eno1
ONBOOT=yes
IPV6INIT=no

[root@localhost network-scripts]# cat ifcfg-eno1.2000 
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
PHYSDEV=eno1
NAME=eno1.2000
ONBOOT=yes
TYPE=Vlan
VLAN_ID=2000

IPADDR=192.168.24.54
NETMASK=255.255.255.0
GATEWAY=192.168.24.254


[root@localhost network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 08:f1:ea:91:52:22 brd ff:ff:ff:ff:ff:ff
3: ens1f0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq portid 20677c005ae8 state DOWN qlen 1000
    link/ether 20:67:7c:00:5a:e8 brd ff:ff:ff:ff:ff:ff
4: eno5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq portid 48df37831e40 state UP qlen 1000
    link/ether 48:df:37:83:1e:40 brd ff:ff:ff:ff:ff:ff
5: eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 08:f1:ea:91:52:23 brd ff:ff:ff:ff:ff:ff
6: ens1f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq portid 20677c005aec state DOWN qlen 1000
    link/ether 20:67:7c:00:5a:ec brd ff:ff:ff:ff:ff:ff
7: eno6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq portid 48df37831e48 state UP qlen 1000
    link/ether 48:df:37:83:1e:48 brd ff:ff:ff:ff:ff:ff
8: eno3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether 08:f1:ea:91:52:24 brd ff:ff:ff:ff:ff:ff
9: eno4: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether 08:f1:ea:91:52:25 brd ff:ff:ff:ff:ff:ff
11: eno1.2067@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 08:f1:ea:91:52:22 brd ff:ff:ff:ff:ff:ff
    inet 192.168.24.54/24 brd 192.168.24.255 scope global eno1.2067
       valid_lft forever preferred_lft forever
    inet6 fe80::af1:eaff:fe91:5222/64 scope link 
       valid_lft forever preferred_lft forever

# eno1.2067@eno1 即为添加VLAN的网络。
posted @ 2021-09-07 12:23  bugbeta  阅读(1580)  评论(1编辑  收藏  举报