温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

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

发布时间:2020-07-24 12:58:06 来源:网络 阅读:1757 作者:崔志磊 栏目:系统运维

如何把私有地址转换成公有地址来访问外部?
操作步骤及思路:
一.分别给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 拼外网看能成功否

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI