Various Networking Configurations for Routers

Click the original text

Various Networking Configurations for Routers

Follow us

Many friends have asked how two computers on different subnets can communicate with each other. This is a common issue encountered in corporate offices, and today we will take a look at it.

We often encounter situations where a company, as it grows with more employees or departments, adds a router to create two subnets, with subnet A and subnet B being on different networks. When multiple routers exist in the network, it is required that the subnets under different routers can communicate with each other while also accessing the internet through the broadband router. How can this be achieved? In this issue, we will explore three case scenarios through router operations.

Case Scenario 1

The company accesses the internet through a router R1, with local area network LAN1. Due to business needs, a second router R2 is added, creating a new local area network segment LAN2.

To enable PC1 and PC2 to communicate with each other, the settings as shown in the diagram below can be configured.

Various Networking Configurations for Routers

To achieve communication between PC1 and PC2, the following settings can be made:

1. The gateway of PC1 points to R1’s LAN

2. The gateway of PC2 points to R2’s LAN port

3. The WAN port of R2’s gateway points to R1’s LAN port

4. A static route must be specified on R1 to forward packets with destination IPs in the 192.168.1.x subnet to R2.

Here, the static route configuration for R1 is explained separately:A static route generally consists of three parts: the destination IP address, subnet mask, and next hop (gateway) address. According to the analysis in the diagram above, the information for creating a new static route should include the following: the next hop address for packets destined for the 192.168.1.0 subnet (with a subnet mask of 255.255.255.0) is 192.168.0.100. The specific configuration location, for example, in a TP-Link router, can be found in the router configuration interface under the static route table configuration:

Various Networking Configurations for Routers

When setting up a static route, the gateway IP must belong to the same subnet as the LAN port IP of the router.

If the destination IP address is that of a host, the subnet mask must be 255.255.255.255

If it is on a server, static routes can be configured via the command line, including adding, deleting, and modifying.

Various Networking Configurations for Routers

It can be seen that Case 1 is actually very similar to the bridging principle of routers.

Case Scenario 2

In a shared broadband access scenario, User A has built a local area network using a broadband router, and User B has also built a local area network using a broadband router. The hosts in User A and User B’s local area networks cannot communicate with each other. The network topology is as follows:

Various Networking Configurations for Routers

To achieve mutual access between PC2 and PC1, it seems similar to Case 1, requiring the addition of two static routes in the internal network gateway. Generally, community gateways will not allow users to configure routes casually, and such configurations would also allow computers from other subnets to access PC1 and PC2.

Method for setting up mutual access between two routers on different subnets:

Set the WAN ports of the two routers to the same subnet, as shown in the diagram above:

Router 1 WAN port IP: 10.1.1.3, Router 2 WAN port IP: 10.1.1.3

The LAN ports of the two routers can be set arbitrarily, as long as they are not in the same subnet as the WAN ports.

Case Scenario 3

The above cases 1 and 2 are for two routers, while for environments with multiple routers and multi-level routing devices, this situation can be seen as a combination of scenarios one and two.

A similar network topology is as follows: three routers

Various Networking Configurations for Routers

To achieve mutual access between PC1, PC2, and PC3, it is necessary to configure static routes for Router 1 and Router 3. How should this be configured?

In fact, it is just a combination of the situations in Case 1 and Case 2, which is Case 3.

Analysis: (Here, routers are represented by R)

R1 is between R2 and R3, and R1 is connected to PC2. To achieve mutual access between PC2 and PC1, PC3, the destination addresses for R1 are PC1 and PC3.

The next hop for R1 is R2 and R3. The WAN port of R2 is connected to the LAN port of R1, so the LAN port address of R1 and the WAN port address of R2 are in the same subnet, and the WAN port address of R1 and the WAN port of R3 are in the same subnet.

So for R1:

Destination address is 192.168.1.0, mask 255.255.255.0, next hop (gateway) is 192.168.0.100

Destination address is 172.16.0.0, mask 255.255.0.0, next hop (gateway) is 10.1.1.3

So for R3:

Destination address is 192.168.0.0, mask 255.255.255.0, next hop is 10.1.1.2

Destination address is 192.168.1.0, mask 255.255.255.0, next hop is 10.1.1.2.

If the above is not understood, it can be viewed from another perspective:

For router R3, it can only see R1 and not R2, so for R3, the two routes from R1 to R2 can be summarized into one, which is:

Destination address is 192.168.0.0, mask is 255.255.0.0, next hop is 10.1.1.2, this subnet includes all subnets from 192.168.0.0 to 192.168.255.0, including R1 and R2. This static route will forward all packets with destination IPs within this range to router R1 at 10.1.1.2. This method of summarizing multiple subnet route entries into a single route entry that encompasses all is called route summarization.

Why is it important to write subnet masks accurately in a network?

In large routers, the routing table is often very long and large. Using route summarization can reduce the length of the routing table and improve router efficiency.

Of course, route summarization is not always effective, as subnetting is arbitrary, and other subnets in the summarized route may exist under other local area networks. Recklessly summarizing may lead to errors, so in actual projects, we must calculate subnet masks very accurately. This is why we previously advised against setting class B addresses directly with a subnet mask of 255.255.0.0.

The route summarization in the above example 3 can be set more accurately, for 192.168.0.0 and 192.168.1.0, the same number of network bits is 23. To distinguish these two subnets, the mask should be set to 255.255.254.0, rather than 255.255.0.0. This improved summarized routing table should be written as follows:

Destination address is 192.168.0.0, subnet mask is 255.255.254.0, next hop is 10.1.1.2, this summarized route will only include the two subnets 192.168.0.0 and 192.168.0.1, which is a precise route. This helps with future network expansion and maintenance.

Source: First Monitoring

Previous selections:

Why develop WeChat mini-programs?

The importance of security monitoring

Want to know more information? Follow us!

Feel free to call or leave a message!

Various Networking Configurations for Routers

Phone: 0854-2779389

Mobile:18685093999 19185046915

Address: Second Floor, Canteen, Yongyang Street Office, Weng’an County

Various Networking Configurations for Routers

Scan the QR code | Follow us

WeChat ID | wa-0854

Click to follow and never get lost

Various Networking Configurations for Routers

Clickto read and may your wishes come true!Various Networking Configurations for Routers

Leave a Comment