ܼ

CentOS 7˼ưVLAN硣
CentOSΥ󥿡ե̾ηѹNetworkManagerߤǰʲԤȤȤ롣

Ķ

OSCentOS Linux release 7.2.1511 (Core)

1ĤNICФơ3ĤΥɥ쥹Ϳ2ĤˤVLAN롣

DeviceIP AddressVLAN
eth0192.168.1.200N/A
eth0.10192.168.10.20010
eth0.100172.16.1.200100

VLANͿ륤󥿡եեϡ.פǶڤäVLAN IDͿ뽾ѤǤ롣

󥿡ե

  • ifcfg-eth0
    TYPE="Ethernet"
    BOOTPROTO=none
    DEVICE="eth0"
    ONBOOT="yes"
    IPADDR=192.168.1.200
    PREFIX=24
    NETWORK=192.168.1.0
  • ifcfg-eth0.10
    TYPE="Ethernet"
    BOOTPROTO=none
    DEVICE="eth0.10"
    ONBOOT="yes"
    IPADDR=192.168.10.200
    PREFIX=24
    NETWORK=192.168.10.0
    VLAN=yes
  • ifcfg-eth0.100
    TYPE="Ethernet"
    BOOTPROTO=none
    DEVICE="eth0.100"
    ONBOOT="yes"
    IPADDR=172.16.1.200
    PREFIX=24
    NETWORK=172.16.1.0
    VLAN=yes

ͭ

ͥåȥӥƵư롣

# systemctl restart network.service

ǧ

̤ȿǾǧ롣

# ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 192.168.1.200  netmask 255.255.255.0  broadcast 192.168.1.255
       inet6 fe80::ba27:ebff:fe3c:2179  prefixlen 64  scopeid 0x20<link>
       ether b8:27:eb:3c:21:79  txqueuelen 1000  (Ethernet)
       RX packets 32783  bytes 2597613 (2.4 MiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 6051  bytes 527705 (515.3 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0.10: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 192.168.10.200  netmask 255.255.255.0  broadcast 192.168.10.255
       inet6 fe80::ba27:ebff:fe3c:2179  prefixlen 64  scopeid 0x20<link>
       ether b8:27:eb:3c:21:79  txqueuelen 1000  (Ethernet)
       RX packets 0  bytes 0 (0.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 12  bytes 816 (816.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0.100: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 172.16.1.200  netmask 255.255.255.0  broadcast 172.16.2.255
       inet6 fe80::ba27:ebff:fe3c:2179  prefixlen 64  scopeid 0x20<link>
       ether b8:27:eb:3c:21:79  txqueuelen 1000  (Ethernet)
       RX packets 0  bytes 0 (0.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 12  bytes 816 (816.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
       inet 127.0.0.1  netmask 255.0.0.0
       inet6 ::1  prefixlen 128  scopeid 0x10<host>
       loop  txqueuelen 1  (Local Loopback)
       RX packets 4  bytes 344 (344.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 4  bytes 344 (344.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ȥå   Խ ʬ ʎގ̎ ź ʣ ̾ѹ   ǽ   إ   ǽRSS
Last-modified: 2016-12-27 () 01:54:07 (93d)