ubuntu 设置静态ip

sudo vi /etc/network/interfaces

2 auto lo
3 iface lo inet loopback

auto eth0
iface eth0 inet dhcp

4 auto ens33
5 iface ens33inet static
6 address 192.168.31.129
7 netmask 255.255.255.0
8 getway 192.168.31.1

root: ifup ens38

ifdown ens38 && ifup ens38

service networking restart

原文地址:https://www.cnblogs.com/xpylovely/p/11062845.html