13

I would like to join/bridge two different networks, network 1 and network 2:

  1. Network 1: A network consisted of a Linux box (with one ethernet) port and multiple clients (connected via LAN switch). The linux box is acting as DHCP server and it's giving IP to the clients including its own.

  2. Network 2: Other network completely on different subnet and also has router giving IPs through DHCP serving multiple clients.

Please see the network diagram:

enter image description here

My objective is to be able to access the Linux box from Client A & B while keeping the DHCP configurations intact on both network.. so:

  1. Linux Box would still be able to give IP addresses to Client 1 & 2 and retain 192.168.10.10 IP address inside Network 1.
  2. Client A should be able to access internet and communicate with Client B and retain the 123.123.xxx.xxx IP address inside Network 2.

What kind of devices and configurations should I use?

I was thinking of bridging routing those networks using another router with the router's DHCP server turned off. Then I set a static route. Just like this guide: http://kb.linksys.com/Linksys/ukp.aspx?pid=80&vw=1&articleid=17589

However I'm quite green in networking and would like to verify my understanding before investing in a router. I'm not even sure whether a consumer router would be able to do this kind of job.

Could someone help me on this matter? I'd appreciate any kind of comment. Thanks!

Pierre.Vriens
  • 1,159
  • 34
  • 15
  • 19
Arya S.
  • 141
  • 1
  • 1
  • 5
  • You're thinking "routing" not "bridging". Put a "router" with two interface, one connected to each switch and set up your routing rules. Each network is a "segment" or "broadcast domain". DHCP will only broadcast to a single broadcast domain, unless you set up a DHCP bridge or something, which I don't think is needed in your case. – Giovanni Tirloni Sep 11 '14 at 17:05
  • Just to shamelessly plug myself: There's some background on IPv4 routing in this answer: http://serverfault.com/a/49836/7200 – Evan Anderson Sep 11 '14 at 17:06
  • Thanks for the comment @gtirloni I'm not quite sure I understand what you meant by interface, referring to linksys guide on my question, So one switch in WAN port and another one in LAN switch. @ Evan Anderson, it's a good read. Thanks – Arya S. Sep 11 '14 at 17:20

2 Answers2

15

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

Evan Anderson
  • 141,071
  • 19
  • 191
  • 328
  • Thank you for the answer, I cannot access "router" in "network 2" directly, all I have is UTP cables connected to a switch (at least I think so). So assuming I took the freestanding router option, can I simply follow the linksys guide I provided as link in my question? or do I need another specific settings? – Arya S. Sep 11 '14 at 17:09
  • Aha now that's a clear answer. I'll check if I had a unused router, well if I can't find one it seems instead of investing in a new router I'd better go with extra NIC as you have stated. Thanks. – Arya S. Sep 11 '14 at 17:35
0

how to connect two networks with a router || cisco packet tracer -IT Adin https://youtu.be/THZGaOQe28o

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/500296) – Ginnungagap Oct 18 '21 at 10:24