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
Simmens
  • 41
  • 2

1 Answers1

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?

Ingo
  • 42,961
  • 20
  • 87
  • 207