I have configured a network with the following topology:

Gateway (
      | tun0
      |                       |
      | tun0                  | tun0
Host A (         Host B (
      | wlan0                 | wlan0
      |                       |
      |           |----------------|
      |                       |                |
      | wlan0                 | wlan0          | wlan0
Client A (       Client B (  Client C (

At the moment, hosts A and B can ping the gateway and each other. Also. each client can ping the host directly connected to it as well as the other clients connected to that host. However, I would like each device to be able to ping all other devices on the network (e.g., Client A can ping Client B, Host A can ping Client C, et cetera).

I have attempted several methods of going about configuring each host to allow packet forwarding between clients, other hosts, and the gateway. The first method I have tried is using iptables on each host to forward traffic between the subnets. While I have had success using tutorials such as this one on Adafruit to allow clients to ping the hosts and the gateway, these did not allow other hosts to ping the clients. I also tried solutions such as this one to route traffic between subnets, but they seem to not work with overlapping subnets. I also attempted to create a bridge interface on each host that bridged tun0 and wlan0, with no success.

I am open to changing the configuration of IP addresses on this network provided the ability for all devices to connect to all other devices is preserved.


The solution (which appears painfully obvious in hindsight) is to assign IP addresses as follows:

      | tun0 (
      |                       |
      | tun0 (       | tun0 (
    Host A                 Host B 
      | wlan0 (      | wlan0 (
      |                       |
      |           |-------------------|
      |                       |                   |
      | wlan0 (      | wlan0 (  | wlan0 (
  Client A                Client B            Client C

This puts the gateway/host connections on a separate subnet. In this configuration, the tutorials involving routing traffic between two subnets will work. Routes will need to be configured on each host and on the gateway (e.g., ip route add via

  • Maybe one should add that overlapping subnets are always an indication that something is severely wrong with the network topology. Avoid, avoid, avoid. – dirkt Jun 24 '18 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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