오리뎅이의 네떡세상

[오리뎅이의 라우팅 이야기 - 2] Connected - IP 네트워킹, 라우팅의 시작 - 2/3

오리뎅이의 라우팅 테이블 훔쳐보기

 

안녕하세요? 오리뎅이입니다.

 

Connected 이야기 전편에 이어 계속 이어집니다. 

 

"대상 네트워크에 연결할 수 없습니다" vs "대상 호스트에 연결할 수 없습니다"

 

("Destiantion net unreachable" vs "Destination host unreachable")

Test를 위해서 Router2의 10.10.11.0/24 LAN에 연결된 interface Gi0/1을 shut down 하고, PC0에서 PC0(1)로 ping을 수행해 보겠습니다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
### Router2에서 Gi0/1 shutdown ###
 
Router#config terminal
Enter configuration commands, one per line.  End with CNTL/Z.
 
Router2(config)#int gigabitEthernet 0/1
Router2(config-if)#shutdwon
Router2(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to administratively down
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down
 
--------------------------------------------------------------------------------------------
 
 
C:\>ping 10.10.11.2
 
Pinging 10.10.11.2 with 32 bytes of data:
 
Request timed out.
Reply from 10.10.10.1: Destination host unreachable.
Reply from 10.10.10.1: Destination host unreachable.
Reply from 10.10.10.1: Destination host unreachable.
 
Ping statistics for 10.10.11.2:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
 
### 한글 Windows PC에서 시험한 결과 ###
C:\Users\user>ping 192.168.36.2
 
Ping 192.168.36.2 32바이트 데이터 사용:
192.168.35.1의 응답: 대상 호스트에 연결할 수 없습니다.
192.168.35.1의 응답: 대상 호스트에 연결할 수 없습니다.
192.168.35.1의 응답: 대상 호스트에 연결할 수 없습니다.
192.168.35.1의 응답: 대상 호스트에 연결할 수 없습니다.
 
192.168.36.2에 대한 Ping 통계:
    패킷: 보냄 = 4, 받음 = 4, 손실 = 0 (0% 손실),
cs

참조19 : 직접 연결된 network의 host로 메시지를 전달할 수 없는 상황일 때는 host unreachable

 

Connnected직접 연결을 계속해서 반복적으로 얘기하고자 했던 또 한가지 이유입니다. 직접 연결된 네트워크의 host로 메시지를 전달할 수 없는 상황일 때, 라우터 또는 라우팅을 수행하는 장비에서는 "Destination host unreachable" ICMP error를 보냅니다. ICMP 응답 메시지를 보면, 앞부분에 누구로부터 수신된 메시지인지 출처를 찍어줍니다. 참조19에서는 영문 출력의 경우 "Reply from 10.10.10.1" 또는 한글 출력의 경우는 "192.168.35.1의 응답"으로와 같이 이 ICMP error 메시지를 보낸 라우터의 IP가 출력됩니다. "Destination host unreachable" 또는 "대상 호스트에 연결할 수 없습니다"라는 메시지가 출력된다면, 이는 ping의 목적지가 그 ICMP 에러 메시지를 보낸 라우터에게 직접 연결된 host였지만, 패킷을 직접 전달할 수 없는 상황이기때문에 ICMP error를 보내 준 것입니다.

 

Connected가 라우팅 테이블에서 사라졌다

참조15에서는 10.10.11.2로 ping을 했을 때, "Destination host unreachable"이 아닌, "Request timed out" 에러가 발생했었습니다. 무엇이 달랐을까요? Interface shutdown을 하기 전에는 Routing Table에 "Connected"가 있었고, ARP resolution도 정상적으로 수행되어 ICMP 메시지를 PC0(1)로 forwarding 할 수 있는 상황이었습니다. 그래서 정상적으로  메시지를 forwarding 하였고, ICMP error를 발생시킬 상황이 아니었습니다. Interface를 shutdown 한 후에는 아래 참조20과 같이 10.10.11.0/24 네트워크로 연결된 Connected와 Local이 라우팅 테이블에서 삭제 되었습니다. Interface가 down 되어 routing lookup이 안되므로 메시지를 forwarding 할 수 없는 상황입니다. 직접 연결 된 host인데, 메시지를 forwarding 할 수 없는 상황이기 때문에 라우터가 ICMP 에러를 보냅니다. 이 때 직접 연결된 host라는 것을 알려 주기 위해서 "Destination net unreachable"이 아닌 "Destination host unreachable"을 보냅니다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Router>show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
 
Gateway of last resort is not set
 
     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       10.10.10.0/30 is directly connected, GigabitEthernet0/0
L       10.10.10.1/32 is directly connected, GigabitEthernet0/0
cs

참조20 : 직접 연결된 네트워크에 있는 host로 메시지를 전달할 수 없는 상황1

 

황당 퀴즈Connected routing 엔트리가 routing table에서 사라지는 직 하나의 경우는?

              정답) 유일무이(唯一無二) 수신 인터페이스가 down 된 경우 밖에 없습니다요.

 

직접 연결된 상대방에게 메시지를 전달할 수 없는 상황이 한가지 더 있습니다. 라우터의 Interface가 Up 상태이더라도 ARP resolution이 안되는 상황이 또 다른 직접 전달할 수 없는 상황2 입니다. 패킷 트레이서에서는 이 상황은 재현이 안되네요. Router에서 직접 연결된 host로 ARP resolution이 안되는 그림4와 같은 상황도 Router2에서 메시지를 직접 전달할 수 없는 상황입니다. 

 

그림4. 라우터에서 다운으로 감지되지 않는 Remote 인터페이스 다운 경우

실제 상황에서는 그림4와 같이 Router2와 Switch0(1) 사이의 link는 정상적으로 Up 상황이지만, Switch0(1)과 PC0(1)사이가 Down된 상황에서도 PC0에서 PC0(1)로 ping을 수행하는 경우, "Destination host unreachable" ICMP error가 Router2에서 생성되어 PC0로 보내 집니다. 단, Router2에 PC0(1)에 대한 ARP Resolution이 되어 있지 않은 상황일 때만 그렇습니다. Switch0(1)과 PC0(1)사이가 Down 되기 이전에 학습된 PC0(1)에 ARP 엔트리가 Router2에 남아 있는 상황이라면, Router2는 그 MAC address를 이용해서 ICMP ping request 메시지를 forwarding 해 버릴 것이기 때문에 Route2에서는 ICMP error가 발생하지 않습니다. 이 경우에 PC0에서는 "Request timed out"이 발생합니다.

 

 

Connected host가 unreachable 상태일 때, "Destination host unreachable" 를 보내 주는 것이 순리 

"Destination host unreachable" ICMP error가 발생하는 것은 router에서 뿐만 아니라 모든 IP 장비에서 동일하게 발생할 수 있습니다. 모든 IP 장비에서 직접 연결된, 즉, Connected 된 네트워크의 상대 host로 메시지를 직접 전달할 수 없는 2가지 상황일 때, "Destination host unreachable" 이 발생합니다.

 

메시지를 직접 전달할 수 없는 2가지 상황이란?

    1) Routing table에 엔트리가 없는 경우 (인터페이스가 down 되었거나, route 엔트리가 등록 안된 경우)

    2) nexthop IP에 대해 ARP resolution이 안되는 경우

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
C:\Users\user>ipconfig /all
   ... 중략 ...
   IPv4 주소 . . . . . . . . . : 192.168.35.120(기본 설정)
   서브넷 마스크 . . . . . . . : 255.255.255.0
   임대 시작 날짜. . . . . . . : 2020년 12월 1일 화요일 오후 4:11:03
   임대 만료 날짜. . . . . . . : 2020년 12월 1일 화요일 오후 7:11:02
   기본 게이트웨이 . . . . . . : 192.168.35.1
   DHCP 서버 . . . . . . . . . : 192.168.35.1
   ... 중략 ...
 
C:\Users\user>ping 192.168.35.2
 
Ping 192.168.35.2 32바이트 데이터 사용:
192.168.35.120의 응답: 대상 호스트에 연결할 수 없습니다.
192.168.35.120의 응답: 대상 호스트에 연결할 수 없습니다.
192.168.35.120의 응답: 대상 호스트에 연결할 수 없습니다.
192.168.35.120의 응답: 대상 호스트에 연결할 수 없습니다.
 
192.168.35.2에 대한 Ping 통계:
    패킷: 보냄 = 4, 받음 = 4, 손실 = 0 (0% 손실)
cs

참조21 : 오리뎅이 집 PC에서 존재하지 않는 host에 ping을 날려 봤씨유

 

