MININET-WIFI INTERNET ISSUES

211 views
Skip to first unread message

IRIE SAINT ANGE

unread,
Apr 16, 2024, 6:23:19 AM4/16/24
to mininet-wifi-discuss
Hi, 
I have an issue I wanted to connect my topology to internet.

I have a topology with 1 AP and 8 cars with interfaces (V2V & V2I), then I wanted to connect the V2I to internet.

I looked into the code internet.py and the only thing that I had to add is "net.addNAT().configDefault()" in my code.
I did it but unfortunately it did not work.

I really need some help.


    info('*** Starting network\n')
    net.build()
    net.addNAT().configDefault()
    info('*** Starting controllers\n')
    for controller in net.controllers:
        controller.start()

    info('*** Starting switches/APs\n')
    net.get('ap1').start([c0])

    info('*** Post configure nodes\n')
    for car in cars:
        car.setIP(f'192.168.0.{car.name[-1]}/24', intf=f'{car}-wlan0')
        car.setIP(f'192.168.1.{car.name[-1]}/24', intf=f'{car}-wlan1')

    CLI(net)
    net.stop()


Ramon Fontes

unread,
Apr 16, 2024, 6:41:45 AM4/16/24
to IRIE SAINT ANGE, mininet-wifi-discuss
Which troubleshooting steps did you try? 

IRIE SAINT ANGE

unread,
Apr 16, 2024, 6:49:58 AM4/16/24
to mininet-wifi-discuss
FirstlyI tried to see if the nat0 nodes appears and of course yes.
ap1 c0 car1 car2 car3 car4 car5 car6 car7 car8 nat0

Then check the routing table for each car with "car1 route -n" but only see the default route for each interface.

mininet-wifi> car1 route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 car1-wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 car1-wlan1

Here is my full code, what I want to make is:
V2V using adhoc proto (babel, olsdr, batman)
V2I cars being connected to ap automatically when they are closed to

And maybe collect the result.

#!/usr/bin/python
import sys
from mininet.node import Controller, RemoteController
from mininet.log import setLogLevel, info
from mn_wifi.net import Mininet_wifi
from mn_wifi.node import Station, OVSKernelAP
from mn_wifi.cli import CLI
from mn_wifi.link import wmediumd, adhoc
from mn_wifi.wmediumdConnector import interference

def myNetwork(args):
    net = Mininet_wifi(topo=None,
                       build=False,
                       link=wmediumd,
                       wmediumd_mode=interference,
                       ipBase='10.0.0.0/8')

    info('*** Adding controller\n')
    c0 = net.addController(name='c0',
                           controller=RemoteController,
                           protocol='tcp',
                           port=6653)

    info('*** Add switches/APs\n')
    ap1 = net.addAccessPoint('ap1', cls=OVSKernelAP, ssid='new-ssid1', mode='g', channel='1',
                             failMode="standalone", position='500,500,0')

    info('*** Add hosts/stations\n')
    # Add cars moving around the access point
    cars = []
    for i in range(1, 9):
        car = net.addStation(f'car{i}', wlans=2, mac=f'00:00:00:00:00:0{i}', ip=f'10.0.0.{i}/8',
                             min_x=250, max_x=750, min_y=250, max_y=750, min_v=10, max_v=20)
        cars.append(car)

    info("*** Configuring Propagation Model\n")
    net.setPropagationModel(model="logDistance", exp=3)

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

    # Add ad-hoc links between cars
    for car in cars:
        net.addLink(car, intf=car.params['wlan'][1], cls=adhoc, ssid='adhoc-ssid', proto='batmand', channel=5, ht_cap='HT40+')

    net.setMobilityModel(time=0, model='RandomDirection',
                         max_x=1000, max_y=1000, seed=20, ac_method='ssf')

    net.plotGraph(max_x=1500, max_y=1500)


    info('*** Starting network\n')
    net.build()
    net.addNAT().configDefault()
    info('*** Starting controllers\n')
    for controller in net.controllers:
        controller.start()

    info('*** Starting switches/APs\n')
    net.get('ap1').start([c0])

    info('*** Post configure nodes\n')
    for car in cars:
        car.setIP(f'192.168.0.{car.name[-1]}/24', intf=f'{car}-wlan0')
        car.setIP(f'192.168.1.{car.name[-1]}/24', intf=f'{car}-wlan1')

    CLI(net)
    net.stop()

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

