您的位置:首页 > 其它

CCNA实验分析 NAT和路由查询过程

2009-07-10 21:42 190 查看


需求:
1.
R1模拟PC机(关闭ip routing)
2.
拓扑中仅使用2次静态路由
3.
拓扑中可以使用1次静态nat
4.
仅在2台路由器上使用EIGRP
5.
可使用一次默认网关

本实验可以帮助理解 NAT,路由表查询过程
本实验解法多样,可以互相交流

解法:
R1为PC,地址192.168.12.1/24,并指默认网关为R2的E1口,地址192.168.12.2。
interface Ethernet1
ip
address 192.168.12.1 255.255.255.0
!
ip default-gateway 192.168.12.2

R2上起静态NAT,并指一条静态路由去192.168.45.0
R2:
interface Ethernet0
ip
address 192.168.23.2 255.255.255.0
ip
nat outside
!
interface Ethernet1
ip
address 192.168.12.2 255.255.255.0
ip
nat inside
ip nat inside source static 192.168.12.1
192.168.23.4
ip route 192.168.45.0 255.255.255.0
Ethernet0

R3上起EIGRP ,公告192.168.23.0
和192.168.34.0
R3:
interface Ethernet0
ip
address 192.168.23.3 255.255.255.0
!
interface Ethernet1
ip
address 192.168.34.3 255.255.255.0
!
router eigrp 1
network 192.168.23.0
network 192.168.34.0
no
auto-summary
!

R4上起EIGRP 公告相邻网段
R4:
interface FastEthernet0/0
ip
address 192.168.45.4 255.255.255.0
duplex
auto
speed auto
!
interface FastEthernet0/1
ip
address 192.168.34.4 255.255.255.0
duplex
auto
speed auto
!

router eigrp 1
network 192.168.34.0
network 192.168.45.0
no
auto-summary
!

最后R5上起条静态路由:
R5:
interface Ethernet0
ip
address 192.168.45.5 255.255.255.0
!
ip route 192.168.23.0 255.255.255.0
Ethernet0

分析:
当PC发送icmp 包时,包头内携带的源IP地址为192.168.12.1,目标IP位192.168.45.5
因为默认网关的作用,包直接丢给R2
R2收到包192.168.12.0网段 ,发现只有12.0/24 , 23.0/24网段路由,所以需要一条道45.0/24的静态路由。则在经过R2时,由于NAT,包被重新封装:此时源IP192.168.23.4,目的IP192.168.45.5.
这个包被R3从e0口收到,由于EIGRP进程,包被丢给R4
R4从E1口收到这个包 ,包被丢给R5
R5收到这个包,包的源地址为192.168.23.4,目的为192.168.45.5,准备作出相应,但发现没有到达192.168.23.4网段。所以写一条默认路由指向该网段
R5将包丢给R4之后,重复之前的路由表查询过程 最后完成整个查询过程本文出自 “cedric's study” 博客,转载请与作者联系!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: