admin 管理员组

文章数量: 887021

(一)配置LSW1
[LSW1]vlan batch 10 20
[LSW1-Ethernet0/0/1]port link-type access
[LSW1-Ethernet0/0/1]port default vlan 10
[LSW1-Ethernet0/0/2]port link-type access
[LSW1-Ethernet0/0/2]port default vlan 20
[LSW1-GigabitEthernet0/0/1]port link-type trunk
[LSW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
(二)配置AR1:路由器的配置有两种方式,配置子接口进行通信或者配置VLANIF接口进行通信,两种方式选择其一即可
1.配置路由器通过子接口终结VLAN,实现跨网段的三层转发
(1)配置终结子接口
[AR1]vlan batch 10 20
[AR1]interface g0/0/1.1
[AR1-GigabitEthernet0/0/1.1]dot1q termination vid 10
[AR1-GigabitEthernet0/0/1.1]ip add 10.1.10.1 24
[AR1-GigabitEthernet0/0/1.1]arp broadcast enable
[AR1]interface g0/0/1.2
[AR1-GigabitEthernet0/0/1.2]dot1q termination vid 20
[AR1-GigabitEthernet0/0/1.2]ip add 10.1.20.1 24
[AR1-GigabitEthernet0/0/1.2]arp broadcast enable
(2)配置DHCP功能,为内网用户分配IP地址和指定DNS服务器地址
[AR1]dhcp enable
[AR1]interface g0/0/1.1
[AR1-GigabitEthernet0/0/1.1]dhcp select interface
[AR1-GigabitEthernet0/0/1.1]dhcp server dns-list 8.8.8.8
[AR1]interface g0/0/1.2
[AR1-GigabitEthernet0/0/1.2]dhcp select interface
[AR1-GigabitEthernet0/0/1.2]dhcp server dns-list 8.8.8.8
2.配置路由器通过配置VLANIF接口,实现跨网段的三层转发(删除子接口的相关配置后)
(1)配置VLANIF接口
[AR1] vlan batch10 20
[AR1-GigabitEthernet0/0/1] portswitch
[AR1-GigabitEthernet0/0/1] port link-type trunk
[AR1-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 20
[AR1-Vlanif10]ip add 10.1.10.1 24
[AR1-Vlanif20]ip add 10.1.20.1 24
(2)配置DHCP功能,为内网用户分配IP地址并指定DNS服务器地址
[AR1]dhcp enable
[AR1]interface Vlanif 10
[AR1-Vlanif10]dhcp select interface
[AR1-Vlanif10]dhcp server dns-list 8.8.8.8
[AR1]interface Vlanif 20
[AR1-Vlanif20]dhcp server dns-list 8.8.8.8
3.配置公网接口的IP地址和静态路由
[AR1-GigabitEthernet0/0/0]ip add 20.1.1.1 24
[AR1]ip route-static 0.0.0.0 0.0.0.0 20.1.1.2
4.配置NAT功能,使内网用户可以访问外网
[AR1]acl 2000
[AR1-acl-basic-2000]rule permit source 10.1.0.0 0.0.255.255
[AR1-GigabitEthernet0/0/0]nat outbound 2000
(三)配置AR2
[AR2]int g0/0/0
[AR2-GigabitEthernet0/0/0]ip add 20.1.1.2 24
(四)检查配置结果
1.配置PC地址

2.PC ping AR2的地址


本文标签: 华为 路由器 二层 交换机