首页 > 其他 > 详细

NAT PAT技术实现网络访问

时间:2014-02-26 06:56:31      阅读:534      评论:0      收藏:0      [点我收藏+]

 

         NAT PAT技术实现网络访问bubuko.com,布布扣

1、在三层交换机M1配置dhcp功能,实现vlan10 vlan20 里客户机可以自动获取IP地址。 

    设备配置如下:

 

sw1#config ter

sw1(config)#vlan 10

sw1(config-vlan)#vlan 20

sw1(config)#inte fa 1/1

sw1(config-if)#swit mode ac

sw1(config-if)#swit acc vlan 10

sw1(config-if)#exit

sw1(config)#inter fa 1/2

sw1(config-if)#swit mode acc

sw1(config-if)#swit acc vlan 20

sw1(config-if)#inte fa 1/0

sw1(config-if)#swit mode trunk

sw1(config-if)#swit trunk encapsulation dot1q

 

sw2#config ter

sw2(config-vlan)#inter fa 1/1

sw2(config-if)#swi mode acc

sw2(config-if)#swi acc vlan 30

sw2(config-if)#inter fa 1/2

sw2(config-if)#swit mode trunk

sw2(config-if)#swit trunk encapsulation dot1q

 

m1#config ter

m1(config)#vlan 10

m1(config-vlan)#vlan 20

m1(config-vlan)# vlan 30

m1(config-vlan)#inter fa 1/1 

m1(config-if)#swit mode trunk

m1(config-if)#inte fa 1/2

m1(config-if)#swit mode trunk

m1(config-if)#exit

m1(config)#inter vlan 10

m1(config-if)#ip add 192.168.10.1 255.255.255.0

m1(config-if)#no shutdown

m1(config-if)#inter vlan 20

m1(config-if)#ip add 192.168.20.1 255.255.255.0

m1(config-if)#no shutdown

m1(config-if)#inter vlan 30

m1(config-if)#ip add 192.168.30.1 255.255.255.0

m1(config-if)#no shutdown

m1(config-if)#exit

m1(config)#ip dhcp pool v10

m1(dhcp-config)#network 192.168.10.0 255.255.255.0

m1(dhcp-config)#default-router  192.168.10.1

m1(dhcp-config)#dns-server 192.168.30.10

m1(dhcp-config)#lease 30

m1(dhcp-config)#ip dhcp pool v20

m1(dhcp-config)#network 192.168.20.0 255.255.255.0

m1(dhcp-config)#default-router 192.168.20.1

m1(dhcp-config)#dns-server 192.168.30.10

m1(dhcp-config)#lease 30

m1(dhcp-config)#exit

 

 

总结 :以上配置就可实现vlan10 vlan20 自动从M1 获取IP 地址。Vlan30 成员需手动  

       配置IP 

 

2、实现服务器C3通过静态NAT转换为12.0.0.10,能够上网。

 

R1#config ter

R1(config)#inter fa 0/1

R1(config-if)#ip add 192.168.100.1 255.255.255.0

R1(config-if)#no shutdown

R1(config-if)#inter fa 0/0

R1(config-if)#ip add 12.0.0.1 255.255.255.0

R1(config-if)#no shutdown

R1(config)#ip route 0.0.0.0 0.0.0.0  12.0.0.2

R1(config)#ip route 192.168.10.0 255.255.255.0 192.168.100.10

R1(config)#ip route 192.168.20.0 255.255.255.0 192.168.100.10

R1(config)#ip route 192.168.30.0 255.255.255.0 192.168.100.10

R1(config)#inter fa 0/1

R1(config-if)#ip nat inside

R1(config-if)#inter fa 0/0

R1(config-if)#ip nat outside

R1(config-if)#exit

R1(config)#ip nat inside source static 192.168.30.10 12.0.0.10

 

m1(config)#inter fa 1/0

m1(config-if)#no swit

m1(config-if)#ip add 192.168.100.10 255.255.255.0

m1(config-if)#no shutdown

m1(config-if)#exit

m1(config)#ip route 0.0.0.0 0.0.0.0 192.168.100.1

 

R2#config ter

R2(config)#inte fa 0/0

R2(config-if)#ip add 12.0.0

R2(config-if)#ip add 12.0.0.2 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#exit

 

3、实现vlan20 成员使用动态NAT转换为合法的外网IP IP范围12.0.0.50-12.0.0.60

 

R1(config)#access-list 10 permit 192.168.10.0 0.0.0.255

R1(config)#ip nat pool vlan10 12.0.0.50 12.0.0.60 netmask 255.255.255.0

R1(config)#ip nat inside source list 10 pool vlan10

 

4、实现 vlan 20 成员使用PAT 复用R1的外网接口fa0/0.

R1(config)#access-list 20 permit 192.168.20.0 0.0.0.255

R1(config)#ip nat inside source list 20 inter fa 0/0 overload

 

总结:由于R1外网口和内网口在前面已经标记,后面就没再标记。

 

5、实现M1 、 R1 可以被内网主机远程管理。密码都为123

R1(config)# line vty 0 4

R1(config-line)#password 123

R1(config-line)#login

R1(config-line)#exit

R1(config)#enable password 123        //明文密码

 

R1(config)#enable secret  123         //加密密码

 

m1(config)#enable password 123

m1(config)#line vty 0 4

m1(config-line)#password 123

m1(config-line)#login

 

注:如果M1 、 R1 想被外网主机远程管理,只需对内网设备M1做端口映射。

 

 

 

 

 

本文出自 “技术无界限” 博客,请务必保留此出处http://8633961.blog.51cto.com/8623961/1363300

NAT PAT技术实现网络访问

原文:http://8633961.blog.51cto.com/8623961/1363300

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!