实验目的:

掌握网络地址转换NAT/PAT的配置。

实验环境拓扑图及要求:

 

image

 

实验要求:

1、 如图所示,路由器A模拟PC,实现全网互通。但是PC不能PING通外网。

基本思路:

实现全网互通.

1:命名

2:配置接口IP地址

3:配置RIP

4:宣告网段

(一)静态NAT:

1:配置外部端口IP

2:配置内部端口的IP

3:建立静态地址转换

4:在内部和外部端口上启用NAT

(二)动态NAT:

1:配置外部端口IP

2:配置内部端口的IP

3:定义内部可访问外部的控制列表

4:定义合法地址池

5:实现网络地址转换

6:在内部和外部端口上启用NAT

(三)PAT:

1:配置外部端口IP

2:配置内部端口的IP

3:定义内部访问列表

4:定义合法地址池

5:设置复用动态IP地址转换

6:在内部和外部端口上启用NAT

2、

配置:

--------------------------------------------------------

RA:

en

conf t

host PC

no ip routing //禁用路由功能

no ip domain-lo

int f0/0 //配置端口IP

ip add 192.168.1.1 255.255.255.0

no sh

exit

ip default-gateway 192.168.1.2 //指向网关

end

----------------------------------------------------------

RB:

en

conf t

host RB

no ip domain-lo

int f0/0

ip add 202.1.1.1 255.255.255.0

no sh

exit

int f1/0

ip add 192.168.1.2 255.255.255.0

no sh

exit

router rip //启用rip

version 2 //配置版本2

no auto-summary //不自动汇总

network 202.1.1.0 //宣告网段

end

---------------------------------------------------------

RC:

en

conf t

host RC

no ip domain-lo

int f0/0

ip add 202.1.2.1 255.255.255.0

no sh

exit

int f1/0

ip add 202.1.1.2 255.255.255.0

no sh

exit

router rip

version 2

no auto-summary

network 202.1.2.0

network 202.1.1.0

end

---------------------------------------------------------

RD:

en

conf t

host RD

no ip domain-lo

int f0/0

ip add 202.1.2.2 255.255.255.0

no sh

exit

router rip

version 2

no auto-summary

network 202.1.2.0

end

---------------------------------------------------------

clip_image002clip_image004clip_image006clip_image008

3、 测试静态NAT :
在路由器B上配置静态NAT,将192.168.1.1 地址转换成202.1.1.10,实现路由器A能访问到外部网络,列出转换列表。

配置:

RB:

conf t

ip nat inside source static 192.168.1.1 202.1.1.10 //配置NAT转换地址

int f0/0

ip nat outside //在端口上配置NAT出

exit

int f1/0

ip nat inside //在端口上配置NAT进

end

clip_image010clip_image012clip_image014

4、 测试动态NAT:
删除之前的NAT,在路由器B上配置动态NAT,将192.168.1.0 网段内的地址转换成202.1.1.50-60,实现路由器A能访问到外部网络,列出转换列表。

配置:

RB:

conf t

access-list 1 permit 192.168.1.0 0.0.0.255 //配置允许访问列表

ip nat pool test0 202.1.1.50 202.1.1.60 netmask 255.255.255.0 //配置合法IP地址池

ip nat inside source list 1 pool test0 //将控制列表和地址池绑定

int f0/0

ip nat outside

exit

int f1/0

ip nat inside

end

clip_image016clip_image018clip_image020clip_image014[1]

5、 测试PAT:

a) 删除之前的NAT,在路由器B上配置PAT,复用到外部全局地址,将192.168.1.0 网段内的地址转换成202.1.1.100,实现路由器A能访问到外部网络,列出转换列表。

配置:

RB:

conf t

access-list 1 permit 192.168.1.0 0.0.0.255 //配置允许访问的控制列表

ip nat pool only 202.1.1.100 202.1.1.100 netmask 255.255.255.0 //配置合法地址池

ip nat inside source list 1 pool only overload //绑定

int f0/0

ip nat outside

exit

int f1/0

ip nat inside

end

clip_image022

clip_image023

b) 删除之前的NAT,在路由器B上配置PAT,复用到外部接口地址,将192.168.1.0 网段内的地址转换成202.1.1.1,实现路由器能访问到外部网络,列出转换列表。

配置:

RB:

conf t

access-list 1 permit 192.168.1.0 0.0.0.255

ip nat inside source list 1 interface f0/0 overload //配置为绑定到接口上

int f0/0

ip nat outside

exit

int f1/0

ip nat inside

end

clip_image002[4]clip_image004[4]