首页 > 其他 > 详细

如何把私有地址转换成公有地址来访问外部?

时间:2018-01-13 11:01:04      阅读:404      评论:0      收藏:0      [点我收藏+]
技术分享图片
操作步骤及思路:
一.分别给pc1,pc2配上ip地址,子网掩码,网关
#pc1
ip:192.168.1.1
子网掩码:255.255.255.0
网关:192.168.1.254
pc2
ip:192.168.1.2
子网掩码:255.255.255.0
网关:192.168.1.254
二.在路由1上配置网关
interface g0/0
no shutdown //激活端口
ip address 192.168.1.254 255.255.255.0
interface g0/1
ip address 10.1.1.1 255.255.255.0
三.在路由2上配置ip
interface g0/0
no shutdown //激活端口
ip address 10.1.1.2 255.255.255.0
interface g0/1
no shutdown //激活端口
ip address 192.168.20.1.1.1
四.在路由3上配置ip
interface g0/0
no shutdown //激活端口
ip address 20.1.1.2 255.255.255.0
五.在路由1中设置默认路由让它能发包过去
ip routing //开启路由功能
ip route 0.0.0.0 0.0.0.0 10.1.1.2
六.让其他两个路由器自己学习
路由2:
route rip //启用rip路由协议
version 2 //使用rip2版本
no auto-summary //关闭rip协议动态汇总
network 10.1.1.0
network 20.1.1.0 进入rip协议
路由3:
route rip //启用rip路由协议
version 2 //使用rip2版本
no auto-summary //关闭rip协议动态汇总
network 20.1.1.0 进入rip协议
七.在路由1把私有地址转化为公有地址
interface g0/0
ip nat inside //内网边界
interface g0/1
ip nat outside //外网边界
access-list 1 permit 192.168.1.0 0.0.0.255
确定要进行nat转换的私有地址空间
ip nat inside source list 1 interface g0/1
针对私有地址配置对应mat转换条目
八.在pc机上验证
ping 20.1.1.2 拼外网看能成功否

如何把私有地址转换成公有地址来访问外部?

原文:http://blog.51cto.com/13568840/2060504

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