标签:do set network VLAN ifcfg 192.168 RHEL interface name
环境
- Red Hat Enterprise Linux 4
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
问题
- Suppose I want a VLAN ID of 192 for the eth0 on a RHEL 5 or 6 system. What should my ifcfg-eth0 and my ifcfg-eth0.192 look like?
- How do you configure VLAN tagging on a RHEL system?
- Is it possible to configure multiple VLAN IDs on a single interface?
决议
RHEL 7 with NetworkManager
-
With
nmcli
, create a new connection of the VLAN type wherecon-name
is the name of the connection,ifname
is the name of the VLAN interface to be created,master
is the name of the interface the VLAN will be on top of, andid
is the VLAN ID (number). -
Using DHCP for IP addressing with a VLAN ID of 10:
# nmcli connection add type vlan ifname eth0.10 con-name myvlan id 10 dev eth0
- Or, with a static IP using example IP address 192.168.1.10/24 and gateway of 192.168.1.1:
# nmcli connection add type vlan ifname eth0.10 con-name myvlan id 10 dev eth0 ip4 192.168.1.10/24 gw4 192.168.1.1
RHEL 4, RHEL 5, RHEL 6, and RHEL 7 without NetworkManager
- Create an interface configuration file in the /etc/sysconfig/network-scripts/ directory with the name ifcfg-{device}.{vlan} where {device} is the interface the VLAN will be on top of and {vlan} is the VLAN ID (number). {device} can be either a regular interface or a bond. In the example below, the file would be called
ifcfg-eth0.10
. - The ifcfg file must include the DEVICE parameter which specifies the VLAN interface name and VLAN=yes must be set:
DEVICE=eth0.10
VLAN=yes
BOOTPROTO=dhcp
ONBOOT=yes
RHEL 6 with a custom VLAN interface name
See How to create a VLAN interface with an custom name
标签:do,set,network,VLAN,ifcfg,192.168,RHEL,interface,name 来源: https://www.cnblogs.com/augusite/p/15304173.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。