如何实现私有地址访问外网(华为)

如何实现私有地址访问外网(华为)
操作步骤及思路:
一.分别给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 ge0/0/0
undo shutdown //激活端口
ip address 192.168.1.254 255.255.255.0
interface g0/0/1
ip address 10.1.1.1 255.255.255.0
三.在路由2上配置ip
interface ge0/0/0
undo shutdown //激活端口
ip address 10.1.1.2 255.255.255.0
interface g0/0/1
undo shutdown //激活端口
ip address 192.168.20.1.1.1
四.在路由3上配置ip
interface g0/0/0
undo shutdown //激活端口
ip address 20.1.1.2 255.255.255.0
五.在路由1中设置默认路由让它能发包过去
ip route 0.0.0.0 0.0.0.0 10.1.1.2
六.让其他两个路由器自己学习
路由2:
rip //启用rip路由协议
version 2 //使用rip2版本
network 10.0.0.0
network 20.0.0.0 进入rip协议
路由3:
rip //启用rip路由协议
version 2 //使用rip2版本
network 20.1.1.0 进入rip协议
七.在路由1把私有地址转化为公有地址
1.定义感兴趣的流量
acl 2000
rule 5 permit source 192.168.1.0 0.0.0.255
2.在流量的出端口配置NAT
interface ge0/0/1
nat outbound 2000-->在该端口上发送出去,并且被 ACL 2000
匹配的流量,其中的源IP地址转换为该
接口的IP地址;
八.在pc机上验证
在两台pc机上ping 20.1.1.2 拼外网看能成功否