Search code examples
pythonhttpipv6wiresharkscapy

Scapy fails to send ipv6 packets


Hello everyone i am new here so please be kind.

I have been using scapy lately in order to send and recieve ipv6 packets to selected ipv6 enabled servers. The gist of the code is here:

text = line[:-1]
            #destination=getIPv6Addr(line[:-1])
            destination="2607:f1c0:1000:60e0:7992:97f7:61b2:2814"
            source="2001:630:d0:f105:5cfe:e988:421a:a7b7"
            syn = IPv6(dst=destination,src=source) / TCP(sport=555,dport=80,flags="S")#flag S is syn packet
            syn.show()
            syn_ack = sr1(syn,timeout=11)

When i execute the code hoever this is what i get:

Begin emission:
Finished to send 1 packets.
.................WARNING: No route found for IPv6 destination :: (no default route?)
WARNING: No route found for IPv6 destination 2607:f1c0:1000:60e0:7992:97f7:61b2:2814 (no default route?)
............................................................................................................
Received 1322 packets, got 0 answers, remaining 1 packets

From what i understand, the packet has been sent nevertheless a response is never gotten(0 answers). This made me think of using wireshark to sniff the packet.

Upon using it with filter:

ip6 net 2607:f1c0:1000:60e0:7992:97f7:61b2:2814

I realised the packet was never sent at the first place! Does anyone know why this is happening or what is hapening here?

Regards Martinos

EDIT:

On closer inspection from comments, i realized that the route list SHOULD not be empty. There are no routes to send the packet. I am not sure how to add them! Please help here is what i did:

i tried to get all the interfaces from my device. Here is what i got back:

{'flags': 33, 'link_addr': b0:90:20:52:41:53, 'type': 6, 'name': 'eth0', 'mtu': 1500L}
{'flags': 33, 'link_addr': b0:90:20:52:41:53, 'type': 6, 'name': 'eth1', 'mtu': 1500L}
{'flags': 33, 'link_addr': 00:50:56:a0:1e:df, 'type': 6, 'name': 'eth2', 'mtu': 1500L}
{'flags': 33, 'link_addr': 00:50:56:a0:1e:df, 'type': 6, 'name': 'eth3', 'mtu': 1500L}
{'flags': 33, 'link_addr': b0:90:20:52:41:53, 'type': 6, 'name': 'eth4', 'mtu': 1500L}
{'flags': 33, 'link_addr': b0:90:20:52:41:53, 'type': 6, 'name': 'eth5', 'mtu': 1500L}
{'flags': 32, 'link_addr': 00:50:56:a0:00:6c, 'type': 6, 'name': 'eth6', 'mtu': 0L}
{'flags': 32, 'link_addr': 00:50:56:a0:01:0e, 'type': 6, 'name': 'eth7', 'mtu': 0L}
{'flags': 32, 'link_addr': 00:50:56:a0:6e:61, 'type': 6, 'name': 'eth8', 'mtu': 0L}
{'addr': 152.78.61.39/24, 'mtu': 1500L, 'flags': 33, 'link_addr': 00:50:56:a0:1e:df, 'type': 6, 'name': 'eth9'}
{'flags': 33, 'link_addr': b0:90:20:52:41:53, 'type': 6, 'name': 'eth10', 'mtu': 1500L}
{'flags': 33, 'link_addr': b0:90:20:52:41:53, 'type': 6, 'name': 'eth11', 'mtu': 1500L}
{'flags': 33, 'type': 23, 'name': 'ppp0', 'mtu': 1494L}
{'flags': 33, 'link_addr': 20:41:53:59:4e:ff, 'type': 23, 'name': 'ppp1', 'mtu': 3256L}
{'addr': 127.0.0.1/8, 'flags': 3, 'type': 24, 'name': 'lo0', 'mtu': 1500L}
{'flags': 33, 'type': 131, 'name': 'tun0', 'mtu': 4091L}
{'flags': 32, 'type': 131, 'name': 'tun1', 'mtu': 1480L}
{'flags': 33, 'type': 131, 'name': 'tun2', 'mtu': 1460L}
{'flags': 33, 'type': 131, 'name': 'tun3', 'mtu': 1464L}
{'flags': 32, 'type': 131, 'name': 'tun4', 'mtu': 1280L}
{'flags': 32, 'type': 131, 'name': 'tun5', 'mtu': 1280L}
{'flags': 33, 'type': 131, 'name': 'tun6', 'mtu': 1472L}
{'flags': 32, 'type': 131, 'name': 'tun7', 'mtu': 1280L}

As you can see, nowhere in there there is an ipv6 address. How am i supposed to send ipv6 packets if no ipv6 address is listed? in extend, here is the ipconfig from cmd:

    Ethernet adapter Local Area Connection 4:

   Connection-specific DNS Suffix  . : ecs.soton.ac.uk
   IPv6 Address. . . . . . . . . . . : 2001:630:d0:f105:5cfe:e988:421a:a7b7
   Temporary IPv6 Address. . . . . . : 2001:630:d0:f105:e8bc:7c26:9a40:31b8
   Link-local IPv6 Address . . . . . : fe80::5cfe:e988:421a:a7b7%17
   IPv4 Address. . . . . . . . . . . : 152.78.61.39
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : fe80::210:18ff:fee5:5bfa%17
                                       152.78.61.254

Tunnel adapter 6TO4 Adapter:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Tunnel adapter Teredo Tunneling Pseudo-Interface:

   Connection-specific DNS Suffix  . :
   IPv6 Address. . . . . . . . . . . : 2001:0:5ef5:79fd:142e:398d:67b1:c2d8
   Link-local IPv6 Address . . . . . : fe80::142e:398d:67b1:c2d8%13
   Default Gateway . . . . . . . . . :

Tunnel adapter isatap.ecs.soton.ac.uk:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : ecs.soton.ac.uk

This is run on a VM but i dont think it matters.

PLEASE someone help me this is very important! how can i configure scapy in order to understand how to send ipv6 packets. and why do i see no ipv6 addresses in the list above of interfaces?


Solution

  • 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: https://www.rfc-editor.org/rfc/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.