1
2
3
4
5
6
7
8
9
10
root@k1-monster01:~# ifconfig ens1f0
ens1f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.31.1.24  netmask 255.255.255.0  broadcast 172.31.1.255
 
root@k1-monster01:~# ping 172.31.1.253
PING 172.31.1.253 (172.31.1.25356(84) bytes of data.
From 172.31.1.24 icmp_seq=1 Destination Host Unreachable
From 172.31.1.24 icmp_seq=2 Destination Host Unreachable
From 172.31.1.24 icmp_seq=3 Destination Host Unreachable
From 172.31.1.24 icmp_seq=4 Destination Host Unreachable
cs

참조22 : 오리뎅이 linux 머신에서도 존재하지 않는 host에 ping을 날려 봤슈

 

참조21, 참조22와 같이 Windows와 Linux host에서도 connected로 직접 연결된 범위에 속하는 존재하지 않는 IP로 ping을 보내면, host 자기 자신의 IP layer에서 "대상 호스트에 연결할 수 없습니다." 또는 "Destination Hsot Unreachable" 에러를 발생 시킵니다.

 

패킷트레이서에서는 "Destination net unreachable"은 발생시킬 수가 없던 것이었다

지금껏 "Destination host unreachable"에 case에 대해서 이야기 하였기에, 이제는 "Destination net unreachable"이 언제 발생하는가를 알아볼 차례입니다. 그래서 패킷크레이서에서 아래와 그림5와 같은 구성을 만들었습니다.

 

그림5. "Destination net unreachable" 확인을 위해 만들어 본 구성

 

우선 PC1에서 Server1으로 ping이 되도록 static 라우팅 설정을 해줍니다. "사랑에는 일방통행이 있을지라도, 라우팅에는 일방통행이란 없다" 당연한거 아임까?  PC1과 Server1이 서로 통신이 되도록 하려면, 쌍방통해이 되도록 가는 길, 오는 길을 각각 모두 뚫어 주어야 합니다.  가는길은 PC1, Router4, Router5에 각각 static routing 설정을 해 주어야 합니다. Router6는 스태틱 라우틸 설정 안하나요? 이제는 이런 질문 하면 안됩니다. 마지막 hop 라우터는 host와 Connected 라서 따로 routing 설정을 안해도 된다는 사실을 이제 우리는 모두 알고 있습니다. 가는길을 설정 했으면, 오는 길도 설정합니다. Server1, Router6, Router5에 static route 설정을 합니다. Router4는 당근 PC1과 Connected이므로 라우팅 설정 불필요임돠. 자 이렇게 가는 길, 오는 길 쌍방을 뚫었습니다. Ping 이 잘 가겠지요? 네, 잘 갑니다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
C:\>ipconfig /all
 
FastEthernet0 Connection:(default port)
 
   Connection-specific DNS Suffix..: 
   Physical Address................: 0060.70A6.4230
   Link-local IPv6 Address.........: FE80::260:70FF:FEA6:4230
   IP Address......................: 10.10.10.2
   Subnet Mask.....................: 255.255.255.0
   Default Gateway.................: 10.10.10.1
   DNS Servers.....................: 0.0.0.0
   DHCP Servers....................: 0.0.0.0
   DHCPv6 Client DUID..............: 00-01-00-01-0E-A5-62-A3-00-60-70-A6-42-30
 
Bluetooth Connection:
 
   Connection-specific DNS Suffix..: 
   Physical Address................: 0040.0B31.61B2
   Link-local IPv6 Address.........: ::
   IP Address......................: 0.0.0.0
   Subnet Mask.....................: 0.0.0.0
   Default Gateway.................: 0.0.0.0
   DNS Servers.....................: 0.0.0.0
   DHCP Servers....................: 0.0.0.0
   DHCPv6 Client DUID..............: 00-01-00-01-0E-A5-62-A3-00-60-70-A6-42-30
 
 
C:\>ping 10.10.13.2
 
Pinging 10.10.13.2 with 32 bytes of data:
 
Reply from 10.10.13.2: bytes=32 time=1ms TTL=125
Reply from 10.10.13.2: bytes=32 time<1ms TTL=125
Reply from 10.10.13.2: bytes=32 time=1ms TTL=125
Reply from 10.10.13.2: bytes=32 time<1ms TTL=125
 
Ping statistics for 10.10.13.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms
cs

참조23 : PC1과 Server1이 ping 잘되니 쌍방 라우팅 잘 설정 했다는 거

 

먼저 Router6에서 Server connected 인터페이스를 shutdown 하고, ping을 다시 날려 봤습니다. 뭐가 돌아 왔을까요?

 

그림6. Router6에서 Server 인터페이스를 shutdown 했3

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
C:\>ping 10.10.13.2
 
Pinging 10.10.13.2 with 32 bytes of data:
 
Request timed out.
Request timed out.
Reply from 10.10.12.2: Destination host unreachable.
Reply from 10.10.12.2: Destination host unreachable.
 
Ping statistics for 10.10.13.2:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
 
C:\>ping 10.10.13.2
 
Pinging 10.10.13.2 with 32 bytes of data:
 
Reply from 10.10.12.2: Destination host unreachable.
Reply from 10.10.12.2: Destination host unreachable.
Reply from 10.10.12.2: Destination host unreachable.
Reply from 10.10.12.2: Destination host unreachable.
 
Ping statistics for 10.10.13.2:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
cs

참조24 : Router6(10.10.12.2)에서 Destination host unreachable이 잘 오는군요 

 

그럼 이제 다음 수순은 무엇일까요? 이번에 다음 구간을 shutdown 하고 ping을 다시 날려 보았습니다.

 

그림7. Router5에서 "Destination net unreachable"이 올 것으로 예상되는 상황 

 

Router5에서는 10.10.13.0/24 네트워크가 connected된 네트워크가 아닙니다. 그러니, 여기서는 당연히 "Destination net unreachable" ICMP error가 돌아올 상황입니다. 그런디... "니가 거기서 왜나와?"  딱, 이럴때 쓰는 말인듯 하네요. ㅎ

 

1
2
3
4
5
6
7
8
9
10
11
C:\>ping 10.10.13.2
 
Pinging 10.10.13.2 with 32 bytes of data:
 
Reply from 10.10.11.2: Destination host unreachable.
Reply from 10.10.11.2: Destination host unreachable.
Reply from 10.10.11.2: Destination host unreachable.
Reply from 10.10.11.2: Destination host unreachable.
 
Ping statistics for 10.10.13.2:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
cs

참조25 : 예상을 깨고, Router5(10.10.11.2)는 Destination host unreachable을 보낸 것이었다

 

이 후에 Router4 인터페이스를 shutdown 시킨 경우에도 동일하게 Router4가 "Destination host unreachable" 보냈습니다. 이것은 제가 현장에서 경험했던 상황과는 다른 결과입니다. 아래 RFC 1812에 기술되어 있는 내용을 보더라도, 실제 라우팅 장비에서는 저런 상황에서는 "Destination net unreachable" ICMP error를 보내 주어야 합니다.  

RFC 1812, pages 56 and 57:

If a router cannot forward a packet because it has no routes at all (including no default route)
to the destination specified in the packet, then the router MUST generate a Destination Unreachable, 
Code 0 (Network Unreachable) ICMP message. 

If a packet is to be forwarded to a host on a network that is directly connected to the router (i.e.,
the router is the last-hop router) and the router has ascertained that there is no path to the destination 
host then the router MUST generate a Destination Unreachable, Code 1 (Host Unreachable) ICMP message.

 참조26 : RFC 1812에서 정의하고 있는 Network Unreachable과 Host Unreachable

 

현장에서 "Destination host unreachable"을 수신하게 된다면, ICMP error를 보낸 라우팅 hop이 라스트 hop이고, 해당 라스트 hop에서 직접 연결된 host로 forwarding 할 수 없는 상황으로 파악하고, 트러블슈팅을 진행하면 됩니다.

 

반면에 "Destination net unreachable"을 수신하게 된다면, 라스트 hop이 아닌 중간 경로에 있는 어느 라우팅 노드에서 다음 라우팅 hop으로 forwarding 할 수 없는 상황으로 판단할 수 있습니다.

 

[오리뎅이의 라우팅 이야기 - 1] Connected - IP 네트워킹, 라우팅의 시작 - 3/3 편으로 이어집니다.

 

                                                                         2020년 12월 6일 일요일 저녁 수원에서 뒤뚱뒤뚱~~~~  [오리]