HCIA实验(10)NAT

【1】第一阶段 

HCIA实验(10)NAT_第1张图片

1.在交换机上创建VLAN

[sw1]int e0/0/2
[sw1-Ethernet0/0/2]port link-type access 
[sw1-Ethernet0/0/2]port default vlan 2
[sw1]int e0/0/3
[sw1-Ethernet0/0/3]port link-type access 
[sw1-Ethernet0/0/3]port default vlan 3
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-type trunk 
[sw1-Ethernet0/0/1]port trunk allow-pass vlan all
[sw2]int e0/0/2
[sw2-Ethernet0/0/2]port link-type access 
[sw2-Ethernet0/0/2]port default vlan 2
[sw2]int e0/0/3
[sw2-Ethernet0/0/2]port link-type access 
[sw2-Ethernet0/0/2]port default vlan 3
[sw2]int e0/0/1
[sw2-Ethernet0/0/1]port link-type trunk 
[sw2-Ethernet0/0/1]port trunk allow-pass vlan all 

2.配置路由器,开启ARP功能

[r1]int g0/0/1.1
[r1-GigabitEthernet0/0/1.1]dot1q termination vid 2
[r1-GigabitEthernet0/0/1.1]ip add 192.168.1.1 25
[r1-GigabitEthernet0/0/1.1]arp broadcast enable 
[r1]int g0/0/1.2
[r1-GigabitEthernet0/0/1.2]dot1q termination vid 3
[r1-GigabitEthernet0/0/1.2]ip add 192.168.1.129 25
[r1-GigabitEthernet0/0/1.2]arp broadcast enable 
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.0.1 30
[r2]int g0/0/1.1
[r2-GigabitEthernet0/0/1.1]dot1q termination vid 2
[r2-GigabitEthernet0/0/1.1]ip add 192.168.2.1 25
[r2-GigabitEthernet0/0/1.1]arp broadcast enable 
[r2]int g0/0/1.2
[r2-GigabitEthernet0/0/1.2]dot1q termination vid 3
[r2-GigabitEthernet0/0/1.2]ip add 192.168.2.129 25
[r2-GigabitEthernet0/0/1.2]arp broadcast enable 
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.0.2 30

3.开启DHCP服务

[r1]dhcp enable 
[r1]ip pool 01
[r1-ip-pool-01]network 192.168.1.0 mask 25
[r1-ip-pool-01]gateway-list 192.168.1.1
[r1-ip-pool-01]dns-list 114.114.114.114
[r1]ip pool 02
[r1-ip-pool-02]network 192.168.1.128 mask 25
[r1-ip-pool-02]gateway-list 192.168.1.129
[r1-ip-pool-02]dns-list 114.114.114.114
[r1]int g0/0/1.1
[r1-GigabitEthernet0/0/1.1]dhcp select global 
[r1]int g0/0/1.2
[r1-GigabitEthernet0/0/1.2]dhcp select global 
[r2]dhcp enable 
[r2]ip pool 01
[r2-ip-pool-01]network 192.168.2.0 mask 25
[r2-ip-pool-01]gateway-list 192.168.2.1
[r2-ip-pool-01]dns-list 114.114.114.114
[r2]ip pool 02
[r2-ip-pool-02]network 192.168.2.128 mask 25
[r2-ip-pool-02]gateway-list 192.168.2.129
[r2-ip-pool-02]dns-list 114.114.114.114
[r2]int g0/0/1.1
[r2-GigabitEthernet0/0/1.1]dhcp select global 
[r2]int g0/0/1.2 
[r2-GigabitEthernet0/0/1.2]dhcp select global 

4.在PC端开启DHCP服务

HCIA实验(10)NAT_第2张图片HCIA实验(10)NAT_第3张图片

验证
HCIA实验(10)NAT_第4张图片HCIA实验(10)NAT_第5张图片

5.宣告

[r1]rip 1
[r1-rip-1]ver 2
[r1-rip-1]network 192.168.1.0 
[r1-rip-1]network 192.168.0.0
[r2]rip 1
[r2-rip-1]ver 2
[r2-rip-1]network 192.168.2.0
[r2-rip-1]network 192.168.0.0

查看
HCIA实验(10)NAT_第6张图片

(进行路由汇总)

[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]rip summary-address 192.168.1.0 255.255.255.0
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]rip summary-address 192.168.2.0 255.255.255.0

检测
HCIA实验(10)NAT_第7张图片HCIA实验(10)NAT_第8张图片

6.沉默接口

[r1]rip 1
[r1-rip-1]silent-interface g0/0/1.1
[r1-rip-1]silent-interface g0/0/1.2
[r2]rip 2
[r2-rip-2]silent-interface g0/0/1.1
[r2-rip-2]silent-interface g0/0/1.2

7.测试

HCIA实验(10)NAT_第9张图片HCIA实验(10)NAT_第10张图片

【2】第二阶段(局域网访问广域网)

HCIA实验(10)NAT_第11张图片

1.补充配置路由器接口

[r2]int g0/0/2
[r2-GigabitEthernet0/0/2]ip add 12.1.1.1 24
[isp]int g0/0/0
[isp-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[isp]int g0/0/1
[isp-GigabitEthernet0/0/1]ip add 1.1.1.1 24

2.访问ISP,配置缺省路由

[r1]rip 1
[r1-rip-1]default-route originate 
[r2]ip route-static 0.0.0.0 0 12.1.1.2

3.定义可被转换的私有IP地址范围

[r2]acl 2000
[r2-acl-basic-2000]rule permit source 192.168.0.0 0.0.255.255
(公网所在接口,源IP地址修改为该接口公有IP)
[r2]int g0/0/2
[r2-GigabitEthernet0/0/2]nat outbound 2000

4.测试

HCIA实验(10)NAT_第12张图片HCIA实验(10)NAT_第13张图片

HCIA实验(10)NAT_第14张图片 HCIA实验(10)NAT_第15张图片

你可能感兴趣的:(华为,服务器,网络,运维,网络协议)