View previous topic :: View next topic |
Author |
Message |
paul_chany Tux's lil' helper
Joined: 01 Aug 2010 Posts: 82 Location: Europe, Serbia
|
Posted: Thu Feb 09, 2017 7:14 pm Post subject: Wireless client and software AP with a single Wi-Fi device |
|
|
Hi,
I have a laptop with a WiFi adapter:
Network controller: Qualcomm Atheros AR9462 Wireless Network Adapter (rev 01)
It works as a wireless client already on my Gentoo linux system intsalled on this laptop.
When I had installed on this laptop Arch linux, I can set it up by following this article:
https://wiki.archlinux.org/index.php/Software_access_point
Then I were able to use this WiFi adapter as a wireless client and software AP.
Can it be set up as a wireless client and software AP with this single Wi-Fi device on Gentoo Linux too? _________________ Best, Pali |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Sun Feb 12, 2017 1:36 pm Post subject: |
|
|
When it is only software related yes. Same steps should work |
|
Back to top |
|
|
paul_chany Tux's lil' helper
Joined: 01 Aug 2010 Posts: 82 Location: Europe, Serbia
|
Posted: Mon Mar 13, 2017 8:05 pm Post subject: |
|
|
Roman_Gruber wrote: | When it is only software related yes. Same steps should work |
Well, I tried to follow the steps, but at the end I fail.
What I did are followings:
Code: | emerge -aj hostapd haveged macchange
ifconfig
/etc/hostapd/hostapd.conf
interface=wlp3s0
ssid=someName
wpa_passphrase=password
iw dev wlp3s0 interface add wlp3s0_sta type managed 4addr on
iw dev wlp3s0 interface add wlp3s0_ap type managed 4addr on
macchanger -r wlp3s0_ap
Current MAC: 68:94:23:43:fa:8b (Hon Hai Precision Ind. Co.,Ltd.)
Permanent MAC: 68:94:23:43:fa:8b (Hon Hai Precision Ind. Co.,Ltd.)
New MAC: a2:97:a2:55:53:be (unknown)
macchanger -r wlp3s0_sta
Current MAC: 68:94:23:43:fa:8b (Hon Hai Precision Ind. Co.,Ltd.)
Permanent MAC: 68:94:23:43:fa:8b (Hon Hai Precision Ind. Co.,Ltd.)
New MAC: c6:aa:80:2f:da:26 (unknown)
Wi-Fi link layer
ip link set dev wlp3s0_ap up |
Then I follow this:
https://wiki.gentoo.org/wiki/Network_bridge
Code: |
/etc/conf.d/net
# Set up the initial layer 2 bridge interface
bridge_br0="enp2s0f0"
# bridge
config_br0="192.168.1.199 netmask 255.255.255.0"
routes_br0="default via 192.168.1.254"
bridge_forward_delay_br0=0
bridge_hello_time_br0=1000
ln -s /etc/init.d/net.lo /etc/init.d/net.br0
rc-service net.br0 start
rc-update add net.br0 default
/etc/init.d/hostapd start |
* Bringing up interface wlp3s0_ap
* Starting wpa_supplicant on wlp3s0_ap ...
Successfully initialized wpa_supplicant [ ok ]
* Starting wpa_cli on wlp3s0_ap ... [ ok ]
* Backgrounding ... ...
* WARNING: net.wlp3s0_ap has started, but is inactive
* WARNING: hostapd will start when net.wlp3s0_ap has started
What am I missing here?? _________________ Best, Pali |
|
Back to top |
|
|
cboldt Veteran
Joined: 24 Aug 2005 Posts: 1046
|
Posted: Mon Mar 13, 2017 8:16 pm Post subject: |
|
|
Maybe missing nothing. I get the same WARNING type messages here on starting wireless network, and the things that are delayed until the network is up, are just delayed until the network comes up. When the network comes up (which it does "every time"), those other services start.
I can prove my network is up by the "route" or "ifconfig" commands.
I'm not saying your hostap is up, but the fact that startup threw warning that it hadn't started YET, does not mean it didn't start "eventually" - usually a few seconds later. |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Mon Mar 13, 2017 9:22 pm Post subject: |
|
|
paul_chany ...
I can see a number of problems, the bigest of which is you're not configuring wlp3s0_ap as 'null' and are not adding to it the bridge (you're adding enp2s0f0, which just adds to the confusion). You're also setting hostapd INTERFACES to wlp3s0 rather than br0. Anyhow, before trying to address any of that one simple question, if you have enp2s0f0, then why create a phy on wlp3s0? Surely this isn't needed, if this is the case. I think (though I'm not sure) what you want is this:
/etc/conf.d/hostapd: | INTERFACES="br0" |
/etc/hostapd/hostapd.conf: | interface=wlp3s0
bridge=br0
ssid=someName
wpa_passphrase=password |
/etc/conf.d/net: | config_enp2s0f0="192.168.1.198/24"
routes_enp2s0f0="default via 192.168.1.254"
modules_wlp3s0="!plug !iwconfig !wpa_supplicant"
config_wlp3s0="null"
rc_need_wlp3s0="hostapd"
bridge_br0="enp2s0f0"
rc_need_br0="net.enp2s0f0"
config_br0="192.168.1.199/24"
bridge_add_wlp3s0="br0" |
It has been a while since I did anything with hostapd (on gentoo at least) so I may be a little rusty, but the above should setup 'wlp3s0 => br0 => enp2s0f0', though I think you also need to 'echo 1 > /proc/sys/net/ipv4/ip_forward' ... which you could do in preup()
HTH & best ... khay |
|
Back to top |
|
|
paul_chany Tux's lil' helper
Joined: 01 Aug 2010 Posts: 82 Location: Europe, Serbia
|
Posted: Tue Mar 14, 2017 8:43 am Post subject: |
|
|
khayyam wrote: | paul_chany ...
I can see a number of problems, the bigest of which is you're not configuring wlp3s0_ap as 'null' and are not adding to it the bridge (you're adding enp2s0f0, which just adds to the confusion). You're also setting hostapd INTERFACES to wlp3s0 rather than br0. Anyhow, before trying to address any of that one simple question, if you have enp2s0f0, then why create a phy on wlp3s0? Surely this isn't needed, if this is the case. I think (though I'm not sure) what you want is this:
/etc/conf.d/hostapd: | INTERFACES="br0" |
/etc/hostapd/hostapd.conf: | interface=wlp3s0
bridge=br0
ssid=someName
wpa_passphrase=password |
/etc/conf.d/net: | config_enp2s0f0="192.168.1.198/24"
routes_enp2s0f0="default via 192.168.1.254"
modules_wlp3s0="!plug !iwconfig !wpa_supplicant"
config_wlp3s0="null"
rc_need_wlp3s0="hostapd"
bridge_br0="enp2s0f0"
rc_need_br0="net.enp2s0f0"
config_br0="192.168.1.199/24"
bridge_add_wlp3s0="br0" |
It has been a while since I did anything with hostapd (on gentoo at least) so I may be a little rusty, but the above should setup 'wlp3s0 => br0 => enp2s0f0', though I think you also need to 'echo 1 > /proc/sys/net/ipv4/ip_forward' ... which you could do in preup()
HTH & best ... khay |
What I want is the followings.
This issue that I want to accomplish is on my laptop on which Gentoo linux is running.
At home I connect the laptop through ethernet cable to my Cable Modem, without any problem.
At school I have Wireless connection to the Internet only. At school I want to use the same WiFi adapter of my laptop to connect to the Internet and to share to my pupils the Internet through this same WiFi adapter. This is my issue here. So my mistake here is that that I want to use ethernet connection to the Internet, which is wrong in this case.
So I think ( maybe I am wrong ) that that I should setup 'wlp3s0 => br0 => wlp3s0', right? _________________ Best, Pali |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Tue Mar 14, 2017 12:14 pm Post subject: |
|
|
paul_chany wrote: | At home I connect the laptop through ethernet cable to my Cable Modem, without any problem. At school I have Wireless connection to the Internet only. At school I want to use the same WiFi adapter of my laptop to connect to the Internet and to share to my pupils the Internet through this same WiFi adapter. |
paul_chany ... if wlp3s0_sta can connect to the schools wireless, then other clients in the same locale (that might connect to wlp3s0_ap) can similarly connect (as all clients would be within range of that AP). By placing wlp3s0_ap in between you are creating a bottleneck, is there a reason why students can't connect to the same AP that your client does?
paul_chany wrote: | This is my issue here. So my mistake here is that that I want to use ethernet connection to the Internet, which is wrong in this case. So I think ( maybe I am wrong ) that that I should setup 'wlp3s0 => br0 => wlp3s0', right? |
No, those interfaces are the same, you would need to use the phy. Previously you had set the ethernet device as the interface that wlp3s0_ap would use, so, you would place so wlp3s0_sta in its place. To do this you would need to create the phy in a preup(), eg:
/etc/conf.d/net: | preup() {
if [ ${IFACE} = "wlp3s0" ] ; then
iw dev "${IFACE}" interface add "${IFACE}_sta" type managed 4addr on
iw dev "${IFACE}" interface add "${IFACE}_ap" type managed 4addr on
fi
return 0
} |
As for your machanger, you might also need to put this is preup(), but it may work by adding the following:
/etc/conf.d/net: | mac_wlp3s0_sta="random-samekind"
mac_wlp3s0_ap="random-samekind" |
HTH & best
ps, no need to quote the whole post, just the section you're replying to. |
|
Back to top |
|
|
paul_chany Tux's lil' helper
Joined: 01 Aug 2010 Posts: 82 Location: Europe, Serbia
|
Posted: Tue Mar 14, 2017 1:15 pm Post subject: |
|
|
khayyam wrote: | paul_chany wrote: | At home I connect the laptop through ethernet cable to my Cable Modem, without any problem. At school I have Wireless connection to the Internet only. At school I want to use the same WiFi adapter of my laptop to connect to the Internet and to share to my pupils the Internet through this same WiFi adapter. |
paul_chany ... if wlp3s0_sta can connect to the schools wireless, then other clients in the same locale (that might connect to wlp3s0_ap) can similarly connect (as all clients would be within range of that AP). By placing wlp3s0_ap in between you are creating a bottleneck, is there a reason why students can't connect to the same AP that your client does? | Yes, the reason is that that my pupils can not knows the WiFi password of the school, but can know WiFi password of mine WiFi AP that is running on my laptop. _________________ Best, Pali |
|
Back to top |
|
|
paul_chany Tux's lil' helper
Joined: 01 Aug 2010 Posts: 82 Location: Europe, Serbia
|
Posted: Sun Mar 19, 2017 7:37 pm Post subject: |
|
|
For what I want to do is maybe best to create a software AP with hostapd on my laptop.
Then my pupils can uses their mobil phones to connect to the wireless LAN of my laptop and there reach my Moodle local site, mining that that this Moodle site is running only on my laptop and can reached only in this wireless LAN. In this case pupils should not reach the Internet at all, but only my Moodle site which is running on my laptop. _________________ Best, Pali |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3137
|
Posted: Sun Mar 19, 2017 8:53 pm Post subject: |
|
|
Yes, you can do that. As long as you don't explicitly bridge that ap to the network (or route traffic), your AP will effectively be isolated sector.
Bear in mind that a single wifi can only work on one channel at any time, so if you want to connect to school's wifi and let the pupils connect to you, they will share school AP's bandwidth anyway.
Second device sending data at the same time would clash with the first jamming both transmissions, regardless of the access point they are talking to. If they see each other, they must wait for each other. |
|
Back to top |
|
|
paul_chany Tux's lil' helper
Joined: 01 Aug 2010 Posts: 82 Location: Europe, Serbia
|
Posted: Sun Mar 19, 2017 9:11 pm Post subject: |
|
|
szatox wrote: | Yes, you can do that. As long as you don't explicitly bridge that ap to the network (or route traffic), your AP will effectively be isolated sector.
Bear in mind that a single wifi can only work on one channel at any time, so if you want to connect to school's wifi and let the pupils connect to you, they will share school AP's bandwidth anyway.
Second device sending data at the same time would clash with the first jamming both transmissions, regardless of the access point they are talking to. If they see each other, they must wait for each other. | So then if I want to allow for my pupils to connect to my laptop's own wireless LAN, then I must disconnect laptop's WiFi connection to school AP's first. Right? _________________ Best, Pali |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3137
|
Posted: Mon Mar 20, 2017 10:27 pm Post subject: |
|
|
Wrong. You can stay connected yourself. However, your MASTER and your STA interfaces refer to the same physical device, which can only use one frequency at any time. Using this feature you end up with 2 networks in close proximity sharing the same medium, so all machines connected to either of those networks will compete for bandwidth.
Depending on your use case this may or may not be an issue. E.g. if you're worried about bandwidth on the connection to the outer world, that distant connection is likely to be the bottleneck anyway, so there is no problem. Your pupils can't access it.
However, if you transfer a lot of data within your private sector, you may just as well jam the main network because you're sharing the same channel. In this case it won't be a problem for you (you are in a single room = excellent signal strength), but you may be a problem for other people trying to use the main AP over slightly larger distance, or separated by a wall.
Something to be aware of. Wifi is a bad neighbour for wifi.
On the other hand, if you decide to disconnect yourself, you will be able to pick another frequency. If you go 6 channels away from other networks, your frequencies will not overlap. Something around 12 channels in case of N networks.
In this case those networks will NOT share the same medium even if they are in the same room, which means each of those networks can have all of it's bandwidth for itself. But you have to find another way to reach out to the internet. Like wire yourself or somethin' |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|