首页 > 其他 > 详细

IPv6杂项

时间:2020-02-17 19:17:09      阅读:60      评论:0      收藏:0      [点我收藏+]

ping

通过本地enp0s3端口ping服务器:fe80::52dd:be1d:173f:a6d5
[root@CentOS7-1 ~]# ping6 fe80::52dd:be1d:173f:a6d5 -I enp0s3
PING fe80::52dd:be1d:173f:a6d5(fe80::52dd:be1d:173f:a6d5) from fe80::3bfd:2d4f:9b51:98d9%enp0s3 enp0s3: 56 data bytes
64 bytes from fe80::52dd:be1d:173f:a6d5%enp0s3: icmp_seq=1 ttl=64 time=0.521 ms
64 bytes from fe80::52dd:be1d:173f:a6d5%enp0s3: icmp_seq=2 ttl=64 time=0.495 ms
^Z
[1]+ 已停止 ping6 fe80::52dd:be1d:173f:a6d5 -I enp0s3
 
[root@CentOS7-1 ~]# ping6 -c 2 fe80::52dd:be1d:173f:a6d5 -I enp0s3
PING fe80::52dd:be1d:173f:a6d5(fe80::52dd:be1d:173f:a6d5) from fe80::3bfd:2d4f:9b51:98d9%enp0s3 enp0s3: 56 data bytes
64 bytes from fe80::52dd:be1d:173f:a6d5%enp0s3: icmp_seq=1 ttl=64 time=0.396 ms
64 bytes from fe80::52dd:be1d:173f:a6d5%enp0s3: icmp_seq=2 ttl=64 time=0.462 ms
--- fe80::52dd:be1d:173f:a6d5 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.396/0.429/0.462/0.033 ms
 
[root@CentOS7-1 ~]# ping -6 -c 2 fe80::52dd:be1d:173f:a6d5 -I enp0s3
PING fe80::52dd:be1d:173f:a6d5(fe80::52dd:be1d:173f:a6d5) from fe80::3bfd:2d4f:9b51:98d9%enp0s3 enp0s3: 56 data bytes
64 bytes from fe80::52dd:be1d:173f:a6d5%enp0s3: icmp_seq=1 ttl=64 time=0.373 ms
64 bytes from fe80::52dd:be1d:173f:a6d5%enp0s3: icmp_seq=2 ttl=64 time=0.427 ms
--- fe80::52dd:be1d:173f:a6d5 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.373/0.400/0.427/0.027 ms
 

ssh

通过本地en0端口ssh服务器:fe80::3bfd:2d4f:9b51:98d9
sunwanglin@iMac ~ $ ssh root@fe80::3bfd:2d4f:9b51:98d9%en0
[root@CentOS7-1 ~]#
 
通过本地enp0s3端口ssh服务器:fe80::3bfd:2d4f:9b51:98d9
[root@centos7-2 ~]# ssh -6 root@fe80::3bfd:2d4f:9b51:98d9%enp0s3
The authenticity of host ‘fe80::3bfd:2d4f:9b51:98d9%enp0s3 (fe80::3bfd:2d4f:9b51:98d9%enp0s3)‘ can‘t be established.
ECDSA key fingerprint is SHA256:v+RIMUxl4HB86Fh1SDnkLOEIBAlg/pfWmTcpg3tvR+w.
ECDSA key fingerprint is MD5:7e:0d:37:cf:cf:f4:2a:86:81:20:7a:e8:70:9a:c6:8b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘fe80::3bfd:2d4f:9b51:98d9%enp0s3‘ (ECDSA) to the list of known hosts.
root@fe80::3bfd:2d4f:9b51:98d9%enp0s3‘s password:
Last login: Thu Feb 13 11:48:03 2020 from 192.168.8.40
[root@CentOS7-1 ~]#
 
telnet
[root@centos7-2 ~]# telnet fe80::3bfd:2d4f:9b51:98d9%enp0s3 22
Trying fe80::3bfd:2d4f:9b51:98d9%enp0s3...
Connected to fe80::3bfd:2d4f:9b51:98d9%enp0s3.
Escape character is ‘^]‘.
SSH-2.0-OpenSSH_7.4
^Z
Connection closed by foreign host.
 
 

tcping & tcptraceroute & traceroute

[root@CentOS7-1 ~]# unzip tcping-master.zip
[root@CentOS7-1 ~]# cd tcping-master
[root@CentOS7-1 tcping-master]# ll
总用量 12
-rw-r--r-- 1 root root 384 8月 10 2018 README.md
-rw-r--r-- 1 root root 5031 8月 10 2018 tcping.c
[root@CentOS7-1 tcping-master]# more README.md
# tcping
Copyright (c) 2002-2008 Marc Kirchner <mail(at)marc(dash)kirchner(dot)de>
Modified by MushrooM93
tcping support ipv4/ipv6 dual-stack in linux,
the operation is similar to ping but it does not use the ICMP protocol.
 
