首页 > 代码库 > 路由器上网调试

路由器上网调试

wKiom1SJu5HhbftbAAC8zogrhEo881.jpg

一、完成交换(r2)的配置

二、完成外网r7路由的配置,该设备模拟运营商的路由器,其上配置loopback接口0,并且分配IP地 址             200.100.100.1/24  用于模拟公网上的一个节点

配置R2,采用nat静态一对一IP映射,使得r7能够访问外网,外网也能通过公网地址访问r7

 

 配置及实现

  r7配置

!
interface Loopback0
 ip address 200.100.100.1 255.255.255.255
!
interface Loopback1
 no ip address
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
!        
interface Serial0/0
 ip address 202.101.100.1 255.255.255.0
 clock rate 64000

 

 

 

r2基本配置

!
interface FastEthernet0/0
 ip address 192.168.100.1 255.255.255.0
 duplex auto
 speed auto
!
interface Serial0/0
 no ip address
 shutdown
 clock rate 2000000
!
interface FastEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
!
interface Serial0/1
 ip address 202.101.100.2 255.255.255.0
 clock rate 64000
!
ip route 0.0.0.0 0.0.0.0 202.101.100.1

 

 

r2配置

!
interface FastEthernet0/0
 ip address 192.168.100.2 255.255.255.0
 duplex auto
 speed auto

ip route 0.0.0.0 0.0.0.0 192.168.100.1
!

 

现在基本配置都配完了,但是r2可以ping通r1可以ping通的,因为他们在一个直连路由所以可以正常ping但是ping   r7就不能ping通了

 

 

测试

ping r1路由

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.100.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/30/68 ms

 


Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 202.101.100.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/47/68 ms

 

测试ping r7路由

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 202.101.100.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

 

 

 

ping不通最重要的一个环节就是没有做nat  很多人遇到过这样的故障,现在我把NAT做上去测试网络

NAT配置  在r1上配置

R1(config)#ip nat  inside  source static  192.168.100.1 202.101.100.1

R1(config)#interface  f0/0

R1(config-if)#ip nat  inside

R1(config)#interface  s0/1

R1(config-if)#ip nat  outside

 

配置完成了现在再进行测试

 

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 202.101.100.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/36/64 ms

 

本文出自 “稻草人” 博客,谢绝转载!

路由器上网调试