0

I am connecting some number of embedded linux devices to a main LAN using a DHCP server and routing tables. On the main LAN (192.168.1.0/24) I have a PC connected and the first embedded linux device. The embedded linux device has two ethernet ports such. Some number of the linux devices are chained together using a software ethernet bridge. There are two scenarios how each of embedded devices should act:

  1. The head of the chain. I have written a simple bash script to detect when it is on the main LAN by pulling the MAC of the gateway it sees. If it is the head, it receives the IP address from the main LAN DHCP server and creates a new subnet on the second ethernet port (192.168.50.0/24).

  2. Not the head. When a device is found to be not the head by the bash script, it simply bridges the two ethernet ports.

Network Topology Diagram

I have tried some simple routing commands (ip route, route). Currently from a device other than the head, I can ping the 50.1 server, the main LAN port on the head device (1.101), but not the main DHCP server (1.1) or the main LAN PC (1.100). From the main LAN PC I can ping the LAN side of the first device (1.2) but not the subnet side (50.1).

On head device:

$ ip route
    192.168.50.0/24 dev eth1  src 192.168.50.1 
    192.168.1.0/24 dev eth0  src 192.168.1.2 
    default via 192.168.1.1 dev eth0

On chained device:

$ ip route
    192.168.50.0/24 dev eth0  proto kernel  scope link  src 192.168.50.254 
    127.0.0.0/8 dev lo  scope link 
    default via 192.168.50.1 dev eth0 

The end goal here is to have all embedded devices be able to talk with the PC on the main LAN.

It should also be made known that there can be several chains connected to the main LAN also.

  • 1
    Do you have IP forwarding enabled? Eg. with `sysctl net.ipv4.ip_forward=1`, or check with `sysctl net.ipv4.ip`. Did I get it right that you have bridged `eth0` and `eth1` on each embedded device? If so, won't you rather assign a single IP address to the bridge interface instead of each of the single interfaces? – Thomas Dec 28 '18 at 18:36
  • I had not had IP forwarding enabled. I added that to my init script for the head and did some testing. It has the same network reach as before. I also did fix the script to assign the IP to the bridge. Thanks for the correction. – Taylor Spencer Dec 28 '18 at 20:16
  • Just saw it in the diagram, you should also put the second *chain* at `192.168.1.3` into a different subnet like `192.168.51.0/24`. Otherwise you won't be able to route traffic from `192.168.1.1` to the destination. – Thomas Dec 29 '18 at 09:20

0 Answers0