wifi extender
**************************** EDIT ********************************************
FOR ALL LOOKING FOR A WORKING WIFI EXTENDER USING THE RASPBERRY PI,
THIS IS IT!!!! I'VE ADDED THIS TO THE FRONT OF THE THREAD SO YOU KNOW THAT
IN THE LONG RUN EVERYTHING WORKS. PLEASE FOLLOW THE THREAD TO READ
THE DETAILS OF MY QUESTIONS, THE ANSWERS, AND EVERYTHING I HAD TO DO.
I HOPE THIS PROVES USEFUL FOR OTHERS!
*******************************************************************************
I've seen posts for using a Pi to build a wifi extender. I've been trying this out just so I can learn more. I have 2 wifi adapters but they are not the same chipset and not from the same manufacturer. 1 of those does allow being an access point while the other does not. I "sort of" had this working a while back but had other more important things to do so this has just sat on a corner of the desk. Now I have some time to get back to it, and a question occurred to me that I can't find any answer for:
- given 2 different wireless adapters, is there a way to force 1 to wlan0 and 1 to wlan1?
In order to set up the access point and have dhcp hand out the addresses I need to be specifically using just 1 of the adapters. The other can only be used as the gateway to the wireless network I'm trying to extend.
I know at boot time I can't be guaranteed which adapter will be recognized as wlan0 versus wlan1.
Is there someway, perhaps through udef rules, to force a given adapter to a singular wlanx id?
Thanks!
FOR ALL LOOKING FOR A WORKING WIFI EXTENDER USING THE RASPBERRY PI,
THIS IS IT!!!! I'VE ADDED THIS TO THE FRONT OF THE THREAD SO YOU KNOW THAT
IN THE LONG RUN EVERYTHING WORKS. PLEASE FOLLOW THE THREAD TO READ
THE DETAILS OF MY QUESTIONS, THE ANSWERS, AND EVERYTHING I HAD TO DO.
I HOPE THIS PROVES USEFUL FOR OTHERS!
*******************************************************************************
I've seen posts for using a Pi to build a wifi extender. I've been trying this out just so I can learn more. I have 2 wifi adapters but they are not the same chipset and not from the same manufacturer. 1 of those does allow being an access point while the other does not. I "sort of" had this working a while back but had other more important things to do so this has just sat on a corner of the desk. Now I have some time to get back to it, and a question occurred to me that I can't find any answer for:
- given 2 different wireless adapters, is there a way to force 1 to wlan0 and 1 to wlan1?
In order to set up the access point and have dhcp hand out the addresses I need to be specifically using just 1 of the adapters. The other can only be used as the gateway to the wireless network I'm trying to extend.
I know at boot time I can't be guaranteed which adapter will be recognized as wlan0 versus wlan1.
Is there someway, perhaps through udef rules, to force a given adapter to a singular wlanx id?
Thanks!
Last edited by squakie on Wed Jun 15, 2016 4:11 am, edited 1 time in total.
Re: wifi extender
It would appear that via udev rules I can set a network name by the MAC address of the adapter. However, can't use ethx or wlanx because of the unknown timing at boot. So I need to use names like NET0 and NET1. Given that I have the MACs so I can set up the appropriate udev rules, and I know the driver each needs, I'm GUESSING the I need to set up the interfaces file but using NET0 and NET1 as well as loopback. That way I can be sure that with forwarding I know I will have the correct adapters each time, and setup DHCP and DNS (? maybe I'm thinking of something else here?) for the netx name I have assigned to the adapter that supports access point. But here's the thing - I *think* this is what I need to do, and I can try it, but I'm not sure on the syntax of both the udev rules for the adapters and the interfaces file. If I'm assuming correctly - so I can get the udev rules set up - do I use the NET0 and NET1 names in the interfaces file as I think I would?
Thanks for ANY input!
Thanks for ANY input!
Re: wifi extender
Well, I've made some progress:
To assign a specific adapter to a given name, you must define all of the wireless adapters in a udev rules file using each adapter's MAC address. If I do iwconfig or iwlist the interfaces (I'm using 2 wireless adapters) as net0 and net1. I also defined the eth0 name in the same rule file as enet0.
I'm still having problems trying to figure out the interfaces iface definition for net0 so I can get it actually logon to my existing wifi network (e.g, net0 is the connection to the existing wireless net while net1 will be the new access point). I've tried the following in the iface definition for net0:
wpa-ssid "<my existing wireless network's ssid>"
wpa-psk "xxxxxxxxxxxxxxx"
never does anything with net0 at boot, can do ifup/down with no error messages.
Changed the iface def to "static", then added:
address 192.168.0.25
subnetmask 255.255.255.0
gateway 192.168.0.1
along with the above wpa-* lines. Still nothing.
I think it's becoming apparent I'm not understanding the interfaces file correctly. I've tried reading things online about the file and for different definitions but I must not be understanding how to implement those things correctly. I am down to purely guessing with things I don't even understand to begin with - not a good way to troubleshoot.
If ANYONE can provide any guidance it would be greatly appreciated. It's ok to call me a dumb-a** as I obviously am.
To assign a specific adapter to a given name, you must define all of the wireless adapters in a udev rules file using each adapter's MAC address. If I do iwconfig or iwlist the interfaces (I'm using 2 wireless adapters) as net0 and net1. I also defined the eth0 name in the same rule file as enet0.
I'm still having problems trying to figure out the interfaces iface definition for net0 so I can get it actually logon to my existing wifi network (e.g, net0 is the connection to the existing wireless net while net1 will be the new access point). I've tried the following in the iface definition for net0:
wpa-ssid "<my existing wireless network's ssid>"
wpa-psk "xxxxxxxxxxxxxxx"
never does anything with net0 at boot, can do ifup/down with no error messages.
Changed the iface def to "static", then added:
address 192.168.0.25
subnetmask 255.255.255.0
gateway 192.168.0.1
along with the above wpa-* lines. Still nothing.
I think it's becoming apparent I'm not understanding the interfaces file correctly. I've tried reading things online about the file and for different definitions but I must not be understanding how to implement those things correctly. I am down to purely guessing with things I don't even understand to begin with - not a good way to troubleshoot.
If ANYONE can provide any guidance it would be greatly appreciated. It's ok to call me a dumb-a** as I obviously am.
Re: wifi extender
I have made progress - note that i have x out any identification to my MAC addresses and my network logon.
Have the udev rule:
And the interfaces file:
ifconfig shows:
I configured the hostapd.conf and udhcpd.conf files as per the adafruit instructable for a wifi hotspot.
My network SSID from net1(the new access point) never shows up.
when I start the services hostapd and udhcpd I get no errors on my terminal.
Thank you for ANY help anyone could give me.
Have the udev rule:
Code: Select all
SUBSYSTEM=="net", ACTION=="add" ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="net0"
SUBSYSTEM=="net", ACTION=="add" ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="net1"
SUBSYSTEM=="net", ACTION=="add" ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="elan0"
Code: Select all
auto lo
iface lo inet loopback
iface elan0 inet manual
allow-hotplug net0
iface net0 inet manual
wpa-ssid "xxxxxxxx"
wpa-psk "xxxxxxxxxxxx"
allow-hotplug net1
iface net1 inet static
address 192.168.42.1
netmask 255.255.255.0
up iptables-restore < /etc/iptables.ipv4.nat
Code: Select all
lan0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet6 addr: xxxx::xxxx:xxxx:xxxx:xxxx/xx Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:328 errors:0 dropped:0 overruns:0 frame:0
TX packets:328 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:27024 (26.3 KiB) TX bytes:27024 (26.3 KiB)
net0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.0.20 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: xxxx::xxxx:xxxx:xxxx:xxxx/xx Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4977 errors:0 dropped:0 overruns:0 frame:0
TX packets:2451 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4929681 (4.7 MiB) TX bytes:271214 (264.8 KiB)
net1 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.42.1 Bcast:192.168.42.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) [code]
iwconfig shows:[code]net0 IEEE 802.11bgn ESSID:"fargojoe"
Mode:Managed Frequency:2.427 GHz Access Point: xx:xx:xx:xx:xx:xx
Bit Rate=72.2 Mb/s Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=63/70 Signal level=-47 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:7 Missed beacon:0
net1 IEEE 802.11abgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=30 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
My network SSID from net1(the new access point) never shows up.
when I start the services hostapd and udhcpd I get no errors on my terminal.
Thank you for ANY help anyone could give me.
Re: wifi extender
I've made so good(?) progress:
Had to change the iface definition for net0 in the /etc/interfaces file to use the wpa_supplicant configure file. Had worked as-is on a Pi 2 model B but was having power issues with the Pi 2. So I switched to a Pi 3 and then the wpa key and ssid specified in interfaces wouldn't work - so I went with the wpa_supplicant configuration file and the interfaces file works on both the Pi 2 and the Pi 3.
Had to change the /etc/default/hostapd file: had wpa_key but had to change it to wpa_passphrase. Just that change made all the difference.
I now have net1 associated with my new ssid and broadcasting. So there's a big step.
Now I'm afraid I am at the end of any pretend knowledge I may have had (read: just following how-to's on the net). I still cannot connect to that new network. Locally on the Pi 3 I can if I force net0 to the new ssid and passphrase. That connects, however with the Pi 3's internal wireless adapter (net0) now connect to the new ssid it obviously can't get to the net because I disconnected from the net in order to try to connect to the new ssid.
If I leave net0 connected as normal and have net1 broadcasting the new ssid (e.g, acting as the new wireless access point) I see the new ssid on my laptop but trying to connect is just in an endless loop of "checking network requirements" or some such thing (it is Windows) and never finishes connecting. No error messages show in the terminal window where I started hostapd and udhcpd. So, I'm way over my head here and looking for some guidance.
Also, I defined net1 (the new access point) in the /etc/interfaces file as an address of 192.168.42.1 as shown in one of the how-to's. I also defined the range in the hostapd (or was it udhcpd) file as 192.168.42.2 to 192.168.42.20, again following one of the how-to's. I don't really understand any of that - I *think* it's saying that net1 will be on a subnet of 192.168.42.xx but I really don't know. In addition, I thought the range would be 192.168.42 to 192.168.42.20. However, the ifconfig and iwconfig show net1 (the new access point) as 169.254.134.222/16 - I have *NO* idea if that is correct given what I *thought* I was defining.
So, I have a new access point. iwconfig and ifconfig don't show an address in the range I was thinking, and I can't connect to the new access point even though it is being broadcast. At least I *think* that's what all this means.
Since I have been following how-to's but don't really understand it all, perhaps someone with networking experience could tell me everything I have wrong and what all the 192.xxx.xxx.xxx verus 169.xxx.xxx.xxx "stuff" really means and what they are called(terminology and definitions I haven't been able to glean from the net nor examples I could vaguely understand).
It feels like I am close but this may all be one of those "it's doing something, but not what you think or how you think" sort of things. I am all green behind the ears!
Had to change the iface definition for net0 in the /etc/interfaces file to use the wpa_supplicant configure file. Had worked as-is on a Pi 2 model B but was having power issues with the Pi 2. So I switched to a Pi 3 and then the wpa key and ssid specified in interfaces wouldn't work - so I went with the wpa_supplicant configuration file and the interfaces file works on both the Pi 2 and the Pi 3.
Had to change the /etc/default/hostapd file: had wpa_key but had to change it to wpa_passphrase. Just that change made all the difference.
I now have net1 associated with my new ssid and broadcasting. So there's a big step.
Now I'm afraid I am at the end of any pretend knowledge I may have had (read: just following how-to's on the net). I still cannot connect to that new network. Locally on the Pi 3 I can if I force net0 to the new ssid and passphrase. That connects, however with the Pi 3's internal wireless adapter (net0) now connect to the new ssid it obviously can't get to the net because I disconnected from the net in order to try to connect to the new ssid.
If I leave net0 connected as normal and have net1 broadcasting the new ssid (e.g, acting as the new wireless access point) I see the new ssid on my laptop but trying to connect is just in an endless loop of "checking network requirements" or some such thing (it is Windows) and never finishes connecting. No error messages show in the terminal window where I started hostapd and udhcpd. So, I'm way over my head here and looking for some guidance.
Also, I defined net1 (the new access point) in the /etc/interfaces file as an address of 192.168.42.1 as shown in one of the how-to's. I also defined the range in the hostapd (or was it udhcpd) file as 192.168.42.2 to 192.168.42.20, again following one of the how-to's. I don't really understand any of that - I *think* it's saying that net1 will be on a subnet of 192.168.42.xx but I really don't know. In addition, I thought the range would be 192.168.42 to 192.168.42.20. However, the ifconfig and iwconfig show net1 (the new access point) as 169.254.134.222/16 - I have *NO* idea if that is correct given what I *thought* I was defining.
So, I have a new access point. iwconfig and ifconfig don't show an address in the range I was thinking, and I can't connect to the new access point even though it is being broadcast. At least I *think* that's what all this means.
Since I have been following how-to's but don't really understand it all, perhaps someone with networking experience could tell me everything I have wrong and what all the 192.xxx.xxx.xxx verus 169.xxx.xxx.xxx "stuff" really means and what they are called(terminology and definitions I haven't been able to glean from the net nor examples I could vaguely understand).
It feels like I am close but this may all be one of those "it's doing something, but not what you think or how you think" sort of things. I am all green behind the ears!
Re: wifi extender
Ok, one step closer. I added "authoritative" to the end of the /etc/udhcpd/udhcpd.conf file as it said to use that option if it was the DNS server for the network to hand out IP addresses. That solved the connection issue as I can now connect to the access point.
However, I don't get any internet access. I'm only guessing that somehow the IP addresses in the 169.254.134.xxx range are somehow part of the reason. I *think* I have the iptables entries correct - I just copied the iptables statements in the how-to's and then did the save and added the "up" statement in /etc/network/interfaces to copy the saved rules back.
However, I don't get any internet access. I'm only guessing that somehow the IP addresses in the 169.254.134.xxx range are somehow part of the reason. I *think* I have the iptables entries correct - I just copied the iptables statements in the how-to's and then did the save and added the "up" statement in /etc/network/interfaces to copy the saved rules back.
Re: wifi extender
Are you using Rasbian Jessie?
Most instructions are for Wheezy which is not the same
e.g. Static addresses are set up in /etc/dhcpcd.conf like this:-
I don't know if two wlan adapters is an exception but /etc/network/interfaces should be left alone in Jessie!
Most instructions are for Wheezy which is not the same

e.g. Static addresses are set up in /etc/dhcpcd.conf like this:-
Code: Select all
interface wlan0
static ip_address=192.168.0.25
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org
Re: wifi extender
Yep - it's Jessie. I did notice things were different, however with udhcpd and hostapd installed it appeared the config files were there. I had looked at the dhcpd.conf file but for some reason thought it was client side. My boo-boo.
So, how, in Jessie, am I supposed to get rid of the eth0, wlan0 and wlan1 names and instead use the ones by MAC address defined in a udev rule? If I don't keep that control, I lose the ability to be sure the access point is assigned to the proper wifi adapter. Without that control, I'm sunk. I also don't need or at least see no need for the access point iface definition to use wpa_supplicant as the generated interfaces file would have. It would be ok if the wifi adapters were duplicates, but in my case they aren't (nor would they be with a Pi 3 internal wifi and a usb wifi adapter).
Any ideas on an updated how-to for Jessie?
Thanks!
Dave
So, how, in Jessie, am I supposed to get rid of the eth0, wlan0 and wlan1 names and instead use the ones by MAC address defined in a udev rule? If I don't keep that control, I lose the ability to be sure the access point is assigned to the proper wifi adapter. Without that control, I'm sunk. I also don't need or at least see no need for the access point iface definition to use wpa_supplicant as the generated interfaces file would have. It would be ok if the wifi adapters were duplicates, but in my case they aren't (nor would they be with a Pi 3 internal wifi and a usb wifi adapter).
Any ideas on an updated how-to for Jessie?
Thanks!
Dave
Re: wifi extender
Well, some if the interfaces stuff does work - like the new interface names. However, after some research on what you mentioned about dhcpd and static addresses it does indeed explain some errors. I checked my suspicion and found that net0 did not get the ip address I was trying to assign in the interfaces file. This in turn means that the new access point was not assigned the ip address I was trying to assign either - and this is the cause of all the screwy 169.254.134.xxx ip addresses. It thought none were defined so it makes assignments in this range. So.......
I'm suspecting I don't need to install udhcpd if dhcpd is present.
So - I'm going to burn a new image to the microsd card and start over with just the udev rules file and changing the interface names in the interfaces file - oh, and remove the wpa-supplicant info from the iface for net1.
Once I see it is working again to that point, I will work on getting static IP addresses via the method you mentioned.
Once that works I'll install hostapd and configure it. Then I'll check to see if the dhcpd files are present - if so I won't install the udhcpd package. I also see a completely different syntax for setting up the subnet also in the dhcpcd.conf file. *Hopefully* the next time I post back it will be working.
I do believe it will take the mix of udev, interfaces and the dhcpcd configuration files to do what I need.
Thanks *SO* much!! Researching what you said I think I understand more and see the changes I think I need to make!
Dave
I'm suspecting I don't need to install udhcpd if dhcpd is present.
So - I'm going to burn a new image to the microsd card and start over with just the udev rules file and changing the interface names in the interfaces file - oh, and remove the wpa-supplicant info from the iface for net1.
Once I see it is working again to that point, I will work on getting static IP addresses via the method you mentioned.
Once that works I'll install hostapd and configure it. Then I'll check to see if the dhcpd files are present - if so I won't install the udhcpd package. I also see a completely different syntax for setting up the subnet also in the dhcpcd.conf file. *Hopefully* the next time I post back it will be working.
I do believe it will take the mix of udev, interfaces and the dhcpcd configuration files to do what I need.
Thanks *SO* much!! Researching what you said I think I understand more and see the changes I think I need to make!
Dave
Re: wifi extender
Well, I now have static IP addresses as best as I can tell. However the ssid of the subnet is not being broadcast. No message in terminal when I started hostapd and dhcpcd.
I've looked online for anything the details declaring a subnet in Jessie, but the only thing I found was for crossing subnets and I don't even know what that means.
It looked like the subnet definitions go in /etc/dhcpcd.conf, so I did my best to put it there but with no clear example I'm just guessing.
The 10-netadapters.rules file in /etc/udev/rules.d remains unchanged - it is changing the names to elan0, net0 and net1. The new interfaces file looks like below:
The /etc/dhcpcd.conf file looks like below:
I don't have a clue what anything means before I defined the interfaces ip addresses, etc.. Additionally, I could find no reference for how this is supposed to look.
The /etc/hostapd/hostapd.conf file follows:
Can anyone provide any link to any sort of documentation for this in jessie?
If anyone can help in anyway it would be greatly appreciated!
Thanks!
I've looked online for anything the details declaring a subnet in Jessie, but the only thing I found was for crossing subnets and I don't even know what that means.
It looked like the subnet definitions go in /etc/dhcpcd.conf, so I did my best to put it there but with no clear example I'm just guessing.
The 10-netadapters.rules file in /etc/udev/rules.d remains unchanged - it is changing the names to elan0, net0 and net1. The new interfaces file looks like below:
Code: Select all
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces:
source-directory /etc/network/interfaces
auto lo
iface lo inet loopback
iface elan inet manual
allow-hotplug net0
iface net0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug net1
iface net1 inet manual
up iptables-restore < /etc/iptables.ipv4.nat
Code: Select all
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.hostname
# Use the hardware address of the interface for the Client ID.clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
#duid
# Persist interface configuration when dhcpcd exits.
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A list of options to request from the DHCP server.option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU.
# Some interface drivers reset when changing the MTU so disabled by default.
#option interface_mtu
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private
# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
nohook lookup-hostname
interace elan0
static ip_address=192.168.0.2/24
static routers=192.168.0.1
static domain_name_servers=8.8.8.8 8.8.4.4
interface net0
static ip_address=192.168.0.3/24
interface net1
static ip_address=192.168.42.1/24
# Declare subnet for net1 access point
#
subnet192.168.42.0 netmask 255.255.255.0 {
authoritative;
range 192.168.42.2 192.168.42.20;
default-lease-time 3600;
max-lease-time 3600;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.42.255;
option routers 192.168.42.1;
}
The /etc/hostapd/hostapd.conf file follows:
Code: Select all
interface=net1
ssid=fargojoe2
channel=7
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=xxxxxxxx
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ieee80211n=1
hw_mode=g
If anyone can help in anyway it would be greatly appreciated!
Thanks!
Re: wifi extender
I'm going to send you a PM.
In the mean time could you post a diagram of what you are planning?
In the mean time could you post a diagram of what you are planning?
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org
Re: wifi extender
** **** ***
** cloud ** <---> router <-> wireless adapter net0 connected to normal ssid from router
** **** *** wireless adapter net1 broadcasting 2nd ssid - "extended", users connect here from a distance
net0<-> net1
** cloud ** <---> router <-> wireless adapter net0 connected to normal ssid from router
** **** *** wireless adapter net1 broadcasting 2nd ssid - "extended", users connect here from a distance
net0<-> net1
Re: wifi extender
deleted by drgeoff
Last edited by drgeoff on Thu Jun 09, 2016 12:04 pm, edited 1 time in total.
Quis custodiet ipsos custodes?
Re: wifi extender
dhcpd.conf is not dhcpcd.confsquakie wrote:I had looked at the dhcpd.conf file but for some reason thought it was client side.
Quis custodiet ipsos custodes?
Re: wifi extender
Couldn't find the dhcpd.conf file. I installed udhcpd again and set it up. The results:
- as per before, the network adapter names are changed to elan0, net0 and net1
- /etc/interfaces changed, as per before, to reflect those names, however "static" was remove as was the address
- the above changes work
- configured hostapd
- configured udhcpd.conf
- start both services
- both network adapters show with the static IP addresses I assigned in dhcpcd.conf
- new network access point is being broadcast
- on the Pi itself I can connect to the new network access point -perhaps due to internal things I have no clue about
- trying to connect my Android tablet just gets stuck at "Obtaining network address"
- trying to connect from my Windows 10 PC shows "Checking network requirements" and never connects
So, again I am way beyond my simple knowledge. There are no how-to's, etc., that I could find with a search on the net that says how to this in Raspian Jessie or Debian Jessie.
Some of the how-to's say to install isc-dhcp-server which must be superceded by something as it is not found in the default repositories.
So, if someone can say something other than the files aren't the same, perhaps like "in Jessie you need to configure your dhcp using xxxxxx and it's config file xxxxxx" it would give me a leg up on what to try to search for and what to try next.
I do know that dhcpcd is the client side - but this is where I had to declare the static IP addresses. What I have NO clue about is what, if any, package to install for the dhcp server and what configuration file it uses.
Thanks for all of the replies - any further ideas/comments are greatly appreciated! Again, let me reiterate that I am at best a beginner and don't claim to understand much, if any, of this. Just trying to follow how-to's and the additional things pointed out that have changed in Jessie versus the how-to's being for wheezy.
- as per before, the network adapter names are changed to elan0, net0 and net1
- /etc/interfaces changed, as per before, to reflect those names, however "static" was remove as was the address
- the above changes work
- configured hostapd
- configured udhcpd.conf
- start both services
- both network adapters show with the static IP addresses I assigned in dhcpcd.conf
- new network access point is being broadcast
- on the Pi itself I can connect to the new network access point -perhaps due to internal things I have no clue about
- trying to connect my Android tablet just gets stuck at "Obtaining network address"
- trying to connect from my Windows 10 PC shows "Checking network requirements" and never connects
So, again I am way beyond my simple knowledge. There are no how-to's, etc., that I could find with a search on the net that says how to this in Raspian Jessie or Debian Jessie.
Some of the how-to's say to install isc-dhcp-server which must be superceded by something as it is not found in the default repositories.
So, if someone can say something other than the files aren't the same, perhaps like "in Jessie you need to configure your dhcp using xxxxxx and it's config file xxxxxx" it would give me a leg up on what to try to search for and what to try next.
I do know that dhcpcd is the client side - but this is where I had to declare the static IP addresses. What I have NO clue about is what, if any, package to install for the dhcp server and what configuration file it uses.
Thanks for all of the replies - any further ideas/comments are greatly appreciated! Again, let me reiterate that I am at best a beginner and don't claim to understand much, if any, of this. Just trying to follow how-to's and the additional things pointed out that have changed in Jessie versus the how-to's being for wheezy.
Re: wifi extender
Well, I installed synaptic package manager since that is what I'm used to using from other Linux distros. Searched again for the isc-dhcp-server package the how-to's say to install. Finally found out that every one of those how-to's need updating as the package is now the dhcpd server package - the description says it's the isc dhcp server.
So, back to square one again. It's so easy to just start over on the Pi's that I'm going to "burn" the Jessie image to the sdcard again, set up the udev rule, change the interfaces file, update the dhcpcd.conf file for the static ip addresses.
Then I'm going to follow one of the tutorials again, getting hostapd and dhcpd installed. From there I'll configure them as per one of the how-to's (the Adafruit how-to for a Raspberry Pi access point) and see what happens then.
It's much easier just starting over than using "find" to find anything that contains udhcp* in it's name and remove it.
So......back to step 1 and I'll post again what the results are.
So, back to square one again. It's so easy to just start over on the Pi's that I'm going to "burn" the Jessie image to the sdcard again, set up the udev rule, change the interfaces file, update the dhcpcd.conf file for the static ip addresses.
Then I'm going to follow one of the tutorials again, getting hostapd and dhcpd installed. From there I'll configure them as per one of the how-to's (the Adafruit how-to for a Raspberry Pi access point) and see what happens then.
It's much easier just starting over than using "find" to find anything that contains udhcp* in it's name and remove it.
So......back to step 1 and I'll post again what the results are.
Re: wifi extender
Well, it appears to be working. I am currently on my desktop PC, only about a foot from the new access point wireless adapter. I am connected to that access point and am on the net, so nat must be working as well.
I've been working on this all night and need to get some sleep before bringing supper over to my elderly parents.
Probably either late tonight (Sat., 6/11/2016) or else tomorrow I'll post what I did.
I've been working on this all night and need to get some sleep before bringing supper over to my elderly parents.
Probably either late tonight (Sat., 6/11/2016) or else tomorrow I'll post what I did.
Re: wifi extender
Well, something still not right. Desktop connects and has internet, so it's working for the desktop. I have my laptop (Android) right here by the Pi as well but it never gets past obtaining ip address - eventually stops trying and says the internet connection is slow. It is just as fast on my desktop as my desktop is when it's connected wirelessly to my "normal" ssid. i'm stumped on that. might try to research it later. it's weird it works fine with the desktop but not the tablet.
Re: wifi extender
AHA!! It's an Android problem - well documented on the net. The solution is to set up a fixed ip address, the router, etc. *IN* Android. Didn't change a thing with the Pi - only in Android - and it connects to the new access point just fine and works great! Unless, of course, this is a problem with the interaction of the isc-dhcp-server with Android 
I'll post steps later today for everything I did and images of the various files (with sensitive information removed).

I'll post steps later today for everything I did and images of the various files (with sensitive information removed).
Re: wifi extender
Cool and congrats, I look forward to seeing that. 

Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org
Re: wifi extender
Well, I'll try to summarize what I did and how here. Please be aware that NOTHING here is original - it's either taken from another net thread or a combination of ideas taken from more than 1 thread. Unfortunately at this time I actually do not remember what they all were and what I got from which ones. However, anyone who may have created any of those other threads: you have my deepest thanks!
First the objective: I wanted to learn about some things I had no clue about, and thought a wifi extender was a good start.
In the various threads I read all over the net, one thing became apparent: using the Pi as a wifi extender uses the same setup as using the Pi as a wifi access point - the only thing that differs is the network device that connects to the existing network. that is what a wifi extender on the Pi does - it offers a new access point at a distance further than the normal wireless can reach.
I also knew from my reading that the wireless adapter being used as the access point had to support access point (AP) as can be seen if you iwlist. Since the extender requires 2 wifi adapters I needed to purchase another one. I picked up a cheap USB one - and I mean $4 with shipping from Ebay - it has a small antenna but I don't think it amounts to much. That adapter does support 802.11 N at up to 150mbs. It doesn't even have a brand on it. It also does NOT support access point mode. However this adapter works fine for connecting to my existing network.
The second adapter I already had - USB, from StarTech. It has 2 rather substantial adjustable antennas. It DOES support access point mode.
So, I now had the 2 adapters but had another small obstacle to overcome. When the Pi boots you really don't get a whole lot of control over which becomes "wlan0" and which becomes "wlan1". Since I needed the cheap adapter to be forced to the existing network and the StarTech adapter would need to be referenced in the configuration files for the access point, I needed a way to "assign" the interface name so I always knew who was who. Most people never worry about a directory located as /etc/udev/rules.d . This directory contains files (rules) that define what certain hardware is and how it is "used" to the operating system. I've had some experience with that in the past so I thought there would be a way to do it with a new set of rules. Networking hardware also has a unique id, the MAC address. So, using the MAC address and a new rules file I set up the ethernet port as elan0, the cheap adapter as wnet0 and the StarTech adapter as wnet1. That rules file is as follows but I have x'd out my MAC addresses for security:
In conjunction with that I also had to change the file that "describes" the network interfaces to reflect those new names. I edited /etc/network/interfaces, changing the names, removing the reference to wpa_supplicant in the wnet1 definition and removed some comments, the result of which is (if I converted end-of-line characters correctly): That last line, "up iptables...." needs to there for the forwarding (nat) I will set up shortly.
At this point I rebooted and had a few boo-boos I had to correct to arrive at the above. I finally had working interfaces with the names I wanted.
At this point, it was time to install some additional software: Please note that all of the how-to's I read said to install isc-dhcp-server- this is an error! You install the dhcp-server package!
Next, I needed to assign static IP addresses to the interfaces. Where in previous version of Raspian you just put those in the /etc/network/interfaces file that no longer works in Raspian Jessie. I needed to edit the /etc/dhcpcd.conf file to define the static IP addresses. I wanted the 3 adapters/interfaces to be the first 3 usable ports on my existing subnet - again I hopefully translated the end-of-line characters correctly when copying it here. Also note that since wnet1 is going to be the new access point I made its static address in the subnet it will support:192.168.42.xxx .
At this point I had 2 things I needed: my defined names so I could identify each adapter/interface, requested static IP addresses. A look at ifconfig and iwconfig outputs confirmed this.
I should also note here: I forced a connection manually on the desktop from wnet0 (the cheap adapter) to my existing network so it would populate the wpa-supplicant.conf file so I wouldn't need to later. I would strongly suggest you do the same as it saves having to edit another file.
So with these steps completed I now needed to define the new access point via the /etc/hostapd/hostapd.conf file: Now that the configuration file was created, I needed to tell hostapd where it was by editing the /etc/default/hostapd file by first removing the "#" comment indicator from the front of the "DAEMON_CONF" line and then point it to the /etc/hostapd/hostapd.conf file: According to the how-to's I read I now needed to edit the file /etc/dhcp/dhcpd.conf. I believe that one of the things the dhcp daemon server does is provide the IP addresses to devices on the subnet. In this case, it will be providing those to devices on the new access point - the "extender" side of things. When I edited the /etc/dhcpcd.conf file as per earlier in this post, I assigned the subnet of 192.168.42.xxx to the new access point. The following is the /etc/dhcp/dhcpd.conf file after I adapted it to match my new definition: Note that the "authoritative" line is needed or you won't ever get an IP address - it will just hang there.
Once the above changes were made, I needed to tell the server to use this configuration file. To do so, I edited the /etc/default/isc-dhcp-server file to define the location of the configuration file and what interface/adapter to use -in my case "wnet1":Next I needed to allow the forwarding of network traffic by editing the /etc/sysctl.conf file and removing the comment (#) from in front of the line "# net.ipv4.ip_forward=1". My resulting file:Next to define the forwarding via iptables:Next I needed to save those routings to a file as they are lost on reboot:The restoration of these routings from this file is done via the "up" statement I added to the end of the /etc/network/interfaces files in the edit earlier:[up iptables-restore < /etc/iptables.ipv4.nat[/code]Now to the last 2 steps: set the hostapd and the dhcp servers to start on boot: Now - reboot and it should be ready to go!!
I hope I remembered everything and typed everything correctly. For just creating a wifi access point, change any references to wnet0 to what ever your wired ethernet port is called (the default is eth0 - I changed mine via the new rules file to elan0).
First the objective: I wanted to learn about some things I had no clue about, and thought a wifi extender was a good start.
In the various threads I read all over the net, one thing became apparent: using the Pi as a wifi extender uses the same setup as using the Pi as a wifi access point - the only thing that differs is the network device that connects to the existing network. that is what a wifi extender on the Pi does - it offers a new access point at a distance further than the normal wireless can reach.
I also knew from my reading that the wireless adapter being used as the access point had to support access point (AP) as can be seen if you iwlist. Since the extender requires 2 wifi adapters I needed to purchase another one. I picked up a cheap USB one - and I mean $4 with shipping from Ebay - it has a small antenna but I don't think it amounts to much. That adapter does support 802.11 N at up to 150mbs. It doesn't even have a brand on it. It also does NOT support access point mode. However this adapter works fine for connecting to my existing network.
The second adapter I already had - USB, from StarTech. It has 2 rather substantial adjustable antennas. It DOES support access point mode.
So, I now had the 2 adapters but had another small obstacle to overcome. When the Pi boots you really don't get a whole lot of control over which becomes "wlan0" and which becomes "wlan1". Since I needed the cheap adapter to be forced to the existing network and the StarTech adapter would need to be referenced in the configuration files for the access point, I needed a way to "assign" the interface name so I always knew who was who. Most people never worry about a directory located as /etc/udev/rules.d . This directory contains files (rules) that define what certain hardware is and how it is "used" to the operating system. I've had some experience with that in the past so I thought there would be a way to do it with a new set of rules. Networking hardware also has a unique id, the MAC address. So, using the MAC address and a new rules file I set up the ethernet port as elan0, the cheap adapter as wnet0 and the StarTech adapter as wnet1. That rules file is as follows but I have x'd out my MAC addresses for security:
Code: Select all
SUBSYSTEM=="net" ACTION=="add" ATTR{address}=="xx:xx:xx:xx:xx:xx" NAME="elan0"
SUBSYSTEM=="net" ACTION=="add" ATTR{address}=="xx:xx:xx:xx:xx:xx" NAME="wnet0"
SUBSYSTEM=="net" ACTION=="add" ATTR{address}=="xx:xx:xx:xx:xx:xx" NAME="wnet1"
Code: Select all
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces
auto lo
iface lo inet loopback
iface elan0 inet manual
allow-hotplug wnet0
iface wnet0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wnet1
iface wnet1 inet manual
up iptables-restore </etc/iptables.ipv4.nat
At this point I rebooted and had a few boo-boos I had to correct to arrive at the above. I finally had working interfaces with the names I wanted.
At this point, it was time to install some additional software:
Code: Select all
sudo apt-get install hostapd dhcp-server
Next, I needed to assign static IP addresses to the interfaces. Where in previous version of Raspian you just put those in the /etc/network/interfaces file that no longer works in Raspian Jessie. I needed to edit the /etc/dhcpcd.conf file to define the static IP addresses. I wanted the 3 adapters/interfaces to be the first 3 usable ports on my existing subnet - again I hopefully translated the end-of-line characters correctly when copying it here. Also note that since wnet1 is going to be the new access point I made its static address in the subnet it will support:192.168.42.xxx .
Code: Select all
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.hostname
# Use the hardware address of the interface for the Client ID
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
#duid
# Persist interface configuration when dhcpcd exits
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work
option rapid_commit
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU.
# Some interface drivers reset when changing the MTU so disabled by default
#option interface_mtu
# A ServerID is required by RFC2131
require dhcp_server_identifier
# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private
# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default
nohook lookup-hostname
interface elan0
static ip_address=192.168.0.2
static routers=192.168.0.1
static domain_name_servers=8.8.8.8, 8.8.4.4
interface wnet0
static ip_address=192.168.0.3
static routers=192.168.0.1
static domain_name_servers=8.8.8.8, 8.8.4.4
interface wnet1
static ip_address=192.168.42.1
I should also note here: I forced a connection manually on the desktop from wnet0 (the cheap adapter) to my existing network so it would populate the wpa-supplicant.conf file so I wouldn't need to later. I would strongly suggest you do the same as it saves having to edit another file.
So with these steps completed I now needed to define the new access point via the /etc/hostapd/hostapd.conf file:
Code: Select all
interface=wnet1
ssid=fargojoe2
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=xxxxxxxxxxx
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ieee80211n=1
hw_mode=g
Code: Select all
# Defaults for hostapd initscript
#
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
#
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz
#
DAEMON_CONF="/etc/hostapd/hostapd.conf"
# Additional daemon options to be appended to hostapd command:-
# -d show more debug messages (-dd for even more)
# -K include key data in debug messages
# -t include timestamps in some debug messages
#
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.
#
#DAEMON_OPTS=""
Code: Select all
ddns-update-style none;
default-lease-time 84600;
max-lease-time 84600;
authoritative;
subnet 192.168.42.0 netmask 255.255.255.0 {
range 192.168.42.2 192.168.42.20 ;
option domain-name-servers 192.168.42.1 ;
option routers 192.168.42.1 ;
}
Once the above changes were made, I needed to tell the server to use this configuration file. To do so, I edited the /etc/default/isc-dhcp-server file to define the location of the configuration file and what interface/adapter to use -in my case "wnet1":
Code: Select all
# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
DHCPD_CONF=/etc/dhcp/dhcpd.conf
# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid
# Additional options to start dhcpd with.
# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="wnet1"
Code: Select all
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#
#kernel.domainname = example.com
# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3
##############################################################3
# Functions previously found in netbase
#
# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
#net.ipv4.conf.default.rp_filter=1
#net.ipv4.conf.all.rp_filter=1
# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
# Enabling this option disables Stateless Address Autoconfiguration
# based on Router Advertisements for this host
#net.ipv6.conf.all.forwarding=1
###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
#net.ipv4.conf.all.send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv6.conf.all.accept_source_route = 0
#
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#
Code: Select all
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -i wnet0 -o wnet1 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wnet1 -o wnet0 -j ACCEPT
Code: Select all
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat
Code: Select all
sudo update-rc.d hostapd enable
sudo update-rc.d isc-dhcp-server enable
I hope I remembered everything and typed everything correctly. For just creating a wifi access point, change any references to wnet0 to what ever your wired ethernet port is called (the default is eth0 - I changed mine via the new rules file to elan0).
Last edited by squakie on Wed Jun 15, 2016 4:13 am, edited 2 times in total.
Re: wifi extender
I should probably mention something from a previous post in this thread: if you have an android device- tablet, phone, what-have-you, and when you try to connect to the extender you just get an "obtaining IP address", "scanning" and it just continues until Android gives up, you need to set a static IP address on the connection in the Android wireless settings. I had to set mine to 192.168.42.5 and everything works fine. I have no idea if this applies to iOS devices or not, but if you get the same type of behavior when trying to connect I would define a static IP address in iOS as well.
Re: wifi extender
And FINALLY - if you have any questions, comments, etc., please post them. I don't claim much in the way of any real knowledge but I'll try to answer your questions, reply to comments, etc.!
I hope this works for others!
Thanks for putting up with this thread!
I hope this works for others!
Thanks for putting up with this thread!
Re: wifi extender
Fantastic, excellent work and thanks for sharing. 

Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org
Re: wifi extender
Do you have an idea on how to tailor it for:
internet in via eth0 (and NetworkManager cos it allows VPN connections)
extension via wlan0 (in-built wifi module of Pi3)
internet in via eth0 (and NetworkManager cos it allows VPN connections)
extension via wlan0 (in-built wifi module of Pi3)