centos单网卡配置VLAN,ubuntu当网卡配置VLAN,vlanid=1000
root@ubuntu:~# cat /etc/netplan/01-netcfg.yaml # This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: enp9s0: dhcp4: no vlans: vlan1000: id: 1000 link: enp9s0 addresses: [ 168.7.10.5/24 ] gateway4: 168.7.10.1 nameservers: addresses: [ 114.114.114.114,8.8.8.8 ]
[root@centos05 network-scripts]# cat ifcfg-enp131s0 DEVICE="enp131s0" ONBOOT="yes" BOOTPROTO=none TYPE="Ethernet" [root@centos05 network-scripts]# cat ifcfg-enp131s0.1000 DEVICE="enp131s0.1000" ONBOOT="yes" BOOTPROTO=static IPADDR="168.7.10.3" NETMASK="255.255.255.0" GATEWAY="168.7.10.1" TYPE="Vlan" VLAN_ID=1000 PYHSDEV=enp131s0 DNS1="114.114.114.114" [root@centos05 network-scripts]#