intrig-unicamp / mininet-wifi

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

How to establish communication between a wireless station and traditional host #389

Closed razikfakih closed 2 years ago

razikfakih commented 3 years ago

I am building a topology where an Access Point connects a wireless station as well as a traditional host. However although there are direct links of connection with acess point for both traditional host as well as wireless station, I am not able to ping from wireless station to traditional host.

My topology code simplified: ap1 = net.addAccessPoint('ap1') sta1 = net.addStation('sta1') h = net.addHost('h')

wifi.configureNodes()

net.addLink(ap1, sta1) net.addLink(ap1, h, 2, 1)

Please advice how should I sort this.

ramonfontes commented 3 years ago

I'm unable to help you with so few information. Please provide as much information as you can. Don't forget to give information on reproducible steps and expected results.

razikfakih commented 3 years ago

Sir, Its just a simple topology in mininet wifi, where I am connecting one Access Point to a station as well as a traditional host PC to the same Access Point.

Apparently the station will be connected wirelessly and host will be connected through Ethernet

Now when a ping from station to traditional host, it is unsuccessful and I receive a message... connect: host unreachable

I simply want to know how should we successfully connect a traditional host and wireless station through an AP. Thanks

ramonfontes commented 3 years ago

Please be more complete and provide useful information about the problem. Otherwise, I will have to close this issue.

razikfakih commented 3 years ago

I will try to get back to you with more detailed information soon. Please keep the issue open, will be back with additional detailed information soon. Thanks

razikfakih commented 3 years ago

Please find the details of the problem...

Aim: To establish communication between wireless stations and traditional hosts.

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

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

info("*** Creating gateway and internet\n")
g = net.addHost('g', mac='00:00:00:00:00:01')
r = net.addHost('r', ip='150.0.0.2', mac='00:00:00:00:00:91')

info("*** Creating nodes\n")
sta1 = net.addStation('sta1', ip='10.0.1.2', mac='00:00:00:00:00:11', position='40,0,10')
sta2 = net.addStation('sta2', ip='10.0.1.3', mac='00:00:00:00:00:12', position='40,10,10')
sta3 = net.addStation('sta3', ip='10.0.1.4', mac='00:00:00:00:00:13', position='40,20,10')
#sta2 = net.addStation('sta2', ip='10.0.1.110', mac='00:00:00:00:00:12', position='31,1,0')

ap1 = net.addAccessPoint('ap1', wlans=3, ssid='ssid1', position='50,0,10')
ap2 = net.addAccessPoint('ap2', wlans=2, ssid='ssid2', position='50,10,10')
ap3 = net.addAccessPoint('ap3', wlans=2, ssid='ssid3', position='50,20,10')
#ap4 = net.addAccessPoint('ap4', wlans=2, ssid='ssid4', position='30,10,0')

c0 = net.addController('c0')

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

info("*** Associating Stations\n")
net.addLink(sta1, ap1)
net.addLink(sta2, ap2)
net.addLink(sta3, ap3)
net.addLink(ap1, ap2)
net.addLink(ap2, ap3)

#net.addLink(ap1, intf='ap1-wlan2', cls=mesh, ssid='mesh-ssid', channel=5)
#net.addLink(ap2, intf='ap2-wlan2', cls=mesh, ssid='mesh-ssid', channel=5)
#net.addLink(ap3, intf='ap3-wlan2', cls=mesh, ssid='mesh-ssid', channel=5)

info("*** Internet setup\n")
net.addLink(g, r, 1, 1)
net.addLink(g, ap1, 2, 3)

info("*** Starting network\n")
net.build()
c0.start()
ap1.start([c0])
ap2.start([c0])
ap3.start([c0])

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

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

if name == 'main': setLogLevel('info') topology()

After executing the script, I successfully enabled ip forwarding on host g and also assigned respective addresses of 150.0.0.1 at g-eth1 and 10.0.1.1(connecting access point) at g-eth2(connecting another traditional host)

Issue: Although the sta1 and host g are connected to each other through ap1, I am not able to ping from host g to sta1 and vice versa. sta1 can ping sta2 and sta3 but not host g and host r

Can you kindly advice how can I fix this. Thanks

ramonfontes commented 3 years ago

I can see no IP address assigned to the g node in your code. :(

BTW, does g have eth1 and eth2?? Shouldn't it have eth0 and eth1???

razikfakih commented 3 years ago

As mentioned in question that I have enabled forwarding on router from command line and have assigned address to interfaces during run time from command line hence did not include them in the script.

Yes, I have used interfaces from eth1 rather than eth0 as I believed it should not be a problem, however do you suggest me to change interface names and try again?

ramonfontes commented 2 years ago

Closing due to inactivity