scapy: applying an ipv6 route

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ciary
    Recognized Expert New Member
    • Apr 2009
    • 247

    scapy: applying an ipv6 route

    Hi,

    I have a problem with scapy (obviously)
    for those who do not know, scapy is a network tool that allows you to manually craft a packet and send it, or even replay and modify a packet capture file.
    i want to do the first. i simply want to send an ipv6 icmp echo request and print the reply.

    here is the code to do that:
    Code:
    import logging
    import sys
    from scapy.all import *
    conf.iface='eth1'
    conf.route6.add(dst="50::1",gw="50::2")
    print conf.route6
    i=IPv6()
    i.display()
    i.dst="50::1"
    i.src="50::2"
    i.display()
    q=ICMPv6EchoRequest()
    q.display()
    p=(i/q)
    reply=sr1(p)
    reply.show()
    i'll tell you what went wrong, and what i did.
    so first i got a warning:
    - WARNING: No route found for IPv6 destination 50::1 (no default route?)
    this was before I added the route in scapy. but it told me the packet was send anyway and it was waiting for an answer. then I did a packet-sniff to see why i got no answer. I checked all my available interfaces and found out that the packet was not send.
    so after a while i found out that the routing table that scapy uses thinks that 50::2 is a loopback address instead of being applied on an interface. however, the routing table of linux clearly says it's configured on eth1. also, a "ping6 50::1" works fine. i tried adding a static route to 50::1 but this didn't seem to work. i also tried
    Code:
    conf.route6.add(dst="50::1",gw="50::2",dev="eth1")
    but without much success. it gave an error:
    - TypeError: construct_sourc e_candidate_set () takes exactly 4 arguments (3 given)

    does anyone know what i'm doing wrong? or does anyone know how i can get this working? it would be a huge help.
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    I haven't had the opportunity to work extensively with IPv6 so I probably won't e able to help much there, but one thing that always gets me is the SELinux and iptables "deny by default" policies. Are ip6tables or SELinux set to allow this?

    Comment

    • Ciary
      Recognized Expert New Member
      • Apr 2009
      • 247

      #3
      if it were a problem a normal 'ping6' wouldn't have worked either. and that works fine.

      Comment

      • sicarie
        Recognized Expert Specialist
        • Nov 2006
        • 4677

        #4
        Ah, right, sorry - read right over that part. I'll do some research and see if I can find anything

        Comment

        • Ciary
          Recognized Expert New Member
          • Apr 2009
          • 247

          #5
          there is a workaround. you can manually add a mac source and destination. if you do this you force the packet to be send out on the right interface. that does the trick for me because i know the mac addresses and the host and destination are directly connected.

          however, i'm still curious what happened and why it won't work without this. as i sid before, i think it's a problem with ipv6 routes. for some reason it recognizes my eth1 ipv6 address as a loopback address instead of one applied to an interface. i wonder why ...

          Comment

          Working...