glennvanderveer
Posts: 6
Joined: Wed Nov 01, 2017 1:32 pm

Bridging 2 WLANs where one is a Batman Mesh point, and other is a DHCP AP

Mon Nov 06, 2017 4:37 pm

Here is a diagram of what I am attempting to accomplish:
NetworkDiagram.png
NetworkDiagram.png (73.39 KiB) Viewed 1991 times
I have followed the following links to get the parts working::
https://learn.adafruit.com/setting-up-a ... t/overview for the AP and DHCP server for both WLAN0 connections.
I did not do the updating of the hostapd, but I did remove the WPASupplicant.
and
https://www.reddit.com/r/darknetplan/co ... erry_pi_3/ for the Batman-Adv mesh network on the WLAN1 connections.

I have looked at adding a bridge using this forum post:
viewtopic.php?f=36&t=189645
however, once I have the bridge setup, the DHCP server on the AP section stops handing out IP addresses to the Pixels. The batman mesh still functions though.

Here are the various config files which are identical on each pi (except for IP addresses.)
dhcpd.conf

Code: Select all

# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

<snip>

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

<big snip>

subnet 192.168.42.0 netmask 255.255.255.0 {
	range 192.168.42.10 192.168.42.50;
	option broadcast-address 192.168.42.255;
	option routers 192.168.42.1;
	default-lease-time 600;
	max-lease-time 7200;
	option domain-name "local";
	option domain-name-servers 8.8.8.8,8.8.4.4;
}
hostapd.conf:

Code: Select all

interface=wlan0
#driver=rtl1871xdrv
#driver=nl80211
ssid=SkynetWiFi
country_code=US
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=Raspberry
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
wpa_group_rekey=86400
ieee80211n=1
wme_enabled=1
interfaces:

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.d
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet static
	address 192.168.42.1
	netmask 255.255.255.0


Script to start mesh network on wlan1

Code: Select all

echo Starting Batman
sudo modprobe batman-adv
echo Sleeping 5 seconds!!!
sleep 5s
echo Setting wlan down
sudo ip link set wlan1 down

sudo ifconfig wlan1 mtu 1532
sudo iwconfig wlan1 mode ad-hoc
sudo iwconfig wlan1 essid Skynet
sudo iwconfig wlan1 ap any
sudo iwconfig wlan1 channel 11
echo Sleeping for 2 seconds
sleep 2s
echo Setting wlan1 up
sudo ip link set wlan1 up
echo Sleeping for 2 seconds
sleep 2s
sudo batctl if add wlan1
echo Sleeping for 2 seconds
sleep 2s
echo Setting bat0 up
sudo ifconfig bat0 up
echo Sleeping for 5 seconds
sleep 5s
sudo ifconfig bat0 172.27.0.1/16
echo Done!!!
Script to set the iptables:

Code: Select all

sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -i wlan0 -o bat0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i bat0 -o wlan0 -j ACCEPT

sudo iptables -t nat -S
sudo iptables -S

So as I test, once the Pi's finish booting, I run the script to start the mesh and once the mesh is up, I run the script to set the iptables.

I have the Pixels both able to connect to each node separately and are pingable by the node (White or Black) that they are connected to.
I have each node able to ping each others Batman ip address
What I am not able to do is to get the AP connected Pixels to be able to ping each other, and I can't figure out what I am doing that is not correct.

Can anyone see what I have done wrong, or what I have missed in order to make this work?

Thanks

Glenn

not_aki
Posts: 1
Joined: Tue Nov 07, 2017 4:26 pm

Re: Bridging 2 WLANs where one is a Batman Mesh point, and other is a DHCP AP

Tue Nov 07, 2017 4:28 pm

Have you tried connecting it to the ethernet as a test? :P

glennvanderveer
Posts: 6
Joined: Wed Nov 01, 2017 1:32 pm

Re: Bridging 2 WLANs where one is a Batman Mesh point, and other is a DHCP AP

Tue Nov 07, 2017 5:25 pm

not_aki wrote:
Tue Nov 07, 2017 4:28 pm
Have you tried connecting it to the ethernet as a test? :P
Yes, but ethernet is not part of the problem.

Yuerno
Posts: 7
Joined: Thu Nov 16, 2017 11:27 pm

Re: Bridging 2 WLANs where one is a Batman Mesh point, and other is a DHCP AP

Sat Nov 18, 2017 5:55 pm

Hi Glenn. I am doing a very similar project to this, and I was wondering if you've been able to get your setup working yet?

glennvanderveer
Posts: 6
Joined: Wed Nov 01, 2017 1:32 pm

Re: Bridging 2 WLANs where one is a Batman Mesh point, and other is a DHCP AP

Mon Nov 20, 2017 7:19 pm

Yuerno wrote:
Sat Nov 18, 2017 5:55 pm
Hi Glenn. I am doing a very similar project to this, and I was wondering if you've been able to get your setup working yet?
No, I cannot get past the bridging of the Mesh to the WLAN. It seems I can have both running, but not talking to each other.

linusmotu
Posts: 1
Joined: Tue Dec 12, 2017 10:01 am

Re: Bridging 2 WLANs where one is a Batman Mesh point, and other is a DHCP AP

Tue Dec 12, 2017 10:03 am

Hi,

I'm also trying to get this to work, to no avail.
I tried creating a batman mesh-bridge with my access point but I just end up losing the AP instead.

By any chance have you gotten this to work? Or at the very least saw a workaround?

Thanks!

glennvanderveer
Posts: 6
Joined: Wed Nov 01, 2017 1:32 pm

Re: Bridging 2 WLANs where one is a Batman Mesh point, and other is a DHCP AP

Tue Dec 12, 2017 3:36 pm

No, I have not gotten this to work. It doesn't seem to be possible in the actual network layers...

billgufran
Posts: 4
Joined: Sun Apr 15, 2018 6:16 am

Re: Bridging 2 WLANs where one is a Batman Mesh point, and other is a DHCP AP

Sat Jul 13, 2019 11:59 am

Sorry for resurrecting the 2 years old forums. I kinda succeeded to do that, but I'm not sure if it's the right way to do it or not. Instead of bridging, I did routing instead

Return to “Networking and servers”