[原]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.193
with the VLAN configuration details. - Restart the networking service in order for the changes to take effect. As
root
issue 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.8
DEVICE=${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- ...
- 剥开比原看代码11:比原是如何通过接口/create-account创建帐户的
作者:freewind 比原项目仓库: Github地址:https://github.com/Bytom/bytom Gitee地址:https://gitee.com/BytomBlockchai ...
- Linux 创建网卡子接口
创建网卡子接口,添加IP别名 ifconfig eth0:0 2.2.2.2/24 或 ip addr add 2.2.2.2/24 dev eth0 label eth0:0 清除网卡子接口,删除 ...
- 剥开比原看代码10:比原是如何通过/create-key接口创建密钥的
作者:freewind 比原项目仓库: Github地址:https://github.com/Bytom/bytom Gitee地址:https://gitee.com/BytomBlockchai ...
- java 访问 太平洋网ip接口,解决前端js 跨域访问失败问题
前端 js访问太平洋网IP接口地址,返回结果是403 服务器拒绝处理异常, 于是,想到了使用 服务器端访问,然后再将查询结果返回的前端 这是Java的测试源码,[具体的contronller端源码懒得 ...
- [原]Jenkins(十一)---jenkins使用管理员admin创建用户和分配权限
/** * lihaibo * 文章内容都是根据自己工作情况实践得出. * 版权声明:本博客欢迎转发,但请保留原作者信息! http://www.cnblogs.com/horizonli/p/533 ...
随机推荐
- SharePoint 2019 图文安装教程
前言 SharePoint 2019刚刚发布,很多群友在寻找安装教程,霖雨正好也下载了进行体验,就把完整的安装过程做成图文教程,分享给大家了,有需要的人可以有个参考. 文章从创建虚拟机开始,可能有点啰 ...
- Spark2.2(三十八):Spark Structured Streaming2.4之前版本使用agg和dropduplication消耗内存比较多的问题(Memory issue with spark structured streaming)调研
在spark中<Memory usage of state in Spark Structured Streaming>讲解Spark内存分配情况,以及提到了HDFSBackedState ...
- 可显示行号的log工具
import android.util.Log; /** * (ExtendedLog=>ELog)可以记录行号,类名,方法名的Log工具 * * @author Fantouch */ pub ...
- Winform开发框架之图表报表在线设计器2-图表-SNF.EasyQuery项目--SNF快速开发平台3.3-Spring.Net.Framework
上一篇讲到,如何快速创建报表程序了.这篇教大家如何快速制作图表报表. 继上一篇,Winform开发框架之图表报表在线设计器-报表 上一篇讲到如何了创建数据源,这里就不在介绍了.那我们就直接从图表设计器 ...
- Django TemplateDoesNotExist
在联系Django的时候,启动正常,我在浏览器上输入URL地址后报错 TemplateDoesNotExist at /test/ 解决方案 默认这里是空的,这里我们填上我们静态文件的地址
- texlive测试是否安装成功
在完成TEX Live安装之后,自然你会希望试试看它是否正常工作,好让你在以后能够创建优美的文档和字体. 1.首先确认你可以执行tex程序: >tex --version TeX 3.14159 ...
- 物联网架构成长之路(7)-EMQ权限验证小结
1. 前言 经过前面几小节,讲了一下插件开发,这一小节主要对一些代码和目录结构进行讲解,这些都是测试过程中一些个人经验,不一定是官方做法.而且也有可能会因为版本不一致导致差异. 2. 目录结构 这个目 ...
- tar加密
# tar -czvf - file_name|openssl des3 -salt -k |dd of=file_name.des3 # ls flie_name file_name.des3 # ...
- D3.js学习
// 1.选择d3.select('p')d3.selectAll('p')d3.select('.txt').style('color', '#fff')// 2.支持动态设置属性// a:随机属性 ...
- 安装polyglot出错
安装polyglot出错 错误 Complete output from command python setup.py egg_info: Traceback (most recent call l ...