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的地址
版权声明:本文标题:华为二层交换机与路由器对接上网 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1726225072h918926.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论