nmcli con add con-name eth1-vlan1 type ethernet ifname eth1 ipv4.addresses 192.168.1.1/24 ipv4.method manual nmcli con add con-name eth1-vlan10 type vlan id 10 ifname eth1-vlan10 \ dev eth1 ipv4.addresses 192.168.10.1/24 ipv4.method manual
nmcli con add con-name eth1-vlan20 type vlan id 20 dev eth1 ifname eth1-vlan20 ipv4.addresses 192.168.20.1/24 ipv4.method manual nmcli con add con-name eth1-vlan30 type vlan id 30 dev eth1 ifname eth1-vlan30 ipv4.addresses 192.168.30.1/24 ipv4.method manual nmcli con add con-name eth1-vlan40 type vlan id 40 dev eth1 ifname eth1-vlan40 ipv4.addresses 192.168.40.1/24 ipv4.method manual
ip a | grep 192 inet 192.168.1.1/24 brd 192.168.1.255 scope global noprefixroute eth1 inet 192.168.10.1/24 brd 192.168.10.255 scope global noprefixroute eth1-vlan10 inet 192.168.20.1/24 brd 192.168.20.255 scope global noprefixroute eth1-vlan20 inet 192.168.30.1/24 brd 192.168.30.255 scope global noprefixroute eth1-vlan30 inet 192.168.40.1/24 brd 192.168.40.255 scope global noprefixroute eth1-vlan40
dhcp测试
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# 测试 dhcpd -t Internet Systems Consortium DHCP Server 4.4.2b1 Copyright 2004-2019 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ ldap_gssapi_principal is not set,GSSAPI Authentication for LDAP will not be used Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file Config file: /etc/dhcp/dhcpd.conf Database file: /var/lib/dhcpd/dhcpd.leases PID file: /var/run/dhcpd.pid Source compiled to use binary-leases
nmcli con add con-name eth0-vlan30 ifname eth0-vlan30 type vlan id 30 dev eth0 nmcli con add con-name eth0-vlan40 ifname eth0-vlan40 type vlan id 40 dev eth0