我有一个 Ubuntu Server 14.04 和 2 个以太网卡。
我现在只使用 eth1,所以我想更改我的配置,因为我现在无法使用我的服务器访问互联网。
我已经更改了文件 /etc/network/interfaces
# The primary network interface for Internet
auto eth1
iface eth1 inet static
address 192.168.1.254
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 109.88.203.3,62.197.111.140
# The secondary network interface for local network
auto eth0
iface eth0 inet static
address 192.168.0.201
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.0.255
dns-nameservers 192.168.1.254
我还更改了文件 /etc/dhcp/dhclient.conf 并添加了以下行:
supersede routers 192.168.1.1
如果我跑
ping 8.8.8.8
有用
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=43 time=20.5 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=43 time=18.2 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=43 time=18.5 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=43 time=21.9 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 18.238/19.803/21.928/1.523 ms
但是当我运行 sudo apt-get update 时它不起作用:
W: Failed to fetch http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu/dists/precise/main/i18n/Translation-en Something wicked happened resolving 'ppa.launchpad.net:http' (-5 - No address associated with hostname)
我能做些什么 ?
提前致谢。
答案1
没关系,
我修改了文件 /etc/network/interfaces
# The primary network interface for Internet
auto eth1
iface eth1 inet dhcp
现在可以了