ping two cars passing by RSU in Vanet.py

107 views
Skip to first unread message

Akrãm Kün

unread,
May 17, 2021, 10:02:53 AM5/17/21
to mininet-wifi-discuss

Hello,
I'm working on your example of vanet.py . when for example a car4 passes near RSU11 and car7  passes near RSU12 , i cant ping them through RSUs, the only ping that is working is between cars (v2v) and betwen RSU (I2I) . where is that problem came from? 
 why i can't set an ip for interface wlan1 of the RSU?
Thank you.

this is the  screenshot of the topology :


Screenshot_20210517_145133.png



this is the 'vanet.py' code:
#!/usr/bin/python

'Simple idea around Vehicular Ad Hoc Networks - VANETs'

import sys
from random import randint

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


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

info("*** Creating nodes\n")

for id in range(0, 10):
min_ = randint(1, 4)
max_ = randint(11, 30)
net.addCar('car%s' % (id+1), wlans=2, min_speed=min_, max_speed=max_)

rsu11 = net.addAccessPoint(
'RSU11', ssid='vanet-ssid', mode='g', position='2600,3500,0', proto='batmand', channel='1', intf='RSU11-wlan1',
ht_cap='HT40+')
rsu12 = net.addAccessPoint(
'RSU12', ssid='vanet-ssid', mode='g', position='2800,3500,0', proto='batmand', channel='6', intf='RSU12-wlan1',
ht_cap='HT40+')
rsu13 = net.addAccessPoint(
'RSU13', ssid='vanet-ssid', mode='g', position='3000,3500,0', proto='batmand', channel='11', intf='RSU13-wlan1',
ht_cap='HT40+')
rsu14 = net.addAccessPoint(
'RSU14', ssid='vanet-ssid', mode='g', position='3200,3500,0', proto='batmand', channel='11', intf='RSU14-wlan1',
ht_cap='HT40+')
c1 = net.addController('c1')
# c1 = net.addController(name='c1',
# controller=RemoteController,
# ip='192.168.8.105',
# protocol='tcp',
# port=6633)
# ip='localhost',
# protocol='tcp',
# port=6653)

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

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

info("*** Associating and Creating links\n")
net.addLink(rsu11, rsu12)
net.addLink(rsu11, rsu13)
net.addLink(rsu11, rsu14)

for car in net.cars:
net.addLink(car, cls=adhoc, intf='%s-wlan1' % car,
ssid='adhocNet', proto='batmand', mode='g', channel=5,
ht_cap='HT40+')

if '-p' not in args:
net.plotGraph(max_x=500, max_y=500)

net.startMobility(time=0)

info("*** Starting network\n")
net.build()
c1.start()
rsu11.start([c1])
rsu12.start([c1])
rsu13.start([c1])
rsu14.start([c1])

for id, car in enumerate(net.cars):
car.setIP('192.168.0.%s/24' % (id+1), intf='%s-wlan0' % car)
car.setIP('192.168.1.%s/24' % (id+1), intf='%s-wlan1' % car)
for id, ap in enumerate(net.aps):
ap.setIP('192.168.1.%s/24' % (id+11), intf='%s-wlan1' % ap)
ap.setIP('10.0.1.%s/24' % (id+11), intf='%s-eth2' % ap)

"""net.cars.__getitem__(1).cmd('iperf -s -u -i 1 >> udpdownsta1exp.txt &')
net.cars.__getitem__(2).cmd('iperf -s -u -i 1 >> udpdownsta2exp.txt &')

net.cars.__getitem__(1).cmd(' iperf -c %s' %
net.cars.__getitem__(1).IP()+' -u -t 20 -b 100M >> res1.txt &')
net.cars.__getitem__(1).cmd(' iperf -c %s' %
net.cars.__getitem__(2).IP()+' -u -t 20 -b 100M >> res2.txt &')"""

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

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


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










