Help: Wifi Hotspot on same subnet and SSID

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
mazz12
Posts: 2
Joined: Mon Apr 20, 2020 4:39 am

Help: Wifi Hotspot on same subnet and SSID

Post by mazz12 »

Hello all, I don't have a technical background and after days of struggling with unsuccessful trial and error and searching for answers elsewhere, have come here for help. If there is relevant documentation that I should read, some pointers in the right direction would also be great.

Thanks in advance.

In response to COVID-19 I have set up my raspberry pi with DietPi at home to run a Nextcloud server and Wifi hotspot so that my parents can work from home. (Thanks to documentation here and elsewhere!)

However there is one big issue I would like to fix, and another minor issue.

1. The DietPi Wifi hotspot is on a separate subnet. 192.168.42.x rather than 192.168.1.x as well as having a different SSID to "Router 2". If possible I would like to have the hosts connected to the DietPi to be on the same subnet as the rest of the network, as well as share the same SSID to the other wireless router. (I know I can change the SSID for the DietPi through dietpi-config → network adapters, but when I changed it to the same SSID, the network stopped working. I don’t know why, regardless simply changing the SSID does not solve the issue with them being on different subnets.)

My intuition tells me that changing the static IP of DietPi wlan0 from 192.168.42.1 to 192.168.1.3 would result in something bad. Or is this safe to do?

2. At the moment with dnsmasq on “Router 1”, LAN traffic to the nextcloud server (directed at the DDNS domain e.g. mysubdomain.ddns.com), is redirected to 192.168.1.10. However with this current setup, clients connected to the DietPi hotspot are (probably?) connecting to the hotspot, which then forwards traffic to the router, which then redirects back to the DietPi to access the Nextcloud server. This seems kind of redundant and a waste of bandwidth. If possible, it would be great if clients connected to the DietPi Hotspot directly access the Nextcloud server without going through “Router 1” How would I go about doing this?

This is the current setup:
Image
Both routers are running ddwrt.
Please let me know if I should provide further details.

Under normal circumstances I would try to sort this myself after many days of trial and error. However due to COVID-19, the network is being heavily used for professional academic purposes by family members working from home, so I can’t afford to break the network constantly, and it would help them if this got fixed sooner rather than later.
trendy
Posts: 118
Joined: Tue Feb 25, 2020 2:54 pm

Re: Help: Wifi Hotspot on same subnet and SSID

Post by trendy »

1) To have the wifi in the same subnet with the ethernet interface, you need to bridge the eth and wlan interfaces and manage them as one. (hint: brctl). I have not seen it in dietpi scripts, so check what needs to be done in /etc/network/interfaces and fix it manually.
2) Create an A record in your local nameserver for the fqdn you are using and specify the internal IP directly.
User avatar
Joulinar
Posts: 2034
Joined: Sat Nov 16, 2019 12:49 am

Re: Help: Wifi Hotspot on same subnet and SSID

Post by Joulinar »

Hi,

many thanks for your report. I guess that's what you are looking for https://www.raspberrypi.org/forums/view ... p?t=178420

It will link you to another blog which is quite old but contains the right thinks in it, like to install wireless-tools hostapd bridge-utils and to setup the network bridge

I general I would recommend to not use DietPi software / config to install the access points as it will setup as well a DHCP server. And this one would not be needed. ;)
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
mazz12
Posts: 2
Joined: Mon Apr 20, 2020 4:39 am

Re: Help: Wifi Hotspot on same subnet and SSID

Post by mazz12 »

Thank you both for the replies. I've done the best to follow your advice on problem 1).

However now I can no longer SSH into the Pi and the nextcloud server is inaccessible. and the bridged AP on the DietPi is not broadcasting anything. The Pi does however show up as a host through the router control page, under connected LAN devices. However all ping requests get dropped.

What I did:

I uninstalled the wifi hotspot software through the DietPi software menu, then proceeded to install "wireless-tools", "hostapd" and "bridge-utils" through apt. (iirc only hostapd and bridge-utils needed re-installing)

Then following https://agentoss.wordpress.com/2011/10/ ... ian-linux/

I created a new config file for /etc/network/interfaces in /etc/network/interfaces.d/ as advised in the original interfaces file ("drop-in") with options similar to the above but with IPs corresponding to my network. Named: /etc/network/interfaces.d/interfaces with these options

Code: Select all

# Location: /etc/network/interfaces.d/interfaces
# This is my drop-in in: /etc/network/interfaces.d/ (whatever a drop in is I don't know but here goes)

# Local
auto lo br0
iface lo inet loopback

# Ethernet
allow-hotplug eth0
iface eth0 inet manual

# Wireless
allow-hotplug wlan0
iface wlan0 inet manual

# Bridge setup

# for static ip
iface br0 inet static
bridge_ports eth0 wlan0

address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1
dns-search localdomain
Then I created the hostapd.conf in /etc/hostapd/ with these options (I had to newly create the file so am wondering if it exists somewhere else?):

Code: Select all

# Location: /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211

# Bridge name
bridge=br0

# the country code
#country_code=JP3
# limit the frequencies used to those allowed in the country
#ieee80211d=1
# 802.11n support
ieee80211n=1

# AP SSID name
ssid=abc

# Hardware mode, a = 5GHz, g = 2.4GHz
hw_mode=g

# Wireless Channel
channel=2

# QoS support, also required for full speed on 802.11n/ac/ax
wmm_enabled=1
#mac address filtering. 0 means "accept unless in ignore list"
macaddr_acl=0
#setting ignore_broadcast_ssid to 1 will disable the broadcasting of ssid
ignore_broadcast_ssid=0
# Security 1=wpa, 2=wep, 3=both
auth_algs=1
# WPA2 only
wpa=2
wpa_key_mgmt=WPA-PSK
# WPA2 encryption
rsn_pairwise=CCMP
# WPA encryption
#wpa_pairwise=TKIP
# Passphrase
wpa_passphrase=supersecretpassword
After doing those things, I rebooted the Pi and found myself with an unusable Pi.

Before I did the reboot, through the DietPi launcher, checking services before I saved the files and it all failed, I noticed something about hostapd being "masked". I am wondering if that is an issue.
trendy
Posts: 118
Joined: Tue Feb 25, 2020 2:54 pm

Re: Help: Wifi Hotspot on same subnet and SSID

Post by trendy »

I was not able to make networking work with configuration files in interfaces.d/ . Instead I added the things I needed inside the main interfaces file. Also if I remember properly there is some specific filename structure for the files in interfaces.d, like bridge.conf.
Post Reply