zoukankan      html  css  js  c++  java
  • centos6 一个vlan配置多ip地址

    添加vlan

    [root@localhost network-scripts]# vconfig add eth1 109
    

    配置文件,此处配置了vlan109使用子接口进行多ip配置:

    [root@localhost network-scripts]# cat ifcfg-eth1.109:0
    DEVICE=eth1.109:0
    HWADDR=68:05:CA:25:FC:43
    TYPE=Ethernet
    UUID=05ed80f3-7699-4702-b93e-016d8b84067d
    ONBOOT=yes
    NM_CONTROLLED=yes
    BOOTPROTO=none
    VLAN=yes
    IPADDR=192.168.15.230
    NETMASK=255.255.255.0
    
    [root@localhost network-scripts]# cat ifcfg-eth1.109:1
    DEVICE=eth1.109:1
    HWADDR=68:05:CA:25:FC:43
    TYPE=Ethernet
    UUID=05ed80f3-7699-4702-b93e-016d8b84067d
    ONBOOT=yes
    NM_CONTROLLED=yes
    BOOTPROTO=none
    IPADDR=192.168.50.230
    NETMASK=255.255.255.0
    VLAN=yes
    
    如果是一个vlan一个ip地址如下:
    [root@localhost network-scripts]# cat ifcfg-eth1.112 
    DEVICE=eth1.112
    HWADDR=68:05:CA:25:FC:43
    TYPE=Ethernet
    UUID=05ed80f3-7699-4702-b93e-016d8b84067d
    ONBOOT=yes
    NM_CONTROLLED=no
    BOOTPROTO=none
    VLAN=yes
    IPADDR=192.168.46.230
    NETMASK=255.255.255.0
    

    以上配置重启网卡生效,自动创建vlan关系:

    [root@localhost network-scripts]# service network restart
    Shutting down interface eth1.104:                          [  OK  ]
    Shutting down interface eth1.112:                          [  OK  ]
    Shutting down interface eth1.113:                          [  OK  ]
    Shutting down interface eth1.124:                          [  OK  ]

    查看vlan信息:

    [root@localhost network-scripts]# cat /proc/net/vlan/config 
    VLAN Dev name	 | VLAN ID
    Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
    eth1.109       | 109  | eth1
    eth1.104       | 104  | eth1
    eth1.112       | 112  | eth1
    eth1.113       | 113  | eth1
    eth1.124       | 124  | eth1
    
  • 相关阅读:
    leetcode 268. Missing Number
    DBSCAN
    python二维数组初始化
    leetcode 661. Image Smoother
    leetcode 599. Minimum Index Sum of Two Lists
    Python中的sort() key含义
    leetcode 447. Number of Boomerangs
    leetcode 697. Degree of an Array
    滴滴快车奖励政策,高峰奖励,翻倍奖励,按成交率,指派单数分级(1月3日)
    北京Uber优步司机奖励政策(1月2日)
  • 原文地址:https://www.cnblogs.com/ligao/p/6214974.html
Copyright © 2011-2022 走看看