ubuntu设置静态IP地址
1、编辑/etc/network/interface,添加如下内容 # interfaces(5) file used by ifup(8) and ifdown(8) #auto lo #iface lo inet loopback #The primary network interface auto ens33 iface ens33 inet static address 192.168.111.203 netmask 255.255.255.0 gateway 192.168.111.1 2、配置dns,编辑/etc/resolve.conf,添加如下内容 # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 114.114.114.114 nameserver 8.8.8.8 注意:此dns在系统重启后会失效,如果要永久保存可通过以下两种办法: 方法1)编辑/etc/resolvconf/resolv.conf.d/base,添加如下内容 nameserver 114.114.114.114 nameserver