Le mar. 16 avr. 2024 à 10:37, Ramon Fontes <ramonre...@gmail.com> a écrit :
Which troubleshooting steps did you try? 

Ramon Fontes

unread,
Apr 16, 2024, 7:06:13 AM4/16/24
to IRIE SAINT ANGE, mininet-wifi-discuss
Do the cars have an IP address on subnet 10.0.0.0/8?

IRIE SAINT ANGE

unread,
Apr 16, 2024, 7:16:53 AM4/16/24
to mininet-wifi-discuss
No, no one.

I should remove it right?

I was building my topology based on other's one, so I forgot to remove the ipbase

I removed it. 
I am still facing the same issues.

Ramon Fontes

unread,
Apr 16, 2024, 7:17:47 AM4/16/24
to IRIE SAINT ANGE, mininet-wifi-discuss
10.0.0.0/8 is the default one. :/

IRIE SAINT ANGE

unread,
Apr 16, 2024, 7:26:33 AM4/16/24
to mininet-wifi-discuss
Sorry, I have hard time to understand what you wanted to mean.

Should I assign this network to my V2I interfaces in order for that to work (reach internet)?

Before

car.setIP(f'192.168.0.{car.name[-1]}/24', intf=f'{car}-wlan0')

Then
car.setIP(f'10.0.0.{car.name[-1]}/8', intf=f'{car}-wlan0')

Ramon Fontes

unread,
Apr 16, 2024, 7:29:32 AM4/16/24
to IRIE SAINT ANGE, mininet-wifi-discuss
and evoke the natadd line after setting new ip addresses.

IRIE SAINT ANGE

unread,
Apr 16, 2024, 7:45:34 AM4/16/24
to mininet-wifi-discuss
Thanks, It does not work,

But I have an issue, impossible to ping the gateway then impossible to reach internet.

I precise, when I run the internet.py and it works.


ininet-wifi> car1 route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.9        0.0.0.0         UG    0      0        0 car1-wlan0
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 car1-wlan0

192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 car1-wlan1
mininet-wifi> ping 8.8.8.8
*** Unknown command: ping 8.8.8.8
mininet-wifi> car1 ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 10.0.0.1 icmp_seq=1 Destination Host Unreachable
From 10.0.0.1 icmp_seq=2 Destination Host Unreachable
From 10.0.0.1 icmp_seq=3 Destination Host Unreachable
From 10.0.0.1 icmp_seq=4 Destination Host Unreachable
From 10.0.0.1 icmp_seq=5 Destination Host Unreachable
From 10.0.0.1 icmp_seq=6 Destination Host Unreachable

Did I miss something?

IRIE SAINT ANGE

unread,
Apr 16, 2024, 7:58:17 AM4/16/24
to mininet-wifi-discuss
I meant, It works but I still cannot reach internet

Ramon Fontes

unread,
Apr 16, 2024, 8:17:10 AM4/16/24
to IRIE SAINT ANGE, mininet-wifi-discuss
Is car1 associated with the ap? Can car1 ping to its gateway?

IRIE SAINT ANGE

unread,
Apr 16, 2024, 8:30:43 AM4/16/24
to mininet-wifi-discuss
Yes, car1 can.

mininet-wifi> car1 route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.9        0.0.0.0         UG    0      0        0 car1-wlan0
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 car1-wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 car1-wlan1
mininet-wifi> car1 ping 10.0.0.2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=7.98 ms
64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=3.75 ms

It works as you can see but impossible to ping 10.0.0.9 or internet 8.8.8.8

Ramon Fontes

unread,
Apr 16, 2024, 8:34:12 AM4/16/24
to IRIE SAINT ANGE, mininet-wifi-discuss
Please check if nat0 is connected with the AP.

IRIE SAINT ANGE

unread,
Apr 16, 2024, 8:56:29 AM4/16/24
to mininet-wifi-discuss
I checked it, and I am not sure.

I tried "ap1 ip link" and get this result:

"1173: nat0-eth0@ap1-eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 5e:62:1e:f6:fa:36 brd ff:ff:ff:ff:ff:ff"


I think it is connected.

Ramon Fontes

unread,
Apr 16, 2024, 8:58:44 AM4/16/24
to IRIE SAINT ANGE, mininet-wifi-discuss
Which remote controller do you have? Please check the control plane and flow tables.

IRIE SAINT ANGE

unread,
Apr 16, 2024, 9:24:24 AM4/16/24
to mininet-wifi-discuss
I also tried to make the internet.py running on my remote controller and it works

IRIE SAINT ANGE

unread,
Apr 16, 2024, 9:24:28 AM4/16/24
to mininet-wifi-discuss
I use RYU Controller

I tried to switch on the default controller, "controller=Controller,", the result is the same

So I have to push flow entry to reach Internet by passing through " nat0-eth0@ap1-eth2 "in my flow table right? 

By the way I have another question, I try to use an adhoc proto in my topology but only olsrd seems work.

I mean the routing table is working as excepted.


mininet-wifi> car1 route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.9        0.0.0.0         UG    0      0        0 car1-wlan0
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 car1-wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 car1-wlan1
192.168.1.2     192.168.1.2     255.255.255.255 UGH   2      0        0 car1-wlan1
192.168.1.3     192.168.1.3     255.255.255.255 UGH   2      0        0 car1-wlan1
192.168.1.4     192.168.1.2     255.255.255.255 UGH   2      0        0 car1-wlan1
192.168.1.5     192.168.1.5     255.255.255.255 UGH   2      0        0 car1-wlan1
192.168.1.6     192.168.1.6     255.255.255.255 UGH   2      0        0 car1-wlan1
192.168.1.7     192.168.1.7     255.255.255.255 UGH   2      0        0 car1-wlan1
192.168.1.8     192.168.1.8     255.255.255.255 UGH   2      0        0 car1-wlan1

But with other such as Babel or Batman_adv nothing happens

I already have made tests with Babel, Batman_adv and Olsrd on the topology below and it works perfectly but not in my new (only olsrd works).

#!/usr/bin/python
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(plot):
    "Create a network."
    net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference)
    info("*** Creating nodes\n")
    # Add 3 Stations TODO TASK 1
    sta1 = net.addStation('sta1', position='100,100,0', range=50)
    sta2 = net.addStation('sta2', position='150,100,0', range=50)
    sta3 = net.addStation('sta3', position='200,100,0', range=50)
    sta4 = net.addStation('sta4', position='250,100,0', range=50)
    sta5 = net.addStation('sta5', position='300,100,0', range=50)
    sta6 = net.addStation('sta6', position='350,100,0', range=50)

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


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

    info("*** Creating links\n")
    # Add Links TODO
    net.addLink(sta1, cls=adhoc, intf='sta1-wlan0',ssid='adhocNet', mode='g', proto='babel', channel=5, ht_cap='HT40+')
    net.addLink(sta2, cls=adhoc, intf='sta2-wlan0',ssid='adhocNet', mode='g', proto='babel', channel=5, ht_cap='HT40+')
    net.addLink(sta3, cls=adhoc, intf='sta3-wlan0',ssid='adhocNet', mode='g', proto='babel', channel=5, ht_cap='HT40+')
    net.addLink(sta4, cls=adhoc, intf='sta4-wlan0',ssid='adhocNet', mode='g', proto='babel', channel=5, ht_cap='HT40+')
    net.addLink(sta5, cls=adhoc, intf='sta5-wlan0',ssid='adhocNet', mode='g', proto='babel', channel=5, ht_cap='HT40+')
    net.addLink(sta6, cls=adhoc, intf='sta6-wlan0',ssid='adhocNet', mode='g', proto='babel', channel=5, ht_cap='HT40+')
   


    net.plotGraph(max_x=500, max_y=400)

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

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

    info("*** Stopping network\n")

    net.stop()


if __name__ == '__main__':
    setLogLevel('info')
    plot = True if '-a' in sys.argv else False
    topology(plot)



Le mardi 16 avril 2024 à 12:58:44 UTC, ramonre...@gmail.com a écrit :

Ramon Fontes

unread,
Apr 16, 2024, 9:26:47 AM4/16/24
to IRIE SAINT ANGE, mininet-wifi-discuss
> But with other such as Babel or Batman_adv nothing happens

I suggest you go through related topics in this mailing list.

IRIE SAINT ANGE

unread,
Apr 16, 2024, 10:38:36 AM4/16/24
to mininet-wifi-discuss
Thanks
Reply all
Reply to author
Forward
0 new messages