0

I have configured a network with the following topology:

Gateway (10.0.0.1)
      | tun0
      |
      |-----------------------| 10.0.0.0/16
      |                       |
      | tun0                  | tun0
Host A (10.0.1.1)         Host B (10.0.2.1)
      | wlan0                 | wlan0
      |                       |
      | 10.0.1.0/24           |----------------| 10.0.2.0/24
      |                       |                |
      | wlan0                 | wlan0          | wlan0
Client A (10.0.1.2)       Client B (10.0.2.2)  Client C (10.0.2.3)

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.

1

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

   Gateway 
      | tun0 (10.0.0.1)
      |
      |-----------------------| 10.0.0.0/24
      |                       |
      | tun0 (10.0.0.2)       | tun0 (10.0.0.3)
    Host A                 Host B 
      | wlan0 (10.0.2.1)      | wlan0 (10.0.3.1)
      |                       |
      | 10.0.2.0/24           |-------------------| 10.0.3.0/24
      |                       |                   |
      | wlan0 (10.0.2.2)      | wlan0 (10.0.3.2)  | wlan0 (10.0.3.3)
  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 10.0.3.0/24 via 10.0.3.1).

  • 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.