ubuntu静态ip

网络管理服务为 network-manager.service ,使用systemctl进行管理

配置网络
vim /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0 # 开机自启,eth0为网卡名可通过ip addr查看
iface eth0 inet static # 静态ip
address 192.168.2.174
netmask 255.255.255.0
gateway 192.168.2.1 # 网关可通过route -n 查看

重启服务
systemctl restart network-manager.service

posted @ 2022-08-01 09:45  Hey,Coder!  阅读(38)  评论(0编辑  收藏  举报