Two routers in different network segments, how to achieve intranet intercommunication

We often encounter enterprises adding a router with the increase of employees or departments, which are divided into two network segments. A subnet and B subnet are in different network segments. When there are multiple routers in the network, different routers are required. The subordinate subnets can communicate with each other, and at the same time can access the Internet through the broadband router. How can this be achieved?

Case Scenario 1
An enterprise accesses the Internet through a router R1 and a local area network LAN1. Due to business needs, a router R2 is expanded and a new LAN segment LAN2 is added. Now both PC1 and PC2 can access the external network normally, and PC2 can access PC1, but how to make PC1 access PC2, the network topology diagram is as follows:

In order to simulate the real Internet environment, we first deploy the network. 

1. R1 router settings 

<R1>sys
[R1]sys R1
[R1]un in en

[R1]dhcp enable

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip addr 192.168.137.10 24
[R1-GigabitEthernet0/0/0]quit

[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip addr 192.168.10.1 24
[R1-GigabitEthernet0/0/1]dhcp select int
[R1-GigabitEthernet0/0/1]dhcp server dns-list 114.114.114.114
[R1-GigabitEthernet0/0/1]quit

# NAT设置实现上网
[R1]acl 2000
[R1-acl-basic-2000]rule 5 permit source 192.168.10.0 0.0.0.255
[R1-acl-basic-2000]int g0/0/0
[R1-GigabitEthernet0/0/0]nat outbound 2000
[R1-GigabitEthernet0/0/0]quit

[R1]dns resolve
[R1]dns server 114.114.114.114

# 默认路由
[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.137.1

2. R2 router settings

<R2>sys
[R2]sys R2
[R2]un in en

[R2]dhcp enable

[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip addr 192.168.10.2 24
[R2-GigabitEthernet0/0/0]quit

[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip addr 10.0.10.254 24
[R2-GigabitEthernet0/0/1]dhcp select int
[R2-GigabitEthernet0/0/1]dhcp server dns-list 114.114.114.114
[R2-GigabitEthernet0/0/1]quit

# NAT设置实现上网
[R2]acl 2000
[R2-acl-basic-2000]rule 5 permit source 10.0.10.0 0.0.0.255
[R2-acl-basic-2000]int g0/0/0
[R2-GigabitEthernet0/0/0]nat outbound 2000
[R2-GigabitEthernet0/0/0]quit

[R2]dns resolve
[R2]dns server 114.114.114.114

# 默认路由
[R2]ip route-static 0.0.0.0 0.0.0.0 192.168.10.1

3. Through the above settings, we have achieved

PC1 can access the Internet

PC1>ping www.baidu.com

www.baidu.com -> www.a.shifen.com

Ping www.a.shifen.com [110.242.68.3]: 32 data bytes, Press Ctrl_C to break
From 110.242.68.3: bytes=32 seq=1 ttl=45 time=62 ms
From 110.242.68.3: bytes=32 seq=2 ttl=45 time=78 ms
From 110.242.68.3: bytes=32 seq=3 ttl=45 time=78 ms
From 110.242.68.3: bytes=32 seq=4 ttl=45 time=47 ms
From 110.242.68.3: bytes=32 seq=5 ttl=45 time=63 ms

--- 110.242.68.3 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 47/65/78 ms

PC2 can access the Internet

PC2>ping www.baidu.com

www.baidu.com -> www.a.shifen.com

Ping www.a.shifen.com [110.242.68.3]: 32 data bytes, Press Ctrl_C to break
From 110.242.68.3: bytes=32 seq=1 ttl=44 time=78 ms
From 110.242.68.3: bytes=32 seq=2 ttl=44 time=62 ms
From 110.242.68.3: bytes=32 seq=3 ttl=44 time=63 ms
From 110.242.68.3: bytes=32 seq=4 ttl=44 time=78 ms
From 110.242.68.3: bytes=32 seq=5 ttl=44 time=94 ms

--- 110.242.68.3 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 62/75/94 ms

PC2 accesses PC1

PC2>ping 192.168.10.254

Ping 192.168.10.254: 32 data bytes, Press Ctrl_C to break
From 192.168.10.254: bytes=32 seq=1 ttl=127 time=32 ms
From 192.168.10.254: bytes=32 seq=2 ttl=127 time=31 ms
From 192.168.10.254: bytes=32 seq=3 ttl=127 time=47 ms
From 192.168.10.254: bytes=32 seq=4 ttl=127 time=31 ms
From 192.168.10.254: bytes=32 seq=5 ttl=127 time=47 ms

--- 192.168.10.254 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 31/37/47 ms

PC1 cannot access PC2

PC>ping 10.0.10.253

Ping 10.0.10.253: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
Request timeout!
Request timeout!
Request timeout!

--- 10.0.10.253 ping statistics ---
  5 packet(s) transmitted
  0 packet(s) received
  100.00% packet loss

4. R1 adds a static route

# 增加静态路由,实现10.0.10.0网段访问192.168.10.0
[R1]ip route-static 10.0.10.0 24 192.168.10.2

PC1 successfully accesses PC2 

PC1>ping 10.0.10.253

Ping 10.0.10.253: 32 data bytes, Press Ctrl_C to break
From 10.0.10.253: bytes=32 seq=1 ttl=127 time=62 ms
From 10.0.10.253: bytes=32 seq=2 ttl=127 time=63 ms
From 10.0.10.253: bytes=32 seq=3 ttl=127 time=62 ms
From 10.0.10.253: bytes=32 seq=4 ttl=127 time=63 ms
From 10.0.10.253: bytes=32 seq=5 ttl=127 time=47 ms

--- 10.0.10.253 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 47/59/63 ms

Guess you like

Origin blog.csdn.net/mshxuyi/article/details/130621503