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重启网络服务进行生效。

猜你喜欢

转载自www.cnblogs.com/00986014w/p/9294371.html