IP 주소가 유효하고 사용 가능한지 테스트하는 연결 가능성 클래스를 프로그래밍하고 있습니다. 내 수업이 제대로 작동하는지 테스트하기 위해 단위 테스트를 작성했는데 그런 일이 일어났습니다. 내 네트워크에서 연결할 수 없는 것으로 생각되는 IP 주소 192.168.1.255로 테스트했지만 IsReachable = true를 얻었습니다. 허... 이게 어떻게 가능하지?
좋아, 기준선이 생겼어. Windows와 함께 제공되는 'ping' 애플리케이션을 사용할 수 있습니다. 그 테스트 결과는 이렇습니다
# ping 192.168.1.255
Pinging 192.168.1.255 with 32 bytes of data:
Reply from 192.168.1.200: bytes=32 time<1ms TTL=64
Reply from 192.168.1.200: bytes=32 time<1ms TTL=64
Reply from 192.168.1.200: bytes=32 time<1ms TTL=64
Reply from 192.168.1.200: bytes=32 time=1ms TTL=64
Ping statistics for 192.168.1.255:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
더욱 이상해지네요
# ping 192.168.1.253
Pinging 192.168.1.253 with 32 bytes of data:
Reply from 192.168.1.27: Destination host unreachable.
Reply from 192.168.1.25: Destination host unreachable.
Reply from 137.224.244.1: Destination net unreachable.
Reply from 137.224.244.1: Destination net unreachable.
Ping statistics for 192.168.1.253:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
여기서 무슨 일이 일어나고 있는 걸까요? 이 결과가 무엇을 의미하는지 누군가 나에게 설명해 줄 수 있습니까?
추가된 IPCONFIG 편집
ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : DESKTOP-CB16LLI
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : wurnet.nl
home
Ethernet adapter Ethernet 3:
Connection-specific DNS Suffix . : wurnet.nl
Description . . . . . . . . . . . : NCP Secure Client Virtual NDIS6 Adapter
Physical Address. . . . . . . . . : 02-00-AD-4F-70-18
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 137.224.245.97(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : vrijdag 30 maart 2018 08:20:26
Lease Expires . . . . . . . . . . : donderdag 17 mei 2018 21:25:51
Default Gateway . . . . . . . . . :
DHCP Server . . . . . . . . . . . : 137.224.245.98
DNS Servers . . . . . . . . . . . : 10.90.3.31
10.91.3.31
NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter Ethernet 1:
Connection-specific DNS Suffix . : home
Description . . . . . . . . . . . : Surface Ethernet Adapter
Physical Address. . . . . . . . . : C4-9D-ED-E8-5D-1E
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 192.168.1.27(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : vrijdag 30 maart 2018 08:12:39
Lease Expires . . . . . . . . . . : zaterdag 31 maart 2018 08:12:50
Default Gateway . . . . . . . . . : 192.168.1.254
DHCP Server . . . . . . . . . . . : 192.168.1.254
DNS Servers . . . . . . . . . . . : 192.168.1.254
NetBIOS over Tcpip. . . . . . . . : Enabled
Wireless LAN adapter Local Area Connection* 1:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
Physical Address. . . . . . . . . : BE-83-85-E7-C5-48
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Ethernet adapter Bluetooth Network Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
Physical Address. . . . . . . . . : BC-83-85-E7-C4-4A
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Wireless LAN adapter Wi-Fi:
Connection-specific DNS Suffix . : home
Description . . . . . . . . . . . : Marvell AVASTAR Wireless-AC Network Controller
Physical Address. . . . . . . . . : BC-83-85-E7-C4-49
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::49ca:6fd:8fa4:a099%3(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.1.25(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : vrijdag 30 maart 2018 08:12:49
Lease Expires . . . . . . . . . . : zaterdag 31 maart 2018 08:13:08
Default Gateway . . . . . . . . . : 192.168.1.254
DHCP Server . . . . . . . . . . . : 192.168.1.254
DHCPv6 IAID . . . . . . . . . . . : 79463301
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-22-4C-14-89-C4-9D-ED-E8-5D-1E
DNS Servers . . . . . . . . . . . : fe80::2aff:3eff:fe3d:f5%3
192.168.1.254
NetBIOS over Tcpip. . . . . . . . : Enabled
Tunnel adapter Local Area Connection* 11:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft Teredo Tunneling Adapter
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
편집 위의 핑은 VPN 연결이 열려 있는 상태에서 발생했습니다. 아래는 VPN 연결이 종료된 상태입니다.
ping 192.168.1.253
Pinging 192.168.1.253 with 32 bytes of data:
Reply from 192.168.1.27: Destination host unreachable.
Reply from 192.168.1.27: Destination host unreachable.
Reply from 192.168.1.27: Destination host unreachable.
Reply from 192.168.1.27: Destination host unreachable.
답변1
0
255
255.255.255.0 서브넷 네트워크에서 시스템을 가질 수 있는 유효한 주소가 아닙니다 .
255는 "브로드캐스트" 주소이고 0은 "네트워크 주소"입니다.
관련 독서IP 주소가 0이나 255로 시작할 수 없는 이유는 무엇입니까?. 대답은 넓은 IP 주소의 광범위한 사례를 다루지만 규칙은 서브넷 주소에도 적용되므로 255.255.255.0 서브넷의 경우 첫 번째와 마지막 IP가 예약됩니다.
... 의 핑과 관련하여 .253
첫 번째 핑에서는 본질적으로 모든 네트워크 어댑터에 호스트에 대한 경로가 있는지 묻는 것입니다.
두 가지 사례에서 그들은 Destination host unreachable.
본질적으로 "여기에 있었다면 알려드렸겠지만 어떤 이유로든 연결할 수 없습니다"라고 대답했습니다.
더 이상한 것은 VPN 네트워크 게이트웨이인데, 대신 Destination net unreachable.
이 경우 서브넷 및 기타 요인으로 인해 통신할 수 있는 방법이 전혀 없다고 말합니다.어느그 네트워크에 기계가 있습니다.
귀하의 최종 핑은 제가 기대했던 것과 비슷합니다. 로컬 네트워크 어댑터에서 해당 주소에 연결할 수 없다는 메시지만 표시됩니다.
답변2
ICMP 프로토콜은 IPv4 위에서 직접 작동합니다(이 경우). 유니캐스트 UDP 또는 TCP와는 다른 라우팅 규칙이 있습니다. 기본적으로 ICMP 패킷을 본 모든 호스트는 응답할 수 있습니다(심지어 거짓말도 가능).
따라서 수신된 패킷 수에는 목적지의 응답만 표시되는 것이 아닙니다.