How do I setup DHCP-Server interfaces so they are mapped/bridged to each other?
5 March, 2021 by
How do I setup DHCP-Server interfaces so they are mapped/bridged to each other?
Administrator

 

Edit /etc/network/interfaces to have a section like this:

iface br0 inet static
   bridge_ports eth0 eth1
   address 192.168.0.1
   netmask 255.255.255.0

(This is assuming you are using 192.168.0.x addressses for you dhcp server.) Then you just use br0 instead of eth0 or eth1 when you are doing your configuration file. With this method, you don’t need anything fancy in the configuration file to try to connect the two interfaces to each other. You just need a section that tells the DHCP server to run on br0, just like it was one ethernet port. You could use a section something like this for the DHCP server:

subnet 192.168.0.0 netmask 255.255.255.0 {

        option routers                  192.168.0.1; #You might have to comment this line out.
        option subnet-mask              255.255.255.0;
        option broadcast-address        192.168.0.255;
        default-lease-time 86400;
        max-lease-time 86400;
}

Hopefully that answers your question as you asked it. However, it sounds like maybe you are trying to share internet among multiple computers. You think you need a DHCP server to do that, and so you are trying to set one up. Am I right so far? If so, there should be a simpler solution:
(this solution assumes you get addresses automatically on eth0. If you have to set them manually, this method would still work, but there would be extra steps)
First, shut down all your eth0 and eth1 interfaces. (sudo ifdown ethX if you’re using /etc/network/interfaces to manage them, or disconnect in NetworkManager applet if you are using that.) Then edit /etc/network/interfaces and add a section like this (commenting out eth0 or eth1 sections if needed):

iface br0 inet dhcp
   bridge_ports eth0 eth1

then do sudo ifup br0. This should make your ports eth0 and eth1 act just like a networking switch, except that your Ubuntu computer is also plugged into this networking switch. Assuming that you could automatically get addresses on eth0 before, this will be passed on to eth1 computers also.

Let me know how my answer works.