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 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
- 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
Set up VLAN (802.1q) tagging on a network interface?的更多相关文章
- vlan 以及 Linux实现的IEEE 802.1Q VLAN
vlan 以及 Linux实现的IEEE 802.1Q VLAN Vlan的概念 VLAN技术介绍 VLANVLAN概述 以太网是一种基于CSMA/CD(Carrier Sense Multiple ...
- 802.1Q VLAN技术原理
文章出处:http://hi.baidu.com/x278384/item/d56b0edfd4f56a4eddf9be79 在数据通信和宽带接入设备里,只要涉及到二层技术的,就会遇到VLAN.而且, ...
- 管理型交换机IEEE 802.1Q VLAN设置应用实例
转载标注: IEEE802.1Q 我粗略理解为对交换机入口规则和出口规则设置,入口打上VID,设置从哪些口可以出去,并且是否带标签. 一 VLAN的概念 VLAN(Virtual Local Area ...
- 802.1q VLAN
VLAN(Virtual Local Area Network),是一种通过将局域网内的设备逻辑地而不是物理地划分成一个个网段从而实现虚拟工作组的技术. 以一个网络接口为主设备,可以创建多个虚拟网络接 ...
- 如何在centos上配置802.1Q VLAN标记,linux单网卡多vlan多网段Ip配置案例
介绍 VLAN使将大型网络分成较小且易于管理的网络成为可能.802.1Q是所有供应商都在其网络设备中实施的标准.某些交换机能够将多个VLAN分配给单个网络端口.使用此功能,您可以将多个VLAN分配给单 ...
- 网络工程知识(二)VLAN的基础和配置:802.1q帧;Access、Trunk、Hybrid接口工作模式过程与配置;VLANIF的小实验
介绍-VLAN VLAN(Virtual Local Area Network)即虚拟局域网,工作在数据链路层. 交换机将通过:接口.MAC.基于子网.协议划分(IPv4和IPv6).基于策略的方式划 ...
- VLAN IEEE802.1Q
一. VLAN产生原因-广播风暴 传统的局域网使用的是HUB,HUB只有一根总线,一根总线就是一个冲突域.所以传统的局域网是一个扁平的网络,一个局域网属于同一个冲突域.任何一台主机发出的报文都会被同一 ...
- 【vlan-trunk和802.1q子接口配置】
根据项目需求,搭建好拓扑图如下: 配置sw1的g1/0/3的/trunk,把g1/0/1和g1/0/2分别加入vlan 10 和 vlan 20 配置sw1的g1/0/3的/trunk,把g1/0/1 ...
- VLAN-3-VLAN Trunk:ISL和802.1Q
(1)ISL和802.1Q概念 通过使用VLAN Trunk链路,设备可以通过一条链路发送去往多个vlan的流量.为了知道数据帧属于哪个vlan,发送方会添加原始以太网数据帧的头部,这 ...
随机推荐
- Logstash实践: 分布式系统的日志监控
文/赵杰 2015.11.04 1. 前言 服务端日志你有多重视? 我们没有日志 有日志,但基本不去控制需要输出的内容 经常微调日志,只输出我们想看和有用的 经常监控日志,一方面帮助日志微调,一方面及 ...
- Ubuntu 14.04中Elasticsearch集群配置
Ubuntu 14.04中Elasticsearch集群配置 前言:本文可用于elasticsearch集群搭建参考.细分为elasticsearch.yml配置和系统配置 达到的目的:各台机器配置成 ...
- ifconfig: command not found(CentOS专版,其他的可以参考)
ifconfig: command not found 查看path配置(echo相当于c中的printf,C#中的Console.WriteLine) echo $PATH 解决方案1:先看看是不是 ...
- mysql 7下载安装及问题解决
mysql 7安装及问题解决 一.mysql下载 下载地址:https://www.mysql.com/downloads/ Community (GPL) Downloads MySQL Commu ...
- 12、Struts2表单重复提交
什么是表单重复提交 表单的重复提交: 若刷新表单页面, 再提交表单不算重复提交. 在不刷新表单页面的前提下: 多次点击提交按钮 已经提交成功, 按 "回退" 之后, 再点击 &qu ...
- SQL Server 2016白皮书
随着SQL Server 2016正式版发布日临近,相关主要特性通过以下预览学习: Introducing Microsoft SQL Server 2016 e-bookSQL Server 201 ...
- 【Machine Learning】Python开发工具:Anaconda+Sublime
Python开发工具:Anaconda+Sublime 作者:白宁超 2016年12月23日21:24:51 摘要:随着机器学习和深度学习的热潮,各种图书层出不穷.然而多数是基础理论知识介绍,缺乏实现 ...
- 使用mybatis-generator在自动生成Model类和Mapper文件
使用mybatis-generator插件可以很轻松的实现mybatis的逆向工程,即,能通过表结构自动生成对应的java类及mapper文件,可以大大提高工作效率,并且它提供了很多自定义的设置可以应 ...
- C#异步编程
什么是异步编程 什么是异步编程呢?举个简单的例子: using System.Net.Http; using System.Threading.Tasks; using static System.C ...
- 多线程条件通行工具——CountDownLatch
CountDownLatch的作用是,线程进入等待后,需要计数器达到0才能通行. CountDownLatch(int)构造方法,指定初始计数. await()等待计数减至0. await(long, ...