0
点赞
收藏
分享

微信扫一扫

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


 

举报

相关推荐

0 条评论