Install:
$gcc tcping.c -o tcping
$cp tcping /usr/bin/
$tcping -v6 ipv6.google.com 80
 
 
Usage:
[-q] [-t timeout_sec] [-u timeout_usec] [-v4|6] <host> <port>
[root@CentOS7-1 tcping-master]# gcc tcping.c -o tcping
[root@CentOS7-1 tcping-master]# ./tcping 192.168.8.200 22
192.168.8.200 port 22 open.
[root@CentOS7-1 tcping-master]# ./tcping -v6 fe80::3bfd:2d4f:9b51:98d9%enp0s3 22
fe80::3bfd:2d4f:9b51:98d9%enp0s3 port 22 open.
[root@CentOS7-1 tcping-master]#
 
[root@centos7-2 ~]# tcptraceroute 192.168.8.200 22
traceroute to 192.168.8.200 (192.168.8.200), 30 hops max, 52 byte packets
1 192.168.8.200 (192.168.8.200) <syn,ack> 0.456 ms 0.571 ms 0.734 ms
[root@centos7-2 ~]# tcptraceroute6 fe80::3bfd:2d4f:9b51:98d9%enp0s3 22
traceroute to fe80::3bfd:2d4f:9b51:98d9%enp0s3 (fe80::3bfd:2d4f:9b51:98d9) from fe80::52dd:be1d:173f:a6d5, port 22, from port 55643, 30 hops max, 60 bytes packets
1 fe80::3bfd:2d4f:9b51:98d9%enp0s3 (fe80::3bfd:2d4f:9b51:98d9%enp0s3) 0.393 ms [open] 0.271 ms 0.309 ms
 
[root@centos7-2 ~]# traceroute6 fe80::3bfd:2d4f:9b51:98d9%enp0s3
traceroute to fe80::3bfd:2d4f:9b51:98d9%enp0s3 (fe80::3bfd:2d4f:9b51:98d9%enp0s3), 30 hops max, 80 byte packets
1 fe80::3bfd:2d4f:9b51:98d9%enp0s3 (fe80::3bfd:2d4f:9b51:98d9%enp0s3) 0.485 ms 0.454 ms 0.537 ms
 

tracepath

[root@centos7-2 ~]# tracepath 192.168.8.200
1?: [LOCALHOST] pmtu 1500
1: 192.168.8.200 0.405ms reached
1: 192.168.8.200 0.335ms reached
Resume: pmtu 1500 hops 1 back 1
[root@centos7-2 ~]#
[root@centos7-2 ~]# tracepath6 fe80::3bfd:2d4f:9b51:98d9
1?: [LOCALHOST] 0.049ms pmtu 1500
1: fe80::3bfd:2d4f:9b51:98d9%enp0s3 0.674ms reached
1: fe80::3bfd:2d4f:9b51:98d9%enp0s3 0.437ms reached
Resume: pmtu 1500 hops 1 back 1
 

mtr

[root@centos7-2 ~]# mtr 192.168.8.200
My traceroute [v0.85]
centos7-2 (0.0.0.0) Fri Feb 14 12:49:04 2020
Keys: Help Display mode Restart statistics Order of fields quit
Packets Pings
Host Loss% Snt Last Avg Best Wrst StDev
1. 192.168.8.200 0.0% 19 0.5 0.6 0.4 3.0 0.5
 
[root@centos7-2 ~]# mtr --inet6 fe80::3bfd:2d4f:9b51:98d9
My traceroute [v0.85]
centos7-2 (::) Fri Feb 14 12:48:26 2020
Keys: Help Display mode Restart statistics Order of fields quit
Packets Pings
Host Loss% Snt Last Avg Best Wrst StDev
1. fe80::3bfd:2d4f:9b51:98d9 0.0% 22 0.5 0.6 0.4 0.8 0.0
 

hping

