不废话,先上图
先从图说起,有的工程或者有的家庭或者其他原因需要多接几个信息点,但是又不方便多布几跟线,就另接一个soho路由吧,我就这个来模拟下吧!
在罗嗦几句,首先r1不可能配置一条路由到r3(也不需要),因为如果是整个小区的路由也不会让你来动,可以使用nat方法来解决这个问题,只要是个路由器就有这个功能。
我的思路是:r2下面的主机先经过r2的nat转换成192。168。1。5这个ip add,他与r1直连,路由表上有r1的路由,当frame到达r1,r1把当成r2的frame,经过r1的nat,转换成内部全局地址200。1。1。2进行packet的封装,传输。
不知道,在这拓扑里面,谁算是内部本地地址?10。1。1。0/24的?还是192。168。1。0/24的?
本来想用gns3来解决,无赖那该死vps与gns占用太多cpu资源而不了了之,r2一直不能接收到r1分配的ip add,无赖只能自己配置一个,packet tracer 居然连掩码都不能输成“/24”,i服了packet tracer。
上配置,
这个是r2的,(自己新增加的soho路由)
- Building configuration...
- Current configuration : 1070 bytes
- !
- version 12.2
- no service timestamps log datetime msec
- no service timestamps debug datetime msec
- service password-encryption
- !
- hostname r2
- !
- !
- !
- enable password 7 0822455D0A16
- !
- !
- ip dhcp excluded-address 10.1.1.1 10.1.1.2
- !
- ip dhcp pool abc
- network 10.1.1.0 255.255.255.0
- default-router 10.1.1.1
- dns-server 202.102.192.68
- !
- !
- !
- !
- !
- !
- !
- !
- !
- !
- !
- !
- !
- interface FastEthernet0/0
- ip address 192.168.1.5 255.255.255.0
- ip nat outside
- duplex auto
- speed auto
- !
- interface FastEthernet0/1
- no ip address
- duplex auto
- speed auto
- shutdown
- !
- interface FastEthernet1/0
- ip address 10.1.1.1 255.255.255.0
- ip nat inside
- duplex auto
- speed auto
- !
- interface FastEthernet1/1
- no ip address
- duplex auto
- speed auto
- shutdown
- !
- ip nat inside source list 100 interface FastEthernet0/0 overload
- ip classless
- ip route 0.0.0.0 0.0.0.0 FastEthernet0/0
- !
- !
- access-list 100 permit ip 10.1.1.0 0.0.0.255 any
- !
- !
- !
- !
- !
- line con 0
- exec-timeout 0 0
- password 7 08701E1D
- logging synchronous
- login
- line vty 0 4
- exec-timeout 0 0
- password 7 08701E1D
- logging synchronous
- login
- !
- !
- !
- end
这个是r1的配置,
- r1#show run
- Building configuration...
- Current configuration : 1073 bytes
- !
- version 12.2
- no service timestamps log datetime msec
- no service timestamps debug datetime msec
- service password-encryption
- !
- hostname r1
- !
- !
- !
- enable password 7 0822455D0A16
- !
- !
- ip dhcp excluded-address 192.168.1.0 192.168.1.10
- !
- ip dhcp pool abc
- network 192.168.1.0 255.255.255.0
- default-router 192.168.1.1
- dns-server 202.102.192.68
- !
- !
- !
- !
- !
- !
- !
- !
- !
- !
- !
- !
- !
- interface FastEthernet0/0
- ip address 192.168.1.1 255.255.255.0
- ip nat inside
- duplex auto
- speed auto
- !
- interface FastEthernet0/1
- no ip address
- duplex auto
- speed auto
- shutdown
- !
- interface Serial0/0
- ip address 200.1.1.2 255.255.255.0
- ip nat outside
- !
- interface Serial0/1
- no ip address
- shutdown
- !
- ip nat inside source list 100 interface Serial0/0 overload
- ip classless
- ip route 0.0.0.0 0.0.0.0 200.1.1.1
- !
- !
- access-list 100 permit ip 192.168.1.0 0.0.0.255 any
- access-list 1 permit host 192.168.1.1
- !
- !
- !
- !
- !
- line con 0
- access-class 1 out
- password 7 08701E1D
- logging synchronous
- login
- line vty 0 4
- access-class 1 out
- exec-timeout 0 0
- password 7 08701E1D
- logging synchronous
- login
- !
- !
- !
- end
来看看结果,从pc3上面的ping结果:
- Packet Tracer PC Command Line 1.0
- PC>ipconfig /all
- Physical Address................: 0090.0C2E.0870
- IP Address......................: 10.1.1.4
- Subnet Mask.....................: 255.255.255.0
- Default Gateway.................: 10.1.1.1
- DNS Servers.....................: 202.102.192.68
- PC>ping 200.1.1.1
- Pinging 200.1.1.1 with 32 bytes of data:
- Request timed out.
- Reply from 200.1.1.1: bytes=32 time=140ms TTL=253
- Reply from 200.1.1.1: bytes=32 time=140ms TTL=253
- Reply from 200.1.1.1: bytes=32 time=156ms TTL=253
- Ping statistics for 200.1.1.1:
- Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
- Approximate round trip times in milli-seconds:
- Minimum = 140ms, Maximum = 156ms, Average = 145ms
- PC>
tracert 结果:
- PC>tracert 200.1.1.1
- Tracing route to 200.1.1.1 over a maximum of 30 hops:
- 1 62 ms 62 ms 62 ms 10.1.1.1
- 2 125 ms 125 ms 125 ms 200.1.1.1
- 3 125 ms 141 ms 156 ms 200.1.1.1
- Trace complete.
p.s.pkt文件放在附件里面,telnet与console密码都是123,enable password是cisco
转载于:https://blog.51cto.com/fengyun/384182