Ubuntu - ping: connect: Network is unreachable
설치해 둔 Ubuntu 24.04 LTS에서 외부 접속이 안 됩니다. ^^;
$ ping www.naver.com
ping: connect: Network is unreachable
또 DNS 서버 설정이 풀렸나 싶었더니... 그건 또 아닙니다.
$ resolvectl status
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Current DNS Server: 8.8.8.8
DNS Servers: 8.8.8.8
...[생략]...
그러니까, IP를 직접 찍어도 연결이 안 됩니다.
$ ping 23.212.12.248
ping: connect: Network is unreachable
보니까, 라우팅 테이블이 꽤나 한산합니다. ^^;
$ ip route
192.168.100.0/24 dev eth0 proto kernel scope link src 192.168.100.50
$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.100.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
보통은 아래에서처럼 "default via ..." 같은 게 있어야 하는데,
// 정상적인 경우였다면,
$ ip route
default via 192.168.100.1 dev eth1 proto static metric 100
192.168.100.0/24 dev eth1 proto kernel scope link src 192.168.100.25 metric 100
...[생략]...
$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.100.1 0.0.0.0 UG 0 0 0 eth1
...[생략]...
그게 없는 것입니다. 즉, 오로지 192.168.100.x 대역의 IP에 대해서만 eth0 인터페이스를 통해 접속이 되고 있는 것입니다. 따라서 default gateway 설정만 추가하면,
$ sudo ip route add default via 192.168.100.1 dev eth0
이후 정상적으로 ping이 됩니다.
$ ping www.microsoft.com
PING e13678.dscb.akamaiedge.net (23.40.45.184) 56(84) bytes of data.
64 bytes from a23-40-45-184.deploy.static.akamaitechnologies.com (23.40.45.184): icmp_seq=1 ttl=54 time=3.29 ms
64 bytes from a23-40-45-184.deploy.static.akamaitechnologies.com (23.40.45.184): icmp_seq=2 ttl=54 time=3.08 ms
...[생략]...
[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]