实验目的:将私有地址转换为合法的IP地址,并解决IP地址不足的问题,而且还能有效的避免来自网络外的攻击。让内网可以访问外网,而外网不可以访问内网,起到内网安全保护数据的作用; 1,配置环境: 先准备环境 2台PC机 1台交换机4台路由器 先将PC机配置IP地址及子网掩码和网关(网关配置在路由器R1与交换机端口) 在路由器R1->R2端口配置不同网段IP;R1->R2->R3共两个不同网段 在R1->PC上的不同网段端口上配置启用静态NAT 验证、测试、保存, 2,配置步骤:
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: <Huawei>system-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