Skip to content
Advertisement

B.A.T.M.A.N ad-hoc WiFi nodes cannot ping each other

I am working to connect 2 Linux machines, each with this USB Dongle: https://www.tp-link.com/us/home-networking/usb-adapter/archer-t2u-nano/, to an ad-hoc WiFi network managed by B.A.T.M.A.N ( batman-adv ).

When run, these scripts show that both devices are joined to the same ad-hoc/IBSS network.

I statically assigned IP addresses and routes to both ‘bat0’ devices. However, I cannot ping or otherwise use the connection between the two devices.

What am I doing wrong and how can I use the mesh network in Linux between the connected client and server?

My ‘server’ node is configured with this script:

#!/bin/bash

# Cleanup
/sbin/ip link set wlan0 down
/sbin/ip addr flush dev wlan0
/usr/sbin/iw wlan0 set type managed
/sbin/rmmod batman-adv
/sbin/ip link set mtu 1500 dev wlan0

# Ensure batman present
/sbin/modprobe batman-adv

# Setup adhoc mode
/sbin/ip link set mtu 1560 dev wlan0
/usr/sbin/iw wlan0 set type ibss
/sbin/ip link set wlan0 up
#/usr/sbin/iw dev wlan0 ibss join My-Mesh 5180 fixed-freq 02:12:34:56:78:9A
/usr/sbin/iw dev wlan0 ibss join My-Mesh 5180

# Configure batman server
batctl if add wlan0
/sbin/ip link set bat0 up
batctl gw_mode server

# Assign Ip Address
/sbin/ip addr add 10.254.239.1/24 broadcast 10.254.239.255 dev bat0
/sbin/ip route add 10.254.239.0/24 dev bat0

# List device properties
sleep 5
batctl if
/usr/sbin/iw dev
/usr/sbin/iw dev wlan0 link

The output of that script shows the following:

wlan0: active
phy#0
        Interface wlan0
                ifindex 6
                wdev 0x1
                addr 98:48:27:e1:b4:a1
                ssid My-Mesh
                type IBSS
                channel 36 (5180 MHz), width: 20 MHz, center1: 5180 MHz
                txpower 20.00 dBm
Joined IBSS 02:11:87:f2:30:87 (on wlan0)
        SSID: My-Mesh
        freq: 5180

ifconfig and dmesg both show batman as being configured for the client:

bat0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.254.239.2  netmask 255.255.255.0  broadcast 10.254.239.255
        inet6 fe80::d4b3:31ff:fea4:b056  prefixlen 64  scopeid 0x20<link>
        ether d6:b3:31:a4:b0:56  txqueuelen 1000  (Ethernet)
        RX packets 410  bytes 17220 (17.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 19  bytes 846 (846.0 B)
        TX errors 0  dropped 62 overruns 0  carrier 0  collisions 0

[ 2223.705686] batman_adv: B.A.T.M.A.N. advanced 2021.0 (compatibility version 15) loaded
[ 2223.718444] batman_adv: bat0: Adding interface: wlx984827e1b29c
[ 2223.718448] batman_adv: bat0: Interface activated: wlx984827e1b29c

ifconfig and dmesg both show batman as being configured for the server:

bat0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 10.254.239.1  netmask 255.255.255.0  broadcast 10.254.239.255
        ether ea:ca:36:20:2f:8c  txqueuelen 1000  (Ethernet)
        RX packets 432  bytes 18144 (17.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 15  bytes 738 (738.0 B)
        TX errors 0  dropped 1109 overruns 0  carrier 0  collisions 0

[ 2189.342306] batman_adv: B.A.T.M.A.N. advanced 2021.4-dirty (compatibility version 15) loaded
[ 2189.581796] batman_adv: bat0: Adding interface: wlan0
[ 2189.581848] batman_adv: bat0: Interface activated: wlan0

My ‘client’ node is configured with this script:

#!/bin/bash

# Cleanup
DEV="wlx984827e1b29c"
/sbin/ip link set ${DEV} down
/sbin/ip addr flush dev ${DEV}
/usr/sbin/iw ${DEV} set type managed
/sbin/rmmod batman-adv
/sbin/ip link set mtu 1500 dev ${DEV}

# Ensure batman present
/sbin/modprobe batman-adv

# Setup adhoc mode
/sbin/ip link set mtu 1560 dev ${DEV}
/usr/sbin/iw ${DEV} set type ibss
/sbin/ip link set ${DEV} up
#/usr/sbin/iw dev ${DEV} ibss join My-Mesh 5180 fixed-freq 02:12:34:56:78:9A
/usr/sbin/iw dev ${DEV} ibss join My-Mesh 5180

# Configure batman server
/usr/sbin/batctl if add ${DEV}
/sbin/ip link set bat0 up
/usr/sbin/batctl gw_mode client

# Set the mesh-bridge IP
# Assign Ip Address
/sbin/ip addr add 10.254.239.2/24 broadcast 10.254.239.255 dev bat0
/sbin/ip route add 10.254.239.0/24 dev bat0

# Info
sleep 5
batctl if
/usr/sbin/iw dev
/usr/sbin/iw dev ${DEV} link

The output of that script shows these messages:

wlx984827e1b29c: active
phy#0
    Interface wlx984827e1b29c
        ifindex 3
        wdev 0x1
        addr 98:48:27:e1:b2:9c
        ssid My-Mesh
        type IBSS
        channel 36 (5180 MHz), width: 20 MHz, center1: 5180 MHz
        txpower 20.00 dBm
Joined IBSS 02:11:87:f2:30:87 (on wlx984827e1b29c)
    SSID: My-Mesh
    freq: 5180

The Linux batctl command shows no connected nodes from both server and client perspectives.

Server:

batctl o
[B.A.T.M.A.N. adv 2021.4-dirty, MainIF/MAC: wlan0/98:48:27:e1:b4:a1 (bat0/ea:ca:36:20:2f:8c BATMAN_IV)]
   Originator        last-seen (#/255) Nexthop           [outgoingIF]

Client:

batctl o
[B.A.T.M.A.N. adv 2021.0, MainIF/MAC: wlx984827e1b29c/98:48:27:e1:b2:9c (bat0/d6:b3:31:a4:b0:56 BATMAN_IV)]
   Originator        last-seen (#/255) Nexthop           [outgoingIF]

I cannot ping the client from the server:

ping 10.254.239.2
PING 10.254.239.2 (10.254.239.2) 56(84) bytes of data.
From 10.254.239.1 icmp_seq=1 Destination Host Unreachable
From 10.254.239.1 icmp_seq=2 Destination Host Unreachable
From 10.254.239.1 icmp_seq=3 Destination Host Unreachable

I also cannot ping the server from the client:

ping 10.254.239.1
PING 10.254.239.1 (10.254.239.1) 56(84) bytes of data.
From 10.254.239.2 icmp_seq=1 Destination Host Unreachable
From 10.254.239.2 icmp_seq=2 Destination Host Unreachable
From 10.254.239.2 icmp_seq=3 Destination Host Unreachable

Advertisement

Answer

The answer really is that you need a WiFi radio that actually correclty implements Ad-Hoc/IBSS networking in the driver stack.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement