![우분투 서버 12.04.01에 인터넷이 없습니다](https://rvso.com/image/1126817/%EC%9A%B0%EB%B6%84%ED%88%AC%20%EC%84%9C%EB%B2%84%2012.04.01%EC%97%90%20%EC%9D%B8%ED%84%B0%EB%84%B7%EC%9D%B4%20%EC%97%86%EC%8A%B5%EB%8B%88%EB%8B%A4.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을 핑할 수 없습니다.
답변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