Scapy fails to send ipv6 packets

半城伤御伤魂 提交于 2019-12-06 14:03:16
thuovila

The ethernet adapter indeed has both an IPv6 address and a default gateway. You could

  • Try to ping -6 ipv6.google.com to see if there is any IPv6 connectivity. I think there must be, since I can ping your IPv6 address just fine, unless it has been reassigned to somebody else now.

  • Inspect the routing tables to see there are no superfluous routes In particular, the Teredo interface might be causing trouble. Turn it off. (netsh interface teredo set state disabled)

Teredo: http://tools.ietf.org/html/rfc4380 http://en.wikipedia.org/wiki/Teredo_tunneling

I do not know how to configure IPv6 routing and interfaces using scapy.

I made this an answer, since there is not enough room in the comments. I do still suggest you ask on superuser. I can not sufficiently help you, since I am not familiar with either "JANET" or Windows networking configuration.

I observed that in "layers/inet6.py" there is function call to getmacbyip6, in which they are trying to get the interface info based on the scapy routing table.

iff,a,nh = conf.route6.route(ip6, dev=conf.iface6)

As conf.iface6 is set to "lo" by default it always return loopback interface.

iff,a,nh = conf.route6.route(ip6)

I changed the above statement as shown below then I was able to see the packets going out from the corresponding interface.

Example:-

[root@purple-perf-tester scapy]# ifconfig eth1
eth1: flags=323<UP,BROADCAST,RUNNING,PROMISC>  mtu 1500
        inet 11.0.0.5  netmask 255.255.255.0  broadcast 0.0.0.0
        inet6 2001::6  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::f816:3eff:fe2b:cc67  prefixlen 64  scopeid 0x20<link>
        ether fa:16:3e:2b:cc:67  txqueuelen 1000  (Ethernet)
        RX packets 6107709  bytes 1239209940 (1.1 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12093723  bytes 4161092991 (3.8 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@purple-perf-tester scapy]# ip -6 route show dev eth1
2001::7 via fe80::f816:3eff:fed1:43de  metric 1024 
2001::/64  proto kernel  metric 256 
fe80::/64  proto kernel  metric 256 

[root@purple-perf-tester scapy]# scapy
INFO: Can't import python gnuplot wrapper . Won't be able to plot.
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump().
WARNING: No route found for IPv6 destination :: (no default route?)

Welcome to Scapy (2.3.1)
>>> 
>>> conf.route6
Destination                    Next Hop                   iface  src candidates           
::1/128                        ::                         lo     ::1                      
2001::7/128                    fe80::f816:3eff:fed1:43de  eth1   2001::6                  
2001::/64                      ::                         eth1   2001::6                  
2002::/64                      ::                         eth2   2002::6                  
fe80::/64                      ::                         eth0   fe80::f816:3eff:fe7c:d9fe
fe80::/64                      ::                         eth1   fe80::f816:3eff:fe2b:cc67
fe80::/64                      ::                         eth2   fe80::f816:3eff:fe1a:a62e
::1/128                        ::                         lo     ::1                      
2001::6/128                    ::                         lo     ::1                      
2002::6/128                    ::                         lo     ::1                      
fe80::f816:3eff:fe1a:a62e/128  ::                         lo     ::1                      
fe80::f816:3eff:fe2b:cc67/128  ::                         lo     ::1                      
fe80::f816:3eff:fe7c:d9fe/128  ::                         lo     ::1                      
>>> iff,a,nh = conf.route6.route("2001::7", dev=conf.iface6)
WARNING: No route found for IPv6 destination 2001::7 (no default route?)
>>> print iff
lo
>>> iff,a,nh = conf.route6.route("2001::7")
>>> print iff
eth1

conf.iface6 should be set for sending IPv6 packets.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!