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

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

转载于:https://blog.51cto.com/13568840/2060504

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值