4

I've recently boute a raspberry pi and wanted to create an additional wlan access point for my router. So what I did is, I followed this tutorial:

https://adityashrm21.github.io/Raspberry-Pi-Packet-Sniffer/

(Except for the Man in the middle part). So I've connected my router to the ethernet port and than connected the RaspberryPi to via Ethernet to the Router. Internet <-> Router <-> Pi

My Routers IP is 192.168.178.1

My Raspberry Pi's static eth0 address is 192.168.178.23

My Raspberry Pi's static wlan0 address is 192.168.178.90

The DHCP and Hostapd-Parts are working, I get an IP for each of my devices, but I cannot access the internet... (I followed the steps in the tutorial which used iptables to forward all traffic.). Can anyone help me?

The /etc/dnsmasq.conf

interface=wlan0      # Use interface wlan0
bind-interfaces      # Bind to the interface to make sure we aren't sending
things elsewhere 
server=1.1.1.1       # Forward DNS requests to Google DNS
domain-needed        # Don't forward short names
bogus-priv           # Never forward addresses in the non-routed address spaces.
dhcp-range=wlan0,192.168.178.91,192.168.178.160,255.255.255.0,12h # Assign IP
addresses between 172.24.1.50 and 172.24.1.150 with a 12 hour lease time

Thanks in advance.

Update: I've changed the address of the wlan0 interface and all connected devices in the range 172.16.4.0/24. Now not even DHCP is working (I have both the Routers and dnsmasqs dhcp running. It shows eth0 in my router (the Pis IP).

Update: I've tried assigning myself a static IP in the wlan0 (Pis) IP-Range and internet access is now working, seems like a mistake in the DHCP-Config, but I still cannot find where... /etc/dhcpcd.conf

interface wlan0
static ip_address=172.16.4.1/24
nohook wpa_supplicant

/etc/dnsmasq.conf hasn't changed, just the assigned adresses to 192.16.4.2 (static) on my computer and internet was working then. Maybe the problem is the wrong gateway...

pi@raspberrypi:~ $ ip route list
default via 192.168.178.1 dev eth0 src 192.168.178.23 metric 202
172.16.4.0/24 dev wlan0 proto kernel scope link src 172.16.4.1 metric 303
192.168.178.0/24 dev eth0 proto kernel scope link src 192.168.178.23 metric   202


pi@raspberrypi:~ $ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.178.1   0.0.0.0         UG    202    0        0 eth0
0.0.0.0         172.16.4.1      0.0.0.0         UG    303    0        0 wlan0
172.16.4.0      0.0.0.0         255.255.255.0   U     303    0        0 wlan0
192.168.178.0   0.0.0.0         255.255.255.0   U     202    0        0 eth0
4
  • Update: Just checked, from my local pc (IP: 192.168.178.128), I cannot ping my router, neither the wlan0 or eth0 interfaces of the pi... the problem appears to be forwarding, but I don't know why
    – Simmens
    May 2, 2019 at 15:39
  • 1
    Just some likely silly questions: do you have both the dnsmasq DHCP server running and the primary routers also? If so, that wont work out so well - they will inevitably collide. Next, can you ping either interface on the RPi directly from the router. If so, which interfaces do NOT show, and traceroute to either that do. I am assuming that neither do - and if thats true, try pinging and tracing out directly from the PI to the network gateway. Please post all that here as an update to your OP. May 2, 2019 at 16:06
  • Do you want to use this classic setup with hostapd and dnsmasq? Or could a new and easier setup without additional helpers be an option? What Raspberry Pi model do you use? Is it a RPi 3B+? Please address me with @Ingo, otherwise I won't see your reply.
    – Ingo
    May 2, 2019 at 17:37
  • @Ingo I am using a Raspberry Pi 3B+, a classic setup would be something I used to learn how things work, an easier setup would defeat that purpose. However I've looked at the setup so frequently because of the problem that an easier solution would be very appreciated
    – Simmens
    May 2, 2019 at 18:17

1 Answer 1

4

I only had a glance at the tutorial you have linked, tldr;

So I don't know where exactly do you went wrong. And it is difficult to follow your description. You described something and a bit later you changed a subnet and after that defining static ip addresses. And that all may impact dhcpcd, hostapd and dnsmasq and all must play together with different setups.

I suggest to start again with systemd-networkd. Systemd is the upcoming system and nowadays part of nearly all big linux distributions. So you are not on the wrong path starting Linux with it. It has all build in and you don't need additional helpers. With Setting up a Raspberry Pi as an access point - the easy way you can start with a simple stand alone access point test it and then go the next step with an uplink to an internet router until you get to the setup that fit your needs, maybe a NATed router or a bridged subnet?

3
  • Wow - I had not seen your other post that answered this already. VERY complete and well-done sir! Thank you. May 3, 2019 at 4:56
  • 1
    @growlf If you like that "easy way" ;) it would be nice if may upvote it?
    – Ingo
    May 3, 2019 at 8:05
  • Ahh, yes - did on this one, have now also upvoted the other. Thank you for the reminder. ;) May 4, 2019 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.