CentOS 7 网卡子接口的创建
[root@controller ~]# modinfo 8021q
filename: /lib/modules/3.10.0-229.14.1.el7.x86_64/kernel/net/8021q/8021q.ko
version: 1.8
license: GPL
alias: rtnl-link-vlan
rhelversion: 7.1
srcversion: 2C3C3989B54002FAEC13FFD
depends: mrp,garp
intree: Y
vermagic: 3.10.0-229.14.1.el7.x86_64 SMP mod_unload modversions
signer: CentOS Linux kernel signing key
sig_key: E9:9F:C4:37:BD:9C:BF:B4:F1:B1:DA:87:C1:57:FF:66:56:9B:EE:66
sig_hashalgo: sha256 或者: [root@controller ~]# modinfo -F filename 8021q
/lib/modules/3.10.0-229.14.1.el7.x86_64/kernel/net/8021q/8021q.ko
或者:
[root@controller ~]# modprobe --first-time 8021q
modprobe: ERROR: could not insert '8021q': Module already in kernel
2.如果没有加载802.1q模块怎么加载?
##加载8021q模块
[root@controller ~]# modprobe 8021q
##查看是否正常加载
[root@controller ~]# lsmod |grep 8021q
8021q 28808 0
garp 14384 1 8021q
mrp 18542 1 8021q
3.在父接口创建vlan子接口
3.1在父接口/etc/sysconfig/network-scripts/ifcfg-ethX 中设置
DEVICE=ethX
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
3.2复制父接口并修改接口名称
cp/etc/sysconfig/network-scripts/ifcfg-ethX/etc/sysconfig/network-scripts/ifcfg-ethX.125 ## X后面的125为vlan号
3.3配置/etc/sysconfig/network-scripts/ifcfg-ethX.125
DEVICE=ethX.192
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.1
PREFIX=24
NETWORK=192.168.1.0
VLAN=yes ##开启vlan,表明此子接口为vlan接口
4.重启网络
systemctl restart network
8021q module is loaded by default. If necessary, you can make sure that the module is loaded by issuing the following command as root:
~]#modprobe --first-time 8021q
modprobe: ERROR: could not insert '8021q': Module already in kernel
To display information about the module, issue the following command:
~]$ modinfo 8021q
See the modprobe(8) man page for more command options.
7.4.1. Setting Up 802.1Q VLAN Tagging Using ifcfg Files
- Configure the parent interface in
/etc/sysconfig/network-scripts/ifcfg-ethX, whereX is a unique number corresponding to a specific interface, as follows:DEVICE=ethX
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes - Configure the VLAN interface configuration in the
/etc/sysconfig/network-scripts/directory. The configuration file name should be the parent interface plus a.character plus the VLAN ID number. For example, if the VLAN ID is 192, and the parent interface is eth0, then the configuration file name should beifcfg-eth0.192:DEVICE=ethX.192
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.1.1
PREFIX=24
NETWORK=192.168.1.0
VLAN=yesIf there is a need to configure a second VLAN, with for example, VLAN ID 193, on the same interface, eth0, add a new file with the nameeth0.193with the VLAN configuration details. - Restart the networking service in order for the changes to take effect. As
rootissue the following command:~]#
systemctl restart network
7.4.2. Configure 802.1Q VLAN Tagging Using ip Commands
8, issue a command as root as follows:
~]# ip link add link eth0 name eth0.8 type vlan id 8
To view the VLAN, issue the following command:
~]$ip -d link show eth0.8
4: eth0.8@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 52:54:00:ce:5f:6c brd ff:ff:ff:ff:ff:ff promiscuity 0
vlan protocol 802.1Q id 8 <REORDER_HDR>
0x and as an octal value if it has a leading 0. This means that in order to assign a VLAN ID with a decimal value of 22, you must not add any leading zeros.root as follows:
ip link delete eth0.8DEVICE=${SECONF_ETH}.${EXTERNAL_TENANT_NETWORK_VLAN_ID}
BOOTPROTO=none
ONBOOT=yes
IPADDR=${SECOND_SUB_INTERFACE_IP}
PREFIX=24
NETWORK=${SECOND_SUB_INTERFACE_NET}
VLAN=yes
CentOS 7 网卡子接口的创建的更多相关文章
- [原]CentOS 7 网卡子接口的创建
OS:CentOS 7 在linux上创建vlan需要加载802.1q模块: 1.检测OS是否已经加载802.1q模块 [root@controller ~]# modinfo 8021q filen ...
- Centos配置网卡子接口
1.检查OS是否加载802.1q模块: 方法一: [root@rs2 ~]# modinfo 8021q 方法二: [root@rs2 ~]# modinfo -F filename 8021q 方法 ...
- centos 7 增加网卡子接口配置
centos 7 增加网卡子接口配置 http://www.mamicode.com/info-detail-1351950.html
- CentOS、Ubuntu配置网卡子接口
CentOS # ip addr add dev eth0 lable eth0: 以上为临时配置,重启失效.若需永久保存,增加网络配置文件 # vim /etc/sysconfig/network- ...
- Linux 创建网卡子接口
创建网卡子接口,添加IP别名 ifconfig eth0:0 2.2.2.2/24 或 ip addr add 2.2.2.2/24 dev eth0 label eth0:0 清除网卡子接口,删除 ...
- java 访问 太平洋网ip接口,解决前端js 跨域访问失败问题
前端 js访问太平洋网IP接口地址,返回结果是403 服务器拒绝处理异常, 于是,想到了使用 服务器端访问,然后再将查询结果返回的前端 这是Java的测试源码,[具体的contronller端源码懒得 ...
- 剥开比原看代码11:比原是如何通过接口/create-account创建帐户的
作者:freewind 比原项目仓库: Github地址:https://github.com/Bytom/bytom Gitee地址:https://gitee.com/BytomBlockchai ...
- json-lib-2.4-jdk15.jar所需全部JAR包.rar java jsoup解析开彩网api接口json数据实例
json-lib-2.4-jdk15.jar所需全部JAR包.rar java jsoup解析开彩网api接口json数据实例 json-lib-2.4-jdk15.jar所需全部JAR包.rar ...
- 从CentOS官网下载系统镜像详细教程
很多新手小白鼠想学习CentOS系统,但是不知道镜像去哪里搞,随便去个第三方发现要么要注册,要么各种广告病毒,或者好不容易找到官网,点进去一看却一脸懵逼,不仅全英文,有些专业术语也不懂啊,不要担心 ...
随机推荐
- myeclipse中的文件内容被覆盖如何恢复
今天无意中,运行文件把原先的文件给覆盖掉了,通过查阅资料发现可以通过这样去恢复 点击被覆盖后的文件------->右击--------->选择replace with------>p ...
- 【Linux_Fedora_应用系列】_3_如何利用Smplayer播放WMV格式的文件
在上一篇我们成功安装了视频播放器,并且成功安装里解码器[Linux_Fedora_应用系列]_2_如何安装视频播放器和视频文件解码 安装完的Smplayer的GUI的界面程序,可以播放FLV.AVI. ...
- Jetty 的工作原理以及与 Tomcat 的比较
Jetty 的基本架构 Jetty 目前的是一个比较被看好的 Servlet 引擎,它的架构比较简单,也是一个可扩展性和非常灵活的应用服务器,它有一个基本数据模型,这个数据模型就是 Handler,所 ...
- 【转】nginx优化 突破十万并发
一.一般来说nginx 配置文件中对优化比较有作用的为以下几项: 1. worker_processes 8; nginx 进程数,建议按照cpu 数目来指定,一般为它的倍数 (如,2个四核的cpu计 ...
- (转载)Windows常见性能计数器(较好的说明)
转载地址:http://blog.csdn.net/dfbrt56/article/details/3341591 Windows常见性能计数器 性能计数器(counter)是描述服务器或操作系统性能 ...
- SlidesJS - 老牌的响应式 jQuery 幻灯片插件
SlidesJS 是一款老牌的 jQuery 幻灯片插件,经过多年的发展,已经成为一款功能齐全,设计精巧的幻灯片插件.支持循环.自动播放功能和淡入淡出过渡效果,并且能够自动生成分页,可以帮助开发者制作 ...
- ImageLightbox.js – 响应式的图片 Lightbox 插件
ImageLightbox.js 是一款很简洁的用于显示图片灯箱效果(Lightbox)的插件,没有字幕,导航按钮或默认背景.如果默认功能不够用的话,你可以很容易地自定义 JavaScript 函数扩 ...
- 8款适合乐队、歌手和音乐家免费 WordPress 主题
这篇文章与大家分享8款适合乐队.歌手和音乐家免费 WordPress WordPress 音乐网站主题.WordPress 作为最流行的博客系统,插件众多,易于扩充功能.安装和使用都非常方便,而且有许 ...
- 15个最佳的代码评审(Code Review)工具
代码评审可以被看作是计算机源代码的测试,它的目的是查找和修复引入到开发阶段的应用程序的错误,提高软件的整体素质和开发者的技能.代码审查程序以各种形式,如结对编程,代码抽查等.在这个列表中,我们编制了1 ...
- 【CSS3】 理解CSS3 transform中的Matrix(矩阵)
理解CSS3 transform中的Matrix(矩阵) by zhangxinxu from http://www.zhangxinxu.com 本文地址:http://www.zhangxinxu ...