静态IP地址配置如下(假设通过eth1上网) # The primary network interface auto eth1 iface eth1 inet static //指定为static address 192.168.3.90 //IP地址 gateway 192.168.3.1 //网关 netmask 255.255.255.0 //子网掩码 同样需要重启 sudo /etc/init.d/networking restart DNS 如果有必要,配置DNS sudo gedit /etc/resolv.conf nameserver 192.168.3.2
首先设置IP
sudo gedit /etc/network/interface
将其内容删除
加上一下内容
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.47
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
保存
然后修改DNS
sudo gedit /etc/resolv.conf
将内容修改为
nameserver 202.112.14.151
nameserver 218.6.200.139
nameserver 61.139.2.69
查看dns
less /etc/resolv.conf
保存
重启网络连接
sudo /etc/init.d/networking stop
sudo /etc/init.d/networking start
sudo /etc/init.d/networking restart
查看路由相关信息:route -n