一:实验环境 1.1: 华为ensp软件 1.2: PC机和路由器及交换机 初始化状态的PC机和初始化状态的路由器,交换机连接如图拓扑,并开启 二.实验需求,R2提供NAT服务;server页面访问 三:实验过程 3.1:配置SW1交换机

vlan batch 10 20 30 40
interface Vlanif10
 ip address 192.168.10.1 255.255.255.0
interface Vlanif20
 ip address 192.168.20.1 255.255.255.0
interface Vlanif30
 ip address 192.168.30.1 255.255.255.0
interface Vlanif40
 ip address 11.0.0.2 255.255.255.0
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 10
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 20
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 30
interface GigabitEthernet0/0/4
 port link-type access
 port default vlan 20
interface GigabitEthernet0/0/5
 port link-type access
 port default vlan 40
interface GigabitEthernet0/0/6
 port link-type access
 port default vlan 10
ip route-static 0.0.0.0 0.0.0.0 11.0.0.1

3.2配置AR1路由器 AR1配置 3.2.1 配置接口

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 11.0.0.1 24
[R1-GigabitEthernet0/0/0]un sh
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 12.0.0.1 24
[R1-GigabitEthernet0/0/1]un sh

3.2.2配置DHCP中继服务(指定中继路由地址)

[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]nat static enable
[R1-GigabitEthernet0/0/1]q
[R1]nat address-group 1 212.0.0.100 212.0.0.200
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.20.0 0.0.0.255
[R1-acl-basic-2000]rule permit source 11.0.0.0 0.0.0.255
[R1-acl-basic-2000]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000 address-group 1 no-pat
[R1-GigabitEthernet0/0/1]q
[R1]acl 3000
[R1-acl-adv-3000]rule permit ip source 192.168.30.0 0.0.0.255
[R1-acl-adv-3000]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 3000
[R1-GigabitEthernet0/0/1]nat server protocol tcp global 9.9.9.9 www inside 192.168.10.100 www
[R1-GigabitEthernet0/0/1]nat static global 8.8.8.8 inside 192.168.10.10

3.2.3配置静态路由

[R1-GigabitEthernet0/0/1]q
[R1]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
[R1]ip route-static 192.168.10.0 24 11.0.0.2
[R1]ip route-static 192.168.20.0 24 11.0.0.2
[R1]ip route-static 192.168.30.0 24 11.0.0.2

3.3 配置R2路由器 3.3.1配置接口

interface GigabitEthernet0/0/0
 ip address 12.0.0.2 255.255.255.0
interface GigabitEthernet0/0/1
 ip address 13.0.0.1 255.255.255.0
interface LoopBack0
 ip address 114.114.114.114 255.255.255.255

3.3.2配置路由

ip route-static 8.8.8.8 255.255.255.255 12.0.0.1
ip route-static 9.9.9.9 255.255.255.255 12.0.0.1
ip route-static 212.0.0.0 255.255.255.0 12.0.0.1

3.4 其他配置 3.5 检查是否满足需求