![ubuntuサーバー12.04.01にインターネットがありません](https://rvso.com/image/1126817/ubuntu%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC12.04.01%E3%81%AB%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%BC%E3%83%8D%E3%83%83%E3%83%88%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%9B%E3%82%93.png)
GUI はインストールされていません。以下は私のサーバーに関する有用な情報です。
$ cat /etc/network/interfaces
# The loopback network interface. I disabled this one.
#auto lo
#iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.4.20
netmask 255.255.255.0
gateway 192.168.4.1
broadcast 192.168.4.255
$ cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 4.2.2.2
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.4.1 0.0.0.0 UG 0 0 0 eth0
192.168.4.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
$ ifconfig -a
eth0 Link encamp:Ethernet HWaddr 04:06:ff:aa22:33
inet addr:192.168.4.20 Bcast:192.168.4.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueueln:1000
RX Bytes:684 (684.0 B) TX bytes:600 (600.0 B)]
lo Link encamp:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOBACK RUNNING MTU:65536 Metric:1
RX packets:48 errors:0 dropped:0 overruns:0 frame:0
TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueueln:0
RX Bytes:4336 (4.3 KB) TX bytes:4336 (4.3 KB)
できる限りのことを試しましたが、Google の DNS や URL に ping できません。
答え1
まず、ループバック インターフェイスは必須であり、削除してはいけません。/etc/network/interfaces
ファイルを次のように修正することをお勧めします。
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.4.20
netmask 255.255.255.0
gateway 192.168.4.1
dns-nameservers 8.8.8.8 4.2.2.2
修正したファイルをシステムに再度読み込ませて使用します。
sudo ifdown -a && sudo ifup -a
テスト:
ping -c3 www.ubuntu.com