
开始给R1 R2 R3 全部配了ospf, 在R2上做了pat, R1作为inside R3作为outside,
但是很快发现这样做没有意义,因为R3上有R1的全部路由,虽然在R2上网络地址做了转换,但是R1并没有被很好的隐藏起来,然后给区域1配置了完全stub区域,这仅仅是减少了stub区域内路由器减少了路由条目,起不到保护内部的作用,
最后吧R1 的ospf去掉,R1R2间改用静态路由,于是R1对于R3做到了完全应藏,而同时又可以R1ping通R3,R3不能pingR1。如果是小型公司,用这样完全可以上网,
现在卖一百多元的soho路由器实现的就是这个功能。
Router(config)#host R1
R1(config)#no ip do lo
R1(config)#ip su
R1(config)#ip subnet-zero
R1(config)#line con 0
R1(config-line)#logg syn
R1(config-line)#no exec-t
R2(config)#ip nat inside source list 1 interface s2/2 overload
R2(config)#access-list 1 permit
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O -
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
O
O
O
O
C
O
C
C
R1#ping
R2#
*Aug 6 15:52:11.615: NAT: s=
*Aug 6 15:52:11.799: NAT*: s=
*Aug 6 15:52:11.911: NAT*: s=
*Aug 6 15:52:11.935: NAT*: s=
*Aug 6 15:52:11.999: NAT*: s=
*Aug 6 15:52:12.043: NAT*: s=
*Aug 6 15:52:12.119: NAT*: s=
*Aug 6 15:52:12.167: NAT*: s=
*Aug 6 15:52:12.183: NAT*: s=
*Aug 6 15:52:12.239: NAT*: s=
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O -
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C
C
C
C
O
O IA
O IA
C
R3#ping
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/146/212 ms
R3#
*Aug 6 15:55:10.015: ICMP: echo reply rcvd, src
*Aug 6 15:55:10.215: ICMP: echo reply rcvd, src
*Aug 6 15:55:10.255: ICMP: echo reply rcvd, src
*Aug 6 15:55:10.471: ICMP: echo reply rcvd, src
*Aug 6 15:55:10.583: ICMP: echo reply rcvd, src
R3#telnet
Trying
User Access Verification
Password:
R1>en
Password:
R1#
R2(config-router)#area 1 stub no-summary
R2(config-router)#area 1 stub no-summary
R1(config-router)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O -
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is
C
C
C
C
O
C
O*I
R1(config-router)#
R1(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O -
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is
C
C
C
C
C
S*
R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O -
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
O IA
C
C
O IA
