CentOS8中的nmcli使用详解

(编辑:jimmy 日期: 2024/9/20 浏览:2)

基于RHEL8/CentOS8的nmcli常见命令使用

# 查看ip(类似于ifconfig、ip addr)
nmcli
# 创建connection,配置静态ip(等同于配置ifcfg,其中BOOTPROTO=none,并ifup启动)
nmcli c add type ethernet con-name ethX ifname ethX ipv4.addr 192.168.1.100/24 ipv4.gateway 192.168.1.1 ipv4.method manual
# 创建connection,配置动态ip(等同于配置ifcfg,其中BOOTPROTO=dhcp,并ifup启动)
nmcli c add type ethernet con-name ethX ifname ethX ipv4.method auto
# 修改ip(非交互式)
nmcli c modify ethX ipv4.addr '192.168.1.200/24'
nmcli c up ethX
# 修改ip(交互式)
nmcli c edit ethX
nmcli> goto ipv4.addresses
nmcli ipv4.addresses> change
Edit 'addresses' value: 192.168.1.200/24
Do you also want to set 'ipv4.method' to 'manual'"color: #ff0000">总结

以上所述是小编给大家介绍的CentOS8中的nmcli使用,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!