Microsoft MVP성태의 닷넷 이야기
오류 유형: 966. Ubuntu - ping: connect: Network is unreachable [링크 복사], [링크+제목 복사],
조회: 2155
글쓴 사람
정성태 (seongtaejeong at gmail.com)
홈페이지
첨부 파일
 

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

// (2025-07-08 업데이트) 위의 명령어로 인한 변화는 재부팅 후 사라집니다.
// How to add persistent IP routes in Ubuntu 20.04 server
// ; https://askubuntu.com/questions/1345376/how-to-add-persistent-ip-routes-in-ubuntu-20-04-server 
// 1. edit config file in /etc/netplan
//    routes:
//    - to: default
//      via: 192.168.100.1
// 2. sudo netplan generate
// 3. sudo netplan apply

이후 정상적으로 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
...[생략]...




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 7/8/2025]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




1  2  3  4  5  6  7  [8]  9  10  11  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
13825정성태11/21/20249196Linux: 110. eBPF / bpf2go - BPF_RINGBUF_OUTPUT / BPF_MAP_TYPE_RINGBUF 사용법
13824정성태11/20/20246396Linux: 109. eBPF / bpf2go - BPF_PERF_OUTPUT / BPF_MAP_TYPE_PERF_EVENT_ARRAY 사용법
13823정성태11/20/20248484개발 환경 구성: 734. Ubuntu에 docker, kubernetes (k3s) 설치
13822정성태11/20/20248497개발 환경 구성: 733. Windbg - VirtualBox VM의 커널 디버거 연결 시 COM 포트가 없는 경우
13821정성태11/18/20247787Linux: 108. Linux와 Windows의 프로세스/스레드 ID 관리 방식
13820정성태11/18/20248698VS.NET IDE: 195. Visual C++ - C# 프로젝트처럼 CopyToOutputDirectory 항목을 추가하는 방법
13819정성태11/15/20246135Linux: 107. eBPF - libbpf CO-RE의 CONFIG_DEBUG_INFO_BTF 빌드 여부에 대한 의존성
13818정성태11/15/20248740Windows: 272. Windows 11 24H2 - sudo 추가 [1]
13817정성태11/14/20247222Linux: 106. eBPF / bpf2go - (BPF_MAP_TYPE_HASH) Map을 이용한 전역 변수 구현
13816정성태11/14/20248809닷넷: 2312. C#, C++ - Windows / Linux 환경의 Thread Name 설정파일 다운로드1
13815정성태11/13/20246633Linux: 105. eBPF - bpf2go에서 전역 변수 설정 방법
13814정성태11/13/20247518닷넷: 2311. C# - Windows / Linux 환경에서 Native Thread ID 가져오기파일 다운로드1
13813정성태11/12/20248651닷넷: 2310. .NET의 Rune 타입과 emoji 표현파일 다운로드1
13812정성태11/11/202412327오류 유형: 933. Active Directory - The forest functional level is not supported.
13811정성태11/11/20247203Linux: 104. Linux - COLUMNS 환경변수가 언제나 80으로 설정되는 환경
13810정성태11/10/20248877Linux: 103. eBPF (bpf2go) - Tracepoint를 이용한 트레이스 (BPF_PROG_TYPE_TRACEPOINT)
13809정성태11/10/20248040Windows: 271. 윈도우 서버 2025 마이그레이션
13808정성태11/9/20248761오류 유형: 932. Linux - 커널 업그레이드 후 "error: bad shim signature" 오류 발생
13807정성태11/9/20246658Linux: 102. Linux - 커널 이미지 파일 서명 (Ubuntu 환경)
13806정성태11/8/20247022Windows: 270. 어댑터 상세 정보(Network Connection Details) 창의 내용이 비어 있는 경우
13805정성태11/8/20246440오류 유형: 931. Active Directory의 adprep 또는 복제가 안 되는 경우
13804정성태11/7/20248917Linux: 101. eBPF 함수의 인자를 다루는 방법
13803정성태11/7/20248130닷넷: 2309. C# - .NET Core에서 바뀐 DateTime.Ticks의 정밀도
13802정성태11/6/20248576Windows: 269. GetSystemTimeAsFileTime과 GetSystemTimePreciseAsFileTime의 차이점파일 다운로드1
13801정성태11/5/20248454Linux: 100. eBPF의 2가지 방식 - libbcc와 libbpf(CO-RE)
13800정성태11/3/20249405닷넷: 2308. C# - ICU 라이브러리를 활용한 문자열의 대소문자 변환 [2]파일 다운로드1
1  2  3  4  5  6  7  [8]  9  10  11  12  13  14  15  ...