配置ubuntu的开发环境:设置静态ip和dns

在ubuntu环境下开发时,为了方便,将ubuntu配置为桥接,并设置静态ip和DNS

设置静态ip:
vi /etc/network/interfaces
在文件后追加以下几句:
auto eth0  #表示让网卡开机自动挂载eth0
iface eth0 inet static  
address 192.168.2.1  
gateway 192.168.2.254  
netmask 255.255.255.0

配置完后,重启ubuntu网络
/etc/init.d/networking restart

设置DNS:
vi  /etc/resolvconf/resolv.conf.d/base
#添加
nameserver 8.8.8.8
nameserver 8.8.4.4

resolvconf -u

猜你喜欢

转载自blog.csdn.net/yudelian/article/details/88628450