,配置环境:
① 先准备环境 2台PC机 1台交换机4台路由器
② 先将PC机配置IP地址及子网掩码和网关(网关配置在路由器R1与交换机端口)
③ 在路由器R1->R2端口配置不同网段IP;R1->R2->R3共两个不同网段
④ 在R1->PC上的不同网段端口上配置启用静态NAT
⑤ 验证、测试、保存,
4,配置步骤:
1)客户端:PC1:
ip 192.168.10.1
子网 255.255.255.0
网关 192.168.10.254
PC2:
ip192.168.10.2
子网 255.255.255.0
网关 192.168.10.254
(2)路由器:
R1:
<Huaweisystem-view
[R1]interfaceGigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]undo shutdown
[R1-GigabitEthernet0/0/0]ip address 192.168.10.254 255.255.255.0
[R1]interfaceGigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]undo shutdown
[R1-GigabitEthernet0/0/1]ip address 100.1.1.1 255.255.255.0
[R1-GigabitEthernet0/0/1]nat static enable
[R1-GigabitEthernet0/0/1]nat static global 100.1.1.3 inside 192.168.10.1
[R1]ip route-static 0.0.0.0 0.0.0.0 100.1.1.2
R2:
<Huawei>system-view
[R2]interfaceGigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]undo shutdown
[R2-GigabitEthernet0/0/0]ipaddress 100.1.1.2 255.255.255.0
[R2]interfaceGigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]undo shutdown
[R2-GigabitEthernet0/0/1]ip address 200.1.1.1 255.255.255.0
[R2]rip
[R2-rip-1]version 2
[R2-rip-1]network 200.1.1.0
[R2-rip-1]network 100.0.0.0
R3:
<Huawei>system-view
[R3]interfaceGigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]undo shutdown
[R3-GigabitEthernet0/0/0]ipaddress 200.1.1.2 255.255.255.0
[R3]rip
[R3-rip-1]version 2
[R3-rip-1]network 200.1.1.0
5,验证及测试:
6,总结:配置思路:
(1) PC机 配置静态IP地址
(2)路由器R1配置静态网关,另一端口配置不同IP地址
(3) 在路由器R2和R3端口配置不同网段IP,R1—R2—R3共两个不同网段
(4) 在R1的0/1端口上配置启用静态NAT,并下一跳至100.1.1.2
原文:http://blog.51cto.com/13560878/2060866