hostname R1
!
!
!
!
!
!
!
!
!
!
ip name-server 0.0.0.0
!
!
!
!
!
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0
ip address 192.168.3.1 255.255.255.252
clock rate 128000
!
interface Serial0/1
no ip address
shutdown
!
interface Serial0/2
no ip address
shutdown
!
interface Serial0/3
no ip address
shutdown
!
ip classless
ip route 192.168.2.0 255.255.255.0 192.168.3.2
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
line vty 0 4
login
!
!
!
end
R1#
hostname R2
!
!
!
!
!
!
!
!
!
!
ip name-server 0.0.0.0
!
!
!
!
!
!
interface FastEthernet0/0
ip address 192.168.2.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0
ip address 192.168.3.2 255.255.255.252
!
interface Serial0/1
no ip address
shutdown
!
interface Serial0/2
no ip address
shutdown
!
interface Serial0/3
no ip address
shutdown
!
ip classless
ip route 192.168.1.0 255.255.255.0 192.168.3.1
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
line vty 0 4
login
!
!
!
end
R2#
PC-1: 192.168.1.2 DG:192.168.1.1
PC-2: 192.168.1.3 DG:192.168.1.1
PC-3: 192.168.2.2 DG:192.168.2.1
PC-4: 192.168.2.3 DG:192.168.2.1
PC>ping 192.168.2.3
Pinging 192.168.2.3 with 32 bytes of data:
Reply from 192.168.2.3: bytes=32 time=203ms TTL=126
Reply from 192.168.2.3: bytes=32 time=138ms TTL=126
Ping statistics for 192.168.2.3:
Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 138ms, Maximum = 203ms, Average = 170ms
好像得路由器1的LAN口去接路由器1的LAN口,想不起来了
在两个路由器上设置默认路由,路由器1,ip route 0.0.0.0 0.0.0.0 s0/0/0 路由器2,ip route 0.0.0.0 0.0.0.0 s0/0/0 还有,两台pc上的网关设为两个路由器对应的口 pc1为192.168.1.1 pc2为192.168.2.1