linux7系统如何配置网卡,Linux 7 配置网卡(nmcli)
操作系统版本:
[root@cjcos01 network-scripts]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.5 (Maipo)
查看网卡、IP等信息:
[root@cjcos01 ~]# ifconfig
enp0s3: flags=4163 mtu 1500
inet 192.168.1.90 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::e07:b869:9f7b:792a prefixlen 64 scopeid 0x20
ether 08:00:27:bc:de:5e txqueuelen 1000 (Ethernet)
RX packets 929 bytes 1120691 (1.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 759 bytes 68662 (67.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s8: flags=4163 mtu 1500
ether 08:00:27:93:03:0a txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s9: flags=4163 mtu 1500
ether 08:00:27:de:7f:38 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s10: flags=4163 mtu 1500
ether 08:00:27:56:39:b6 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 0 (Local Loopback)
RX packets 166 bytes 17894 (17.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 166 bytes 17894 (17.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099 mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:45:70:b3 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
查看配置信息
[root@cjcos01 network-scripts]# ls -l ifcfg-*
-rw-r--r-- 1 root root 472 Sep 16 10:23 ifcfg-enp0s3
-rw-r--r--. 1 root root 254 Jan 3 2018 ifcfg-lo
查看nmcli命令
[root@cjcos01 network-scripts]# man -k nmcli
nmcli (1) - command-line tool for controlling NetworkManager
nmcli-examples (7) - usage examples of nmcli
[root@cjcos01 network-scripts]# man nmcli 7
CONNECTION MANAGEMENT COMMANDS
nmcli connection {show | up | down | modify | add | edit | clone | delete | monitor | reload | load | import |
export} [ARGUMENTS...]
添加网卡
[root@cjcos01 network-scripts]# nmcli connection add con-name enp0s8 type ethernet ifname enp0s8 ipv4.method manual ipv4.addresses 192.100.100.10/24 connection.autoconnect yes
Connection 'enp0s8' (f81306db-bac5-4b2c-ac52-b42c0ca52621) successfully added.
[root@cjcos01 network-scripts]# nmcli connection add con-name enp0s9 type ethernet ifname enp0s9 ipv4.method manual ipv4.addresses 192.100.100.20/24 connection.autoconnect yes
Connection 'enp0s9' (587e0d6b-c4af-4273-9c48-bd2f66fbbc84) successfully added.
查看网卡配置
[root@cjcos01 network-scripts]# cat ifcfg-enp0s8
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPADDR=192.100.100.10
PREFIX=24
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s8
UUID=f81306db-bac5-4b2c-ac52-b42c0ca52621
DEVICE=enp0s8
ONBOOT=yes
[root@cjcos01 network-scripts]# cat ifcfg-enp0s9
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPADDR=192.100.100.20
PREFIX=24
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s9
UUID=587e0d6b-c4af-4273-9c48-bd2f66fbbc84
DEVICE=enp0s9
ONBOOT=yes
查看网卡信息
[root@cjcos01 network-scripts]# nmcli connection show
NAME UUID TYPE DEVICE
enp0s3 b0b58151-2738-4a9b-8e49-30341e577a60 ethernet enp0s3
enp0s8 f81306db-bac5-4b2c-ac52-b42c0ca52621 ethernet enp0s8
enp0s9 587e0d6b-c4af-4273-9c48-bd2f66fbbc84 ethernet enp0s9
virbr0 c6b6e6fd-1b38-4493-865c-317c16360e46 bridge virbr0
删除网卡
[root@cjcos01 network-scripts]# nmcli connection delete enp0s8
Connection 'enp0s8' (2eec6955-a3dd-4909-9cfc-89f06c2a9aca) successfully deleted.
Connection 'enp0s8' (972fecaa-7123-45de-8248-dd77912606a2) successfully deleted.
Connection 'enp0s8' (7916c63a-2c4e-46a5-8dd6-1d752f694825) successfully deleted.
网卡绑定
[root@cjcos01 network-scripts]# nmcli connection add type bond ifname bond0 mode 1 ip4 192.100.100.30/24 ipv4.gateway 192.100.100.254
Connection 'bond-bond0' (80418cf9-d103-4bc3-a5b8-17783a5dd4c5) successfully added.
[root@cjcos01 network-scripts]# nmcli connection add type bond-slave ifname enp0s8 master bond0
Connection 'bond-slave-enp0s8' (9a848655-4f43-423e-b63e-0c382406a208) successfully added.
[root@cjcos01 network-scripts]# nmcli connection add type bond-slave ifname enp0s9 master bond0
Connection 'bond-slave-enp0s9' (df987cba-99bf-444f-a060-e096291a9d3c) successfully added.
查看信息
[root@cjcos01 network-scripts]# nmcli connection show
NAME UUID TYPE DEVICE
bond-bond0 80418cf9-d103-4bc3-a5b8-17783a5dd4c5 bond bond0
enp0s3 b0b58151-2738-4a9b-8e49-30341e577a60 ethernet enp0s3
enp0s8 f81306db-bac5-4b2c-ac52-b42c0ca52621 ethernet enp0s8
enp0s9 587e0d6b-c4af-4273-9c48-bd2f66fbbc84 ethernet enp0s9
virbr0 c6b6e6fd-1b38-4493-865c-317c16360e46 bridge virbr0
bond-slave-enp0s8 9a848655-4f43-423e-b63e-0c382406a208 ethernet --
bond-slave-enp0s9 df987cba-99bf-444f-a060-e096291a9d3c ethernet --
[root@cjcos01 network-scripts]# cat ifcfg-bond-bond0
BONDING_OPTS=mode=active-backup
TYPE=Bond
BONDING_MASTER=yes
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPADDR=192.100.100.30
PREFIX=24
GATEWAY=192.100.100.254
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=bond-bond0
UUID=80418cf9-d103-4bc3-a5b8-17783a5dd4c5
DEVICE=bond0
ONBOOT=yes
[root@cjcos01 network-scripts]# cat ifcfg-bond-slave-enp0s8
TYPE=Ethernet
NAME=bond-slave-enp0s8
UUID=9a848655-4f43-423e-b63e-0c382406a208
DEVICE=enp0s8
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@cjcos01 network-scripts]# cat ifcfg-bond-slave-enp0s9
TYPE=Ethernet
NAME=bond-slave-enp0s9
UUID=df987cba-99bf-444f-a060-e096291a9d3c
DEVICE=enp0s9
ONBOOT=yes
MASTER=bond0
SLAVE=yes
查看网卡绑定信息
[root@cjcos01 network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: None
MII Status: down
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
启动网卡
[root@cjcos01 network-scripts]# nmcli connection up bond-bond0
[root@cjcos01 network-scripts]# nmcli connection up bond-slave-enp0s8
[root@cjcos01 network-scripts]# nmcli connection up bond-slave-enp0s9
查看网卡绑定状态
[root@cjcos01 network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: enp0s8
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: enp0s8
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 08:00:27:93:03:0a
Slave queue ID: 0
Slave Interface: enp0s9
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 08:00:27:de:7f:38
Slave queue ID: 0
删除网卡绑定
[root@cjcos01 network-scripts]# nmcli connection show
NAME UUID TYPE DEVICE
bond-bond0 80418cf9-d103-4bc3-a5b8-17783a5dd4c5 bond bond0
enp0s3 b0b58151-2738-4a9b-8e49-30341e577a60 ethernet enp0s3
enp0s8 f81306db-bac5-4b2c-ac52-b42c0ca52621 ethernet enp0s8
enp0s9 587e0d6b-c4af-4273-9c48-bd2f66fbbc84 ethernet enp0s9
virbr0 c6b6e6fd-1b38-4493-865c-317c16360e46 bridge virbr0
bond-slave-enp0s8 9a848655-4f43-423e-b63e-0c382406a208 ethernet --
bond-slave-enp0s9 df987cba-99bf-444f-a060-e096291a9d3c ethernet --
[root@cjcos01 network-scripts]# nmcli connection delete bond-bond0
Connection 'bond-bond0' (80418cf9-d103-4bc3-a5b8-17783a5dd4c5) successfully deleted.
[root@cjcos01 network-scripts]# nmcli connection delete bond-slave-enp0s8
Connection 'bond-slave-enp0s8' (9a848655-4f43-423e-b63e-0c382406a208) successfully deleted.
[root@cjcos01 network-scripts]# nmcli connection delete bond-slave-enp0s9
Connection 'bond-slave-enp0s9' (df987cba-99bf-444f-a060-e096291a9d3c) successfully deleted.
欢迎关注我的微信公众号"IT小Chen",共同学习,共同成长!!
!
linux7系统如何配置网卡,Linux 7 配置网卡(nmcli)相关推荐
- linux字体配置要略,Linux字体配置要略.pdf
/ Linux 字体配置要略 Linux 字体配置要略 2012-02-15 我并不清楚 fontconfig . xfont . libfreetype 或某某库等等之间的界限与联系,其实作为普通用 ...
- linux基于文本的配置工具,Linux基本配置和管理 3 ---- Linux命令行文本处理工具
1 文件浏览(简单回顾) 1 cat 查看文件的内容 2 more 以翻页的形式查看,但是只能向下翻页 3 less 以翻页的形式查看,但是能够支持向上和向下翻页 4 head 默认是查看前10行,但 ...
- linux内核启动配置,启动linux内核配置
启动linux内核配置 发布时间:2005-09-22 20:04:48来源:红联作者:ccs LILO 入门 现在是最后来重新配置 LILO 的时候了,它将负责载入新的内核.LILO 是最流行的 L ...
- linux 有线网卡,linux下有线网卡出现ADDRCONF(NETDEV_UP): eth0: link is not ready的解决方法...
一.背景 2018年5月24日,笔者的pc已经连续运转两天了,突然要使用有线网卡,却发现有线网卡无法正常工作,于是查看了一下内核日志: r8169 0000:05:00.0 eth0: link do ...
- linux里添加网卡,Linux添加虚拟网卡的多种方法
Linux添加虚拟网卡的多种方法有时候,一台服务器需要设置多个ip,但又不想添加多块网卡,那就需要设置虚拟网卡.这里介绍几种方式在linux服务器上添加虚拟网卡.我们 有时候,一台服务器需要设置多个i ...
- linux 添加路由 指定网卡,Linux多个网卡添加永久路由办法
有时候Linux有多个网卡的时候,就需要为另外的一些网卡添加路由,好让网络走不通的网卡出去.那么今天PConline小编就给大家带来Linux多个网卡添加永久路由办法,有需要的小伙伴就赶紧一起往下看看 ...
- Linux系统创建vlan教程,linux vlan配置详解
本文主要给大家介绍了关于linux虚拟网络设备之vlan配置的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,希望能帮助到大家. 简介 VLAN是网络栈的一个附加 ...
- linux设定默认网卡,linux初始化配置网卡
配置网卡路径 /etc/sysconfig/network-scripts/ifcfg-eth0 内容: DEVICE=eth0 //网 ...
- linux安装的时候网卡配置失败,Linux下安装网卡执行make install失败
先安装的SuSE12系统,没有网卡驱动,试着自己安装 在网上下载了tar安装包,加压后执行make编译,出现如下错误: [/usr/src/e1000e-1.9.5/src]# make Makefi ...
最新文章
- 牛客java面试题总结版(三)
- 2020年计算机视觉综述论文汇总!涵盖14个方向:目标检测/图像分割/医学影像/人脸识别等方向
- 【java】System.getProperty()参数大全
- java写hive自定义函数_hive自定义函数的实现和执行
- 学习Spring Boot:(四)应用日志
- 两千字揭密 MySQL 8.0.19 三大索引新功能:隐藏索引,降序索引,函数索引
- ajax跨域请求wcf,ajax wcf 指定某个域名 进行跨域访问
- open cv+C++错误及经验总结(十一)
- 深职院计算机专业宿舍,深圳职业技术学院宿舍怎么样 住宿条件好不好
- 2021-07-21淘宝网第二次尝试
- 雷达为什么要进行脉冲压缩
- 北京强化养老行业诚信自律 从业者禁止侮辱、虐待老人
- Bootstrap官网的Bootstrap 3 字体图标的使用测试
- 2022版中国科技中介服务产业运行现状分析与发展机遇规划报告
- 关于在vscode引入python中Crypto包的问题
- 加州欧文计算机工程专业,加州大学欧文分校计算机工程排名第29(2018年TFE美国排名)...
- ad怎么导入cad的外形尺寸_AD10怎样精确导入CAD文件?
- [NCTF2019]Fake XML cookbook 1
- 一份手游代理合同,让你知道游戏代理商该干什么!
- 英伟达显卡【NVIDIA GeForece RTX3060 laptop GPU】装深度学习环境,学习框架为Pytorch
热门文章
- Java中获取当前函数名
- animate.css动画样式详解
- ThinkPHP 5.0.x、5.1.x、5.2.x 全版本远程命令执行漏洞
- c语言实现linux下的top命令来获取cpu利用率_有用的一篇笔记,linux 调优各项监控指标...
- 会话跟踪之Session
- Html和websocket初识
- JQuery DataTables Selected Row
- 新国标电动自行车目录库
- 项目开发中发布更新文档备注
- flask框架基本使用(2)(响应与重定向)