[root@centos7-2 ~]# hping -h
usage: hping host [options]
-h --help show this help
-v --version show version
-c --count packet count
-i --interval wait (uX for X microseconds, for example -i u1000)
--fast alias for -i u10000 (10 packets for second)
--faster alias for -i u1000 (100 packets for second)
--flood sent packets as fast as possible. Don‘t show replies.
-n --numeric numeric output
-q --quiet quiet
-I --interface interface name (otherwise default routing interface)
-V --verbose verbose mode
-D --debug debugging info
-z --bind bind ctrl+z to ttl (default to dst port)
-Z --unbind unbind ctrl+z
--beep beep for every matching packet received
Mode
default mode TCP
-0 --rawip RAW IP mode
-1 --icmp ICMP mode
-2 --udp UDP mode
-8 --scan SCAN mode.
Example: hping --scan 1-30,70-90 -S www.target.host
-9 --listen listen mode
IP
-a --spoof spoof source address
--rand-dest random destionation address mode. see the man.
--rand-source random source address mode. see the man.
-t --ttl ttl (default 64)
-N --id id (default random)
-W --winid use win* id byte ordering
-r --rel relativize id field (to estimate host traffic)
-f --frag split packets in more frag. (may pass weak acl)
-x --morefrag set more fragments flag
-y --dontfrag set dont fragment flag
-g --fragoff set the fragment offset
-m --mtu set virtual mtu, implies --frag if packet size > mtu
-o --tos type of service (default 0x00), try --tos help
-G --rroute includes RECORD_ROUTE option and display the route buffer
--lsrr loose source routing and record route
--ssrr strict source routing and record route
-H --ipproto set the IP protocol field, only in RAW IP mode
ICMP
-C --icmptype icmp type (default echo request)
-K --icmpcode icmp code (default 0)
--force-icmp send all icmp types (default send only supported types)
--icmp-gw set gateway address for ICMP redirect (default 0.0.0.0)
--icmp-ts Alias for --icmp --icmptype 13 (ICMP timestamp)
--icmp-addr Alias for --icmp --icmptype 17 (ICMP address subnet mask)
--icmp-help display help for others icmp options
UDP/TCP
-s --baseport base source port (default random)
-p --destport [+][+]<port> destination port(default 0) ctrl+z inc/dec
-k --keep keep still source port
-w --win winsize (default 64)
-O --tcpoff set fake tcp data offset (instead of tcphdrlen / 4)
-Q --seqnum shows only tcp sequence number
-b --badcksum (try to) send packets with a bad IP checksum
many systems will fix the IP checksum sending the packet
so you‘ll get bad UDP/TCP checksum instead.
-M --setseq set TCP sequence number
-L --setack set TCP ack
-F --fin set FIN flag
-S --syn set SYN flag
-R --rst set RST flag
-P --push set PUSH flag
-A --ack set ACK flag
-U --urg set URG flag
-X --xmas set X unused flag (0x40)
-Y --ymas set Y unused flag (0x80)
--tcpexitcode use last tcp->th_flags as exit code
--tcp-timestamp enable the TCP timestamp option to guess the HZ/uptime
Common
-d --data data size (default is 0)
-E --file data from file
-e --sign add ‘signature‘
-j --dump dump packets in hex
-J --print dump printable characters
-B --safe enable ‘safe‘ protocol
-u --end tell you when --file reached EOF and prevent rewind
-T --traceroute traceroute mode (implies --bind and --ttl 1)
--tr-stop Exit when receive the first not ICMP in traceroute mode
--tr-keep-ttl Keep the source TTL fixed, useful to monitor just one hop
--tr-no-rtt Don‘t calculate/show RTT information in traceroute mode
ARS packet description (new, unstable)
--apd-send Send the packet described with APD (see docs/APD.txt)
[root@centos7-2 ~]#
[root@centos7-2 ~]# hping -c 2 -S 192.168.8.200 -p 22
HPING 192.168.8.200 (enp0s3 192.168.8.200): S set, 40 headers + 0 data bytes
len=46 ip=192.168.8.200 ttl=64 DF id=0 sport=22 flags=SA seq=0 win=29200 rtt=0.8 ms
len=46 ip=192.168.8.200 ttl=64 DF id=0 sport=22 flags=SA seq=1 win=29200 rtt=0.6 ms
 
--- 192.168.8.200 hping statistic ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.6/0.7/0.8 ms
 

dig

dns解析,查看一个域名是否具有AAAA记录
[root@centos7-2 ~]# dig www.qq.com AAAA
; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> www.qq.com AAAA
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4984
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
 
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.qq.com. IN AAAA
 
;; ANSWER SECTION:
www.qq.com. 194 IN CNAME public-v6.sparta.mig.tencent-cloud.net.
public-v6.sparta.mig.tencent-cloud.net. 33 IN AAAA 240e:e1:a900:10::15
 
;; Query time: 9 msec
;; SERVER: 114.114.114.114#53(114.114.114.114)
;; WHEN: 五 2月 14 18:00:12 CST 2020
;; MSG SIZE rcvd: 119
 
[root@centos7-2 ~]#
 

telnet

[root@CentOS7-1 ~]# telnet fe80::52dd:be1d:173f:a6d5%enp0s3 22
Trying fe80::52dd:be1d:173f:a6d5%enp0s3...
Connected to fe80::52dd:be1d:173f:a6d5%enp0s3.
Escape character is ‘^]‘.
SSH-2.0-OpenSSH_7.4
 

直接访问IPv6地址上的http服务

使用URL方式访问IPv6地址时候,要在IPv6地址前后分别加“[”和“]”,例:
http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html

IPv6杂项

原文:https://www.cnblogs.com/sunwanglin/p/12322896.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!