How should I bridge two networks, given each network has its own subnet & DHCP server?

Solution 1:

DHCP is based on using layer 2 broadcasts to allow clients to locate DHCP servers. A bridge would forward these layer 2 broadcasts between the networks. Plugging the switches from each respective network into the other would accomplish this. An Ethernet switch is, in effect, nothing more than a multi-port bridge. This isn't what you want to do.

Since you want to keep the DHCP configuration intact you're looking for a router to connect the two networks. A router doesn't forward layer 2 broadcasts between the networks it's attached to (in any sane default configuration). Adding a router, however will require you to make modifications to your existing routers' routing tables.

Your current edge router in "network 2", if it had a second Ethernet interface, would do just fine. You'd just give that port a "network 1" IP address and attach it to the "network 1" switch. Then you'd add a static route on the Linux router / DHCP server in "network 1" specifying that the "network 2" subnet is accessible via the "network 1" IP address that your assigned to the "network 2" edge router's Ethernet interface that you attached to "network 1".

If your edge router in "network 2" doesn't have an extra Ethernet port your could add another Ethernet port to the Linux router / DHCP server to accomplish the same thing.

Finally, you could also get a freestanding router to connect the two networks together. A lot of consumer grade routers expect that you're going to want to to Network Address Translation (NAT) and, as you say in your question, you're not going to want yet another DHCP server (which many consumer-grade routers have enabled out-of-the-box). In the case of using a freestanding router (which will have two physical interfaces connected to the two separate networks, each with IP addresses assigned in the respective networks to which it is attached) you'll need to add a static route on both networks' edge routers back to this freestanding router.

We don't do product recommendations here, but there are a number of small, inexpensive routers that could do what you're looking for if your existing gear can't handle it.

Edit:

If you have no access to router in "network 2" then you're going to have to get more creative.

If you could just add a second NIC to the Linux machine, and give that NIC a "network 2" IP address you could have clients in "network 2" access the Linux machine via that IP and you'd be done.

If you can't add a second NIC to the Linux machine then you could add a freestanding router device with both "network 1" and "network 2" IP addresses. You'd need to use NAT in order to avoid having to change routing tables in "network 2". A consumer grade router meant for home Internet access would probably do.

  • Connect the "LAN" port to the "network 1" network and give it a static IP address in the "network 1" subnet.

  • Disable any DHCP server on the router.

  • Connect the router's "Internet" port to the "network 2" network and give it a static IP address in the "network 2" subnet.

  • Add a static route on the Linux machine for the "network 2" subnet accessible via the "network 1" IP address you assigned to the router. (This allows the Linux machine to respond back to hosts in the "network 2" subnet.)

  • Configure "port forwarding" or "DMZ host" functionality on the router to forward either individual ports, or all traffic, from the "Internet" port to the Linux machine. (This allows "network 2" computers to access the Linux machine via a "network 2" IP address, preventing the need for any routing table modification on the "network 2" edge router.)

  • From "network 2" computers, access the Linux machine via the "network 2" IP address you assigned to the router. The router's NAT / port-forwarding (or DMZ host) functionality will forward the traffic to the Linux machine.

(I feel a little dirty giving you this answer... >smile< It's a bit of a hack, but it will work.)