OpenWrt has reach set of network configuration options so going to write set of articles to learn little bit deeper in the world of networks. Each article will describle some case that you might face during building networks.Here is first article in the set.
One of the our customer asked to help with building daisy chain of few devices. Daisy chain is a wiring scheme in which multiple devices are wired together in sequence or in a ring similar to a garland of daisy flowers.
So the task customer wanted to solve was following:
He have set of devices (based on NetSoM) having two physical ethernet interfaces each. They are connected as a garland where one of the interface used to connect to the previous device while second interface used to connect to the next device. Like a garland:
But only one of the device (first one) have physical direct wired connection to the global network (yellow wire on the photo). So the main thing needed to be solve is getting second device connected to the global network too.
How to do that?
Step 1. Configuration of second device.
Obviously it need to be configured as DHCP client. To do that we configure /etc/config/network in following way:
save changes, exit the file and restart network configuration:
After that connect it directly to global network (yellow wire):
and make sure it takes IP address:
than return wiring back to the daisy chain scheme (first photo). Once first device will start to provide access to global network to the second one – it will be able to take IP address by using DHCP protocol.
so let’s switch to the first device.
Step 1. Configuration of first device.
looks like it need to act as a DHCP client to take IP address for itself and must to provide access for DHCP server for second device. How to do that? OpenWrt has software mechanism to combine multiple network interfaces together by creating so called device. Some explanation might be found here.
Here how it can be implemented:
Once you restart networking two network interfaces (eth0 and eth1) will act in similar manner as DHCP clients. It will give ability for second device to take IP address too.
Here what you will see for first device:
If you not comphortable with console you can perform such configuration using web interface by accessing web page in a browser by IP address of device:
Step 3. Final changes.
We achieved thing we want – second device able to access global network. The only confusing thing is that devices uses different network configurations. If we will be able to unify it can build as long daisy chain of device we want without worrying about proper sequence of devices with different configurations. Can’t we use configuration of first device for second device too? Yes, we can. Make changes, restart network and make sure that second device took IP address also.
So final version of configuration looks like this: