Setting up default-gateway on a router

gatewayiosroutingsubnet

So I've got this weird assignment, where each branch office has to be able to access the main office (and Internet) through a serial connection.

Since switches don't have a serial connections socket, I am using routers. I also use them for subnetting.

The issue is, since PC A <-> Router A and Router A <-> Router HQ are on different subnets, I cannot access (ping) the Main router from PC A.

I've never configured default gateway on a router, but I think in this instance it's the only solution.

Based on this article/tutorial, it should be possible, but it didn't work for me, and to be honest I didn't really understand it.

diagram

The question is, what is the best solution in this scenario and why?
The objective is to be able to successfully ping from any subnet to any subnet ie. PC A <-> PC HQ

Best Answer

So each branch is connected to the main via a "serial link". I suppose what you mean is that at each branch there is a router with 10/100/1G/10G Base-T on one side, and a serial connection on the other, with the serial connection being to some kind of DSL or or other modem or MUX. Then over this serial connection, the router uses PPP to create an IP connection to the main. And at the main you have one or more of these routers sitting and their 10/100/1G/10G Base-T connections are all connected to one switch. (This detail is important I think.)

In this scenario, each Branch must have its own subnet. You can do this easily enough with the 10.x.x.x address space. Alternatively, if the company has, say, a single class C range, you can subdivide a portion of that (the downside is that all subnet masks on all PCs throughout the company will have to change) so that each branch has its own subnet with a CIDR of, say, /26 (giving you 30 addresses at each Branch).

Router A will have two Static routes, one of which is the Default route and points to the IP address of Main's router. The other points to the subnet for the specific branch. Now, in actuality, the PPP protocol establishment on the router should take care of the default route for you -- it should dynamically create that route every time the link is created. You might need to configure that somewhere on the router. But it will create the routing rule when needed. The other route (for the local branch) should also be handled automatically by its being on the same LAN as the branch -- simply configure the router have its internal IP address in the Branch's LAN/subnet.

The PCs in the Branch will each have a default route this same IP Address of Router A. If you've configured the Branch to have the subnet of 10.11.12.0/24, the Router might have the address 10.11.12.1/24 and that becomes the gateway address for all the PCs. Simple.

The complex part comes with the switch / router configuration at Main. This maybe where you got lost. Its default route will be to the company's internet gateway (if it's a separate router -- if not, then the one the ISP gives them). Also, for each Branch, it must have a route to that branch's subnet. So the configuration on the switch / router at Main will look like:

SUBNET         GATEWAY             COMMENT
default        100.5.1.1           # Company external Internet firewall
10.11.12.0/24  ?                   # to branch A
10.11.14.0/24  ?                   # to branch B
10.11.16.0/24  ?                   # to branch C

What are the values where the question marks are? That depends on the kind of switch / router... I can't answer that without knowing more specifics. But in general, they will be associated with the link to the respective Branch's router. When the Branch's router connects via PPP to the Main's router, each side will have an IP address. Usually the proper gateway is to the Main's dynamically-assigned IP address. But sometimes it's to the Branch's. Sometimes it's simply the port designation ("Serial-Port-A").