razza30
Posts: 8
Joined: Fri Jul 26, 2013 10:01 pm

WiFi repeater failing

Sun Oct 01, 2017 12:06 pm

I have been following this guide here on Jessie: https://pimylifeup.com/raspberry-pi-wif ... mment-4771
(similar guide here - https://raspberrypi.stackexchange.com/q ... i-repeater focusing on wlan and eth).

For some reason the usb wifi adaptor didn't want to connect to my home network, so I created the following rules:
$ sudo nano /etc/udev/rules.d/70-my_network_interfaces.rules

Code: Select all

# Built-in wifi interface used in hostapd - identify device by MAC address
# Pi3 internal
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="b8:27:eb:fe:cb:5b", NAME="wlan0"

# Built-in wifi interface used in hostapd - identify device by MAC address
# USB small  adaptor
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:13:ef:cc:10:13", NAME="wlan1"
So all looks good when I run ifconfig

Code: Select all

eth0      Link encap:Ethernet  HWaddr b8:27:eb:ab:9e:0e
          inet addr:192.168.10.227  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::cc8:2e1:a7b3:bcd9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10809 errors:0 dropped:29 overruns:0 frame:0
          TX packets:628 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2503563 (2.3 MiB)  TX bytes:67148 (65.5 KiB)

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:164 errors:0 dropped:0 overruns:0 frame:0
          TX packets:164 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:12086 (11.8 KiB)  TX bytes:12086 (11.8 KiB)

wlan0     Link encap:Ethernet  HWaddr b8:27:eb:fe:cb:5b
          inet addr:192.168.10.224  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::970c:40d0:46c9:e93d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2336 errors:0 dropped:1 overruns:0 frame:0
          TX packets:75 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:396850 (387.5 KiB)  TX bytes:10433 (10.1 KiB)

wlan1     Link encap:Ethernet  HWaddr 00:13:ef:cc:10:13
          inet addr:192.168.220.1  Bcast:192.168.220.255  Mask:255.255.255.0
          inet6 addr: fe80::213:efff:fecc:1013/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:71 errors:0 dropped:4 overruns:0 frame:0
          TX packets:105 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6929 (6.7 KiB)  TX bytes:15382 (15.0 KiB)
From the raspberry pi, I am able to ping my home router interface (192.168.10.1) and internet servers (via wlan0 on my home network).
I am able to connect a device to the hostapd interface (wlan1) and ping both the wlan1(192.168.220.1) and wlan0 interfaces (192.168.10.224) on the pi. I am unable from that device to ping my home router interface (192.168.10.1) or internet servers. Help!

I am no expert with iptables but it appears one is missing whenever I list them. The rules I used as per the guide are:

Code: Select all

sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE  
sudo iptables -A FORWARD -i wlan0 -o wlan1 -m state --state RELATED,ESTABLISHED -j ACCEPT  
sudo iptables -A FORWARD -i wlan1 -o wlan0 -j ACCEPT
$ sudo iptables -S yields:

Code: Select all

-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A FORWARD -i wlan0 -o wlan1 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i wlan1 -o wlan0 -j ACCEPT
So, it seems "iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE" is missing?
Last edited by razza30 on Sun Oct 01, 2017 4:29 pm, edited 1 time in total.

razza30
Posts: 8
Joined: Fri Jul 26, 2013 10:01 pm

Re: WiFi repeater failing

Sun Oct 01, 2017 4:15 pm

Sorry, I added the wrong link in post 1 which I have now corrected. The first link is: https://pimylifeup.com/raspberry-pi-wif ... mment-4771

razza30
Posts: 8
Joined: Fri Jul 26, 2013 10:01 pm

Re: WiFi repeater failing

Wed Oct 04, 2017 6:27 pm

No one? :-(

beta-tester
Posts: 1334
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: WiFi repeater failing

Thu Oct 05, 2017 10:48 am

are you using Raspbian Stretch?
then you have to change some details to get things working.

e.g. /etc/network/interfaces is not used anymore.
and /etc/wpa_supplicant/wpa_supplicant.conf needs additional parameter to get wifi working.
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

davesteele
Posts: 59
Joined: Wed Nov 30, 2016 4:16 pm

Re: WiFi repeater failing

Thu Oct 05, 2017 4:28 pm

You need to include the '-t nat' with '-S' as well, to see the rules associated with that table.

The guide you mention includes enabling IP forwarding, but you don't mention it. Is it enabled (steps 19-21)?

BTW, my Comitup package will do all of this for you. Version 0.9 or newer can essentially work as a headless wifi extender out of the box.

https://davesteele.github.io/comitup/

davesteele
Posts: 59
Joined: Wed Nov 30, 2016 4:16 pm

Re: WiFi repeater failing

Thu Oct 05, 2017 4:30 pm

The other thing to check early on is the default route - the first entry of 'ip route'.

razza30
Posts: 8
Joined: Fri Jul 26, 2013 10:01 pm

Re: WiFi repeater failing

Mon Oct 09, 2017 4:46 pm

beta-tester wrote:
Thu Oct 05, 2017 10:48 am
are you using Raspbian Stretch?
then you have to change some details to get things working.

e.g. /etc/network/interfaces is not used anymore.
and /etc/wpa_supplicant/wpa_supplicant.conf needs additional parameter to get wifi working.
I will try Stretch *IF* I get it working on Jessie :)

razza30
Posts: 8
Joined: Fri Jul 26, 2013 10:01 pm

Re: WiFi repeater failing

Mon Oct 09, 2017 5:14 pm

davesteele wrote:
Thu Oct 05, 2017 4:28 pm
You need to include the '-t nat' with '-S' as well, to see the rules associated with that table.
Thanks. "sudo iptables -S -t nat" yields the following, which looks good:

Code: Select all

-P PREROUTING ACCEPT
-P INPUT ACCEPT
-P OUTPUT ACCEPT
-P POSTROUTING ACCEPT
-A POSTROUTING -o wlan0 -j MASQUERADE
davesteele wrote:
Thu Oct 05, 2017 4:28 pm
The guide you mention includes enabling IP forwarding, but you don't mention it. Is it enabled (steps 19-21)?
Yes. I have rechecked and there is a single entry of "net.ipv4.ip_forward=1". I have rebooted the box so many times step 21 shouldn't be required, although I threw it in for good measure :)
davesteele wrote:
Thu Oct 05, 2017 4:28 pm
The other thing to check early on is the default route - the first entry of 'ip route'.
"ip route show" yields:

Code: Select all

default via 192.168.10.1 dev eth0  metric 202
default via 192.168.10.1 dev wlan0  metric 303
192.168.10.0/24 dev eth0  proto kernel  scope link  src 192.168.10.227  metric 202
192.168.10.0/24 dev wlan0  proto kernel  scope link  src 192.168.10.224  metric 303
192.168.220.0/24 dev wlan1  proto kernel  scope link  src 192.168.220.1
Which I think looks OK?
davesteele wrote:
Thu Oct 05, 2017 4:28 pm
BTW, my Comitup package will do all of this for you. Version 0.9 or newer can essentially work as a headless wifi extender out of the box.
https://davesteele.github.io/comitup/
I might look at that next :-)

Return to “Raspbian”