intrig-unicamp / mininet-wifi

Emulator for Software-Defined Wireless Networks
https://mn-wifi.readthedocs.io/
Other
438 stars 239 forks source link

Unable to create IPv6 multi hop mesh network in ad hoc mode #342

Closed bhatramya closed 2 years ago

bhatramya commented 3 years ago

I have been trying to create a multi-hop mesh network in ad-hoc mode (using adhoc.py example) but for IPv6 network. Even though I am assigning IPv6 address to the nodes using setIP6(), I am unable to ping6 (for both with and without running routing protocol) and the routing tables are not updated (I am running the mesh routing protocol separately for IPv6). Am I missing something here because of which I am unable to ping6?

Thanks and regards, Ramya

ramonfontes commented 3 years ago

Please provide as much information as possible. Otherwise we won't be able to help you. It is desirable that you indicate the steps you are taking so that we can reproduce them.

bhatramya commented 3 years ago
#!/usr/bin/python

"""
This example shows on how to enable the adhoc mode
Alternatively, you can use the manet routing protocol of your choice
"""

import sys

from mininet.log import setLogLevel, info
from mn_wifi.link import wmediumd, adhoc
from mn_wifi.cli import CLI
from mn_wifi.net import Mininet_wifi
from mn_wifi.wmediumdConnector import interference

def topology(args):
    "Create a network."
    net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference)

    info("*** Creating nodes\n")
    kwargs = dict()
    if '-a' in args:
        kwargs['range'] = 100

    sta1 = net.addStation('sta1',
                          position='10,10,0', **kwargs)
    sta2 = net.addStation('sta2',
                          position='50,10,0', **kwargs)
    sta3 = net.addStation('sta3',
                          position='90,10,0', **kwargs)

    net.setPropagationModel(model="logDistance", exp=4)

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Creating links\n")
    # MANET routing protocols supported by proto:
    # babel, batman_adv, batmand and olsr
    # WARNING: we may need to stop Network Manager if you want
    # to work with babel
    protocols = ['babel', 'batman_adv', 'batmand', 'olsr']
    kwargs = dict()
    for proto in args:
        if proto in protocols:
            kwargs['proto'] = proto

    net.addLink(sta1, cls=adhoc, intf='sta1-wlan0',
                ssid='adhocNet', mode='g', channel=5,
                ht_cap='HT40+', **kwargs)
    net.addLink(sta2, cls=adhoc, intf='sta2-wlan0',
                ssid='adhocNet', mode='g', channel=5,
                **kwargs)
    net.addLink(sta3, cls=adhoc, intf='sta3-wlan0',
                ssid='adhocNet', mode='g', channel=5,
                ht_cap='HT40+', **kwargs)

    info("*** Starting network\n")
    net.build()

    info("\n*** Addressing...\n")
    if 'proto' not in kwargs:
        sta1.setIP6('2001::1/64', intf="sta1-wlan0")
        sta2.setIP6('2001::2/64', intf="sta2-wlan0")
        sta3.setIP6('2001::3/64', intf="sta3-wlan0")

    info("*** Running CLI\n")
    CLI(net)

    info("*** Stopping network\n")
    net.stop()

if __name__ == '__main__':
    setLogLevel('info')
    topology(sys.argv)

I am using this mininet-wifi network. On running without "proto" argument, the ipv6 address is set. But unable to ping6. So I tried running "olsrd -i sta1-wlan0 -ipv6 -d 1" (similarly for all the nodes). But I have been receiving errors such as "unable to bind socket" and "validation address :: failed". Now I am not sure if it is the addressing issue in mininet-wifi or ipv6 routing issue in olsrd. (but when I run the same command on my pc's wlan interface, I don't get any such errors)

Please let me know if you need more information.

Thank you!

ramonfontes commented 3 years ago

I could ask you about which troubleshooting steps you've done, exactly. However, we expect such information when a issue is created.

On running without "proto" argument, the ipv6 address is set. But unable to ping6

If you run ip addr will will probably see the NO-CARRIER state.

01: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
308: sta1-wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state DORMANT group default qlen 1000
    link/ether 02:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.1/8 scope global sta1-wlan0
       valid_lft forever preferred_lft forever
    inet6 2001::1/64 scope global tentative 
       valid_lft forever preferred_lft forever

In that sense, you could collaborate and provide more information about the problem. If you had checked the status of the interface I could tell you where the problem is likely to be.

After stopping network manager the NO-CARRIER state is not there anymore and nodes can ping to each other.

01: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
312: sta1-wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 02:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.1/8 scope global sta1-wlan0
       valid_lft forever preferred_lft forever
    inet6 2001::1/64 scope global tentative 
       valid_lft forever preferred_lft forever
    inet6 fe80::ff:fe00:0/64 scope link tentative 
       valid_lft forever preferred_lft forever

By the way, I didn't find any problem with olsrd

ps: I hope you are considering IPv6 EUI-64 in your network scenario.

bhatramya commented 3 years ago

I want to create a multi hop ad hoc IPv6 network for testing and performing some measurements. The mininet-wifi code above is my network. It works perfectly for IPv4 with proto option. I tried your suggestion of stopping the network manager and it worked. I have been seeing this NO-CARRIER issue when I was trying out other networks (all IPv6), and I didn't know the solution. Thank you! I am still getting error with olsrd IPv6. I will try again and see if I am missing something.

Thanks again!

ramonfontes commented 2 years ago

Closing due to inactivity