ipv4和ipv6連通性相關工具實例

前言

方便以後相關數據查詢需求,本人未設置過相關劃分子網,子網掩碼,網關,路由表等,因此篇僅是相關工具測驗實例。針對平臺linux和win,文中涉及的ip是我瞎寫的。具體實驗請根據需求更改。

搜索的話,基本都是域名爲主 ,有純ipv4,純ipv6 ,兼容ipv4的ipv6,目前沒有相關ipv6的外部設備,因此可以測試出一些異常情況。

摘要

路由表 環回測試 連通性 ipv6 route  ping6

路由表

Linux

搜索的時候看到有別人指出netstat已廢棄,因此多增加了另外兩個展示

route -n
route -A inet -n
route -A inet6 -n
netstat -r 
netstat -4 -r 
netstat -6 -r
ip  route
ip -4 route 
ip -6 route

win

route print 
route print -4
route print -6
#接口列表
##接口編號..對應MAC......適配器名稱
#路由表
##活動路由
###網絡目標  網絡掩碼  網關  接口  躍點數
###永久路由

路由連通性測試

Linux

ip地址僅是樣例,具體根據實際修改

#ipv4
traceroute --sport=8080   192.168.1.1
#ipv6
#環回測試
traceroute -6    ::1
#局域網
traceroute --sport=20005   fe80::8932:747c:41a8:a745%eth0
traceroute6 --sport=20005   fe80::8932:747c:41a8:a745%eth0
traceroute -6 --sport=20005   fe80::8932:747c:41a8:a745%eth0

win

幫助 tracert /?

#ipv4
tracert -4 192.168.1.1
#ipv4
#環回測試
tracert -6 ::1 
#局域網
tracert -6  fe80::8932:747c:41a8:a745%19

ipv6連通性測試[允許ping的時候]

icmp協議

假如要測試ipv4直接ping ip即可

win:ping -6 ip

linux:ping6  ip

環回測試

當相關機器不支持的時候,作爲作爲客戶端[C程序],會有不支持協議的錯誤返回

#linux
ping6 ::1

異常:

socket: Address family not supported by protocol

正常:

PING ::1(::1) 56 data bytes

64 bytes from ::1: icmp_seq=1 ttl=64 time=0.032 ms

64 bytes from ::1: icmp_seq=2 ttl=64 time=0.064 ms

64 bytes from ::1: icmp_seq=3 ttl=64 time=0.084 ms

^C

--- ::1 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 2000ms

rtt min/avg/max/mdev = 0.032/0.060/0.084/0.021 ms

 

#win
ping -6 ::1

 

>正在 Ping ::1 具有 32 字節的數據:

>來自 ::1 的回覆: 時間<1ms

>來自 ::1 的回覆: 時間<1ms

>來自 ::1 的回覆: 時間<1ms

>::1 的 Ping 統計信息:

> 數據包: 已發送 = 3,已接收 = 3,丟失 = 0 (0% 丟失),

>往返行程的估計時間(以毫秒爲單位):

> 最短 = 0ms,最長 = 0ms,平均 = 0ms

>Control-C

局域網內雙機互測,也可本機測試

接口eth0通過win[ipconfig查看]linux[通過ifconfig或ip addr show查看] 、

fe80...%eth0

待ping對方的ip[fe80::f816:3eff:fe49:a745] 樣例

#Linux
ping6 fe80::8932:3eff:fe49:a745%eth0

>異常

>PING fe80::8932:3eff:fe49:a745%eth0(fe80::8932:3eff:fe49:a745) 56 data bytes

>From fe80::20fc:29ff:feeb:a745 icmp_seq=2 Destination unreachable: Address unreachable

>From fe80::20fc:29ff:feeb:a745 icmp_seq=3 Destination unreachable: Address unreachable

>From fe80::20fc:29ff:feeb:a745 icmp_seq=4 Destination unreachable: Address unreachable

>^C

>--- fe80::8932:3eff:fe49:a745%eth0 ping statistics ---

>5 packets transmitted, 0 received, +3 errors, 100% packet loss, time 4605ms

#win
ping -6 fe80::f816:3eff:fe49:a745%16

>異常

>正在 Ping fe80::f816:3eff:fe49:50c6%16 具有 32 字節的數據:

>無法訪問目標主機。

>fe80::f816:3eff:fe49:50c6%16 的 Ping 統計信息:

> 數據包: 已發送 = 1,已接收 = 0,丟失 = 1 (100% 丟失),

>Control-C

與公網ipv6測試

這裏使用的域名,無相關公網ip,因此涉及到後面的DNS解析,這裏僅僅給出了異常的。如果有具體公網ip可以直接替換

#Linux
ping6 ipv6.baidu.com

>異常

>ping: ipv6.baidu.com: 未知的名稱或服務

​#win
ping -6  ipv6.baidu.com

>異常

>Ping 請求找不到主機 ipv6.baidu.com。請檢查該名稱,然後重試。

DNS測試

我是碼C的,一般直接使用IP地址,目前該項暫無影響。

#採取用交互性命令查看dns的當前的信息
win/Linux:nslookup - ip
>set all #鍵入set all回車
>exit #鍵入exit回車退出

#win/Linux 查看默認DNS服務器
nslookup localhost 
#win/Linux
nslookup ipv6.baidu.com

>Server: 192.168.16.2

>Address: 192.168.16.2#53

>Non-authoritative answer:

>ipv6.baidu.com canonical name = www.a.shifen.com.

>Name: www.a.shifen.com

>Address: 182.61.200.7

>Name: www.a.shifen.com

>Address: 182.61.200.6

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章