1.应用场景如下图所示，交换机（SW1）与路由器(Router)对接，使用户PC1和PC2 可以实现上网功能。交换机是S5700三层交换机,可以完成跨网段的通信。2.配置思路交换机作为用户的网关，实现跨网段转发。同时作为DHCP服务器，为用户分配IP地址。路由器通过NAT转换，使用户可以访问外网，（使用的路由器为 AR3260)交换机的配置步骤（分为4步）第1步：配置连接用户的接口和对应的VLANIF接口。<Huawei>sys [Huawei]undo info en [Huawei]sysname sw1 [sw1]vlan b 2 3 100 [sw1]int g0/0/2 [sw1-GigabitEthernet0/0/2]port link-type access [sw1-GigabitEthernet0/0/2]port default vlan 2 [sw1-GigabitEthernet0/0/2]q [sw1]int vlan 2 [sw1-Vlanif2]ip address 192.168.1.1 24 [sw1-Vlanif2]q [sw1]int g0/0/3 [sw1-GigabitEthernet0/0/3]port link-type access [sw1-GigabitEthernet0/0/3]port default vlan 3 [sw1-GigabitEthernet0/0/3]q [sw1]int vlan 3 [sw1-Vlanif3]ip address 192.168.2.1 24 [sw1-Vlanif3]q第2步：配置连接路由器的接口和对应的VLANIF接口[sw1]int g0/0/1 [sw1-GigabitEthernet0/0/1]port link-type access [sw1-GigabitEthernet0/0/1]port default vlan 100 [sw1-GigabitEthernet0/0/1]q [sw1]int vlan 100 [sw1-Vlanif100]ip address 192.168.100.2 24 [sw1-Vlanif100]q第3步：配置缺省路由。[sw1]ip route-static 0.0.0.0 0.0.0.0 192.168.100.1第4步：配置DHCP服务器。[sw1]dhcp enable [sw1]int vlan2 [sw1-Vlanif2]dhcp select interface [sw1-Vlanif2]dhcp server dns-list 114.114.114.114 223.5.5.5 [sw1-Vlanif2]int vlan 3 [sw1-Vlanif3]dhcp select interface [sw1-Vlanif3]dhcp server dns-list 114.114.114.114 223.5.5.5路由器的配置步骤（分为4步）第1步：配置连接交换机的接口对应的IP地址。<Huawei>sys [Huawei]undo info en [Huawei]sysname Router [Router]int g0/0/1 [Router-GigabitEthernet0/0/1]ip address 192.168.100.1 24 [Router-GigabitEthernet0/0/1]q第2步：配置连接公网的接口对应的IP地址。[Router]int g0/0/2 [Router-GigabitEthernet0/0/2]ip address 200.0.0.2 24 [Router-GigabitEthernet0/0/2]q第3步：配置缺省路由和回程路由[Router]ip route-static 0.0.0.0 0.0.0.0 200.0.0.1 [Router]ip route-static 192.168.0.0 255.255.0.0 192.168.100.2第4步：配置缺NAT功能[Router]acl number 2001 [Router-acl-basic-2001]rule 5 permit source 192.168.0.0 0.0.255.255 [Router-acl-basic-2001]q [Router-GigabitEthernet0/0/2]nat outbound 2001 [Router-GigabitEthernet0/0/2]q自动获取到的地址PC1、PC2 成功Ping通外网原文链接：https://www.toutiao.com/i6930771861949268491/