Ubuntu20.04使用nmcli配置网络连接

预备需求

  • Ubuntu Server 20.04
  • root权限
  • 可以访问互联网

此时已经可以通过nmcli管理网络了

使用nmcli -p device查看设备状态

cc@ubuntu:~$ nmcli -p device ===================== Status of devices ===================== DEVICE TYPE STATE CONNECTION ---------------------------------------------------------------------- ens33 ethernet connected Wired connection 1 lo loopback unmanaged -- cc@ubuntu:~$ 

例子:使用nmcli配置静态ip地址

后续步骤:

查看连接状态

cc@ubuntu:~$ nmcli connection NAME UUID TYPE DEVICE test 4bd559fe-191d-460c-a4cd-56ae44c27859 ethernet ens33 Wired connection 1 e3f905c8-ba3f-3a5f-ab41-8397381e6fe6 ethernet -- 

删除多余连接

cc@ubuntu:~$ sudo nmcli connection delete Wired\ connection\ 1 

查看ip地址

cc@ubuntu:~$ ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 00:0c:29:59:f9:bf brd ff:ff:ff:ff:ff:ff inet 192.168.93.4/24 brd 192.168.93.255 scope global noprefixroute ens33 valid_lft forever preferred_lft forever inet6 fe80::cfb6:10b:de98:a885/64 scope link noprefixroute valid_lft forever preferred_lft forever cc@ubuntu:~$ 

相关资料

原文链接:https://blog.csdn.net/weixin_43669941/article/details/107893322

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享