Centos8 配置网络 nmcli的使用
2022/2/16 7:11:48
本文主要是介绍Centos8 配置网络 nmcli的使用,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1.网卡查看
nmcli c = nmcli connection show
[root@centos8 ~]# nmcli c NAME UUID TYPE DEVICE eth0 6ace3223-0c8c-4e95-a41f-7520a377b492 ethernet eth0
nmcli c s = nmcli connection show eth0 #查看网卡信息
[root@centos8 ~]# nmcli c s eth0 connection.id: eth0 connection.uuid: 6ace3223-0c8c-4e95-a41f-7520a377b492 connection.stable-id: -- connection.type: 802-3-ethernet connection.interface-name: eth0 …… IP6.GATEWAY: fe80::fa98:efff:fef1:e812 IP6.ROUTE[1]: dst = 2001:da8:21d:3::/64, nh = ::, mt = 100 IP6.ROUTE[2]: dst = ::/0, nh = fe80::fa98:efff:fef1:e812, mt = 100 IP6.ROUTE[3]: dst = ff00::/8, nh = ::, mt = 256, table=255 IP6.ROUTE[4]: dst = fe80::/64, nh = ::, mt = 100 IP6.ROUTE[5]: dst = 2001:da8:21d:3::54/128, nh = ::, mt = 100 IP6.DNS[1]: 2001:da8:21d:1::6 DHCP6.OPTION[1]: dhcp6_name_servers = 2001:da8:21d:1::6 DHCP6.OPTION[2]: ip6_address = 2001:da8:21d:3::54
显示所有设备配置状态
[root@centos8 ~]# nmcli device status DEVICE TYPE STATE CONNECTION eth0 ethernet 已连接 eth0 lo loopback 未托管 --
2.网卡配置
nmcli掩码和IP写到一起了
- 255.0.0.0/8
- 255.255.0.0/16
- 255.255.255.0/24
nmcli connection modify eth0 ipv4.method manual
nmcli connection modify eth0 ipv4.addresses 192.168.0.58/24 ipv4.gateway 192.168.0.2 ipv4.dns 114.114.114.114
删除DNS
# nmcli connection modify eth0 -ipv4.dns 114.114.114.114
添加一个网卡
nmcli connection add type ethernet con-name eth0 ifname eno123
添加一个ipv4
# nmcli connection modify eth0 +ipv4.addresses 192.168.10.159/24
3.网卡重启
nmcli connection up eth0 打开网卡
nmcli connection down eth0 关闭网卡
# 配置完后使用如下任意两条命令执行加载配置 更新网卡的操作
[root@rhel8 ~]# nmcli device connect eth0
Device 'eth0' successfully activated with '6ee6c69c-7753-4ef0-8f95-5be18adc75db'.
[root@rhel8 ~]# nmcli device reapply eth0
Connection successfully reapplied to device 'eth0'.
这篇关于Centos8 配置网络 nmcli的使用的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-07-03微信支付提示下单账户与支付账户不一致-icode9专业技术文章分享
- 2024-07-03微信支付提示订单号重复-icode9专业技术文章分享
- 2024-07-02微服务启动nacos注册上去了,但是一直没有收到请求-icode9专业技术文章分享
- 2024-07-02如何检查文件的编码格式-icode9专业技术文章分享
- 2024-07-02sublime 更改编码格式-icode9专业技术文章分享
- 2024-06-30uniAPP 实现全屏左右滚动滚动的效果-icode9专业技术文章分享
- 2024-06-30如何在本地使用授权或插件-icode9专业技术文章分享
- 2024-06-30伪静态规则配置方法汇总-icode9专业技术文章分享
- 2024-06-29易优CMS安装常见问题汇总-icode9专业技术文章分享
- 2024-06-28易优新手必读安装教程-icode9专业技术文章分享