1. 程式人生 > >如何實現私有地址訪問外網(華為)

如何實現私有地址訪問外網(華為)

src perm 分享 配置 5.0 其中 rip oss 9.png

技術分享圖片
操作步驟及思路:
一.分別給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 拼外網看能成功否

如何實現私有地址訪問外網(華為)