zoukankan      html  css  js  c++  java
  • Set up VLAN (802.1q) tagging on a network interface?

    SOLUTION VERIFIED

    environment

    • Red Hat Enterprise Linux 4
    • Red Hat Enterprise Linux 5
    • Red Hat Enterprise Linux 6
    • Red Hat Enterprise Linux 7

    question 

    • 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?

    solution

    RHEL 7 with NetworkManager

    • With nmcli, create a new connection of the VLAN type where con-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, and id 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

    • Create an interface configuration file in the /etc/sysconfig/network-scripts/ directory with the name ifcfg-{name} where {name} is the custom name for the VLAN interface.
    • The ifcfg file must include: the DEVICE parameter which specifies the custom interface name, the PHYSDEV parameter which specifies the interface the VLAN will be on top of, VID which specifies the VLAN ID (number), and VLAN=yes must be set. PHYSDEV can be a bond.
    • In the following example, a VLAN interface named "outside-network" will be created over eth0 with a VLAN ID of 10:
      DEVICE=outside-network
      VLAN=yes
      PHYSDEV=eth0
      VID=10
      BOOTPROTO=dhcp
      ONBOOT=yes
      # This became possible in RHEL 6 with the release of initscripts-9.03.46-1.el6: RHBA-2014:1448-1
  • 相关阅读:
    全局上下文(GO)
    重写数组拓展方法
    spring + spring mvc 使用 maven 编译出现异常
    shiro 配置注解后无权访问不进行页面跳转异常:org.apache.shiro.authz.UnauthorizedException: Subject does not have permission
    shiro 配置注解异常 java.lang.ClassNotFoundException: org.aspectj.util.PartialOrder$PartialComparable
    kaptcha 配置
    maven 安装 jar 包
    jsp 页面 javax.servlet.jsp.JspException cannot be resolved to a type 异常
    操作系统下载地址
    java file 常用操作
  • 原文地址:https://www.cnblogs.com/echo1937/p/6229196.html
Copyright © 2011-2022 走看看