Linux配置网络服务

刚安装好的linux系统需要配置网络服务。除了修改配置文件外,也可以执行下面的命令:

nmcli connection add con-name "static-eth0" ifname ens33 autoconnect yes type ethernet ip4 [设置的ip]/24 gw4 [设置的网关] 

nmcli connection modify static-eth0 ipv4.dns [DNS地址]

这样执行的效果和直接修改配置文件是一样的。

执行后,通过systemctl restart network重启网络服务进行生效。

posted @ 2018-07-11 14:39  右威卫大将军  阅读(296)  评论(0编辑  收藏  举报