this is the result of the command 'dump':
mininet-wifi> dump
<Controller c1: 127.0.0.1:6653 pid=353804>
<Car car1: car1-wlan0:192.168.0.1,car1-wlan1:192.168.1.1 pid=353766>
<Car car2: car2-wlan0:192.168.0.2,car2-wlan1:192.168.1.2 pid=353768>
<Car car3: car3-wlan0:192.168.0.3,car3-wlan1:192.168.1.3 pid=353770>
<Car car4: car4-wlan0:192.168.0.4,car4-wlan1:192.168.1.4 pid=353772>
<Car car5: car5-wlan0:192.168.0.5,car5-wlan1:192.168.1.5 pid=353774>
<Car car6: car6-wlan0:192.168.0.6,car6-wlan1:192.168.1.6 pid=353776>
<Car car7: car7-wlan0:192.168.0.7,car7-wlan1:192.168.1.7 pid=353778>
<Car car8: car8-wlan0:192.168.0.8,car8-wlan1:192.168.1.8 pid=353780>
<Car car9: car9-wlan0:192.168.0.9,car9-wlan1:192.168.1.9 pid=353782>
<Car car10: car10-wlan0:192.168.0.10,car10-wlan1:192.168.1.10 pid=353784>
<OVSAP RSU11: lo:127.0.0.1,RSU11-wlan1:None,RSU11-eth2:10.0.1.11,RSU11-eth3:None,RSU11-eth4:None pid=353789>
<OVSAP RSU12: lo:127.0.0.1,RSU12-wlan1:None,RSU12-eth2:10.0.1.12 pid=353792>
<OVSAP RSU13: lo:127.0.0.1,RSU13-wlan1:None,RSU13-eth2:10.0.1.13 pid=353795>
<OVSAP RSU14: lo:127.0.0.1,RSU14-wlan1:None,RSU14-eth2:10.0.1.14 pid=353798>






this is the result of the command 'RSU12 ifconfig' :
mininet-wifi> RSU12 ifconfig
RSU11-eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.1.11  netmask 255.255.255.0  broadcast 10.0.1.255
        ether 7a:23:0b:b9:3b:e8  txqueuelen 1000  (Ethernet)
        RX packets 24  bytes 2897 (2.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 83  bytes 8911 (8.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

RSU11-eth3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether b2:05:e2:09:60:c8  txqueuelen 1000  (Ethernet)
        RX packets 28  bytes 2977 (2.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 61  bytes 6054 (6.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

RSU11-eth4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 96:a2:8c:9d:6c:0f  txqueuelen 1000  (Ethernet)
        RX packets 28  bytes 2977 (2.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 61  bytes 6054 (6.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

RSU11-wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.11  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 02:00:00:00:14:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 209  bytes 21327 (21.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

RSU12-eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.1.12  netmask 255.255.255.0  broadcast 10.0.1.255
        ether 32:cc:3d:27:53:fe  txqueuelen 1000  (Ethernet)
        RX packets 83  bytes 8911 (8.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 24  bytes 2897 (2.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

RSU12-wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.12  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 02:00:00:00:15:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 106  bytes 13828 (13.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

RSU13-eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.1.13  netmask 255.255.255.0  broadcast 10.0.1.255
        ether 2a:02:3d:73:1f:58  txqueuelen 1000  (Ethernet)
        RX packets 61  bytes 6054 (6.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 28  bytes 2977 (2.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

RSU13-wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.13  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 02:00:00:00:16:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 89  bytes 11550 (11.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

RSU14-eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.1.14  netmask 255.255.255.0  broadcast 10.0.1.255
        ether ce:d3:e9:b0:73:f3  txqueuelen 1000  (Ethernet)
        RX packets 61  bytes 6054 (6.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 28  bytes 2977 (2.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

RSU14-wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.14  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 02:00:00:00:17:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 91  bytes 12031 (12.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp1s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether c8:5b:76:7e:6d:cb  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 212349  bytes 46844588 (46.8 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 212349  bytes 46844588 (46.8 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.192  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::9022:aa6d:abbe:6ca1  prefixlen 64  scopeid 0x20<link>
        ether 78:45:61:ea:4b:a7  txqueuelen 1000  (Ethernet)
        RX packets 75999  bytes 80363354 (80.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 53761  bytes 8234804 (8.2 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Reply all
Reply to author
Forward
0 new messages