0

Trying to set up a network with multiple routers, very similar to what's depicted in this diagram from the FreeBSD handbook:

enter image description here

In particular, regarding this specific diagram, what should the default gateway for RouterB be set to?

In general, how do you determine what the default gateway for a router should be, especially if that router is on a LAN, but behind the router with the WAN interface?

3
  • If you want traffic to go to the internet, Router A. If Net 2 doesn't need internet, it doesn't need a DFGW. Unless Router B is NAT'ing for Net 2, Router A (and everything else in Net 1) need to know where Net 2 is.
    – Ricky
    Sep 11, 2021 at 23:16
  • @Ricky, I presume you mean that the default gateway for RouterB needs to be 192.168.1.1. Would that be correct? Sep 11, 2021 at 23:26
  • The default route usually points to the next-hop router on the path towards the internet. Router B:s path towards the Internet goes through its interface 192.168.1.2/24 to Internal Net 1. The next hop along the path is the Router A:s Internal Net 1 interface in the same subnet, 192.168.1.1. So, yes :-) This is assuming that Net 2 devices do need access to the internet. Sep 11, 2021 at 23:45

2 Answers 2

0

The default gateway is used for those routes where the router doesn't have more specific information. That's the meaning to the term default.

In your case, you would want traffic to unknown routes to be sent to the Internet. So RouterB would use RouterA as its default gateway, and you would configure the next hop as the interface on RouterA (192.168.1.1).

This assumes you are using static routing. If you are running a routing protocol, then Router A would likely advertise a default route to B, so B would learn the default route that way.

0

In a simple scenario, you've only got a single gateway to 'everywhere'.

In your diagram that's Router A. Routing to all locations but the ones you've got specific routes for is what the default route is intended to do.

All other gateways should use Router A as default gateway. The ones sharing a subnet with A can do so directly (ie. Router A's interface/IP sharing their subnet), more remote ones (e.g. one behind Router B) need to use an intermediate gateway pointing towards Router A.

In a more complex network, selecting the optimal path and avoiding loops might not be a trivial task. You can use a dynamic routing protocol like OSPF to propagate the default route from Router A - and all the other specific routes - over the entire network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.