ubuntu server 修改静态IP和DNS
- 配置静态IP
#vim /etc/network/interfaces
#auto lo
#iface lo inet loopback
#auto eth0
#iface eth0 inet dhcp
#以上是默认使用DHCP分配的IP,修改如下
auto lo
iface lo inet loopback
#让网卡开机自动挂载
auto eth0
iface eth0 inet static
address 10.32.0.150
netmask 255.255.255.0
gateway 10.32.0.1
- 配置DNS
# vim /etc/resolv.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 OVERWR
nameserver 10.32.0.20
nameserver 219.141.140.10