本帖最后由 cahzsl 于 2019-7-11 17:52 编辑
最近在折腾华为交换机的配置,今天做了一个组网实验,之前查了网上资料,都不是太详细,今天根据自己实验做了如下资料,欢迎各位大神批评指正,谢谢!正文如下: 一、组网需求 华为交换机划分多个VLAN,交换机一个网口连接路由器LAN口,实现多个VLAN内的用户可以上网且自动获取IP地址。同时不同VLAN内的用户都能访问服务器。
二、设备介绍 1、华为S5720-28P-LI-AC 2、刷了高恪固件的K2路由器
三、配置及组网图
四、配置步骤 1、交换机配置 #创建VLAN <HUAWEI>system-view [HUAWEI]sysname Switch [Switch]vlan batch 20 30 #配置接口加入VLAN [Switch]port-group 20 [Switch-port-group-20]group-memberGigabitEthernet 0/0/5 to GigabitEthernet 0/0/14 [Switch-port-group-20]portlink-type access [Switch-port-group-20]portdefault vlan 20 [Switch-port-group-20]quit [Switch]undoport-group 20 [Switch]port-group 30 [Switch-port-group-30]group-memberGigabitEthernet 0/0/15 to GigabitEthernet 0/0/24 [Switch-port-group-30]portlink-type access [Switch-port-group-30]portdefault vlan 30 [Switch-port-group-30]quit [Switch]undoport-group 30 #配置VLANIF接口的IP地址 [Switch]interfaceVlanif 1 [Switch-Vlanif1]ipaddress 192.168.100.253 24 [Switch-Vlanif1]quit [Switch]interfaceVlanif 20 [Switch-Vlanif20]ipaddress 192.168.20.1 24 [Switch-Vlanif20]dhcpselect global [Switch-Vlanif20]quit [Switch]interfaceVlanif 30 [Switch-Vlanif30]ipaddress 192.168.30.1 24 [Switch-Vlanif30]dhcpselect global [Switch-Vlanif30]quit #配置启用DHCP服务 [Switch]DHCPenable #配置DHCP地址池 [Switch]ippool 20 [Switch-ip-pool-20]gateway-list192.168.20.1 [Switch-ip-pool-20]network192.168.20.0 mask 255.255.255.0 [Switch-ip-pool-20]dns-list192.168.100.1 [Switch-ip-pool-20]leaseday 2 hour 0 minute 0 [Switch-ip-pool-20]quit [Switch]ippool 30 [Switch-ip-pool-30]gateway-list192.168.30.1 [Switch-ip-pool-30]network192.168.30.0 mask 255.255.255.0 [Switch-ip-pool-30]dns-list192.168.100.1 [Switch-ip-pool-30]leaseday 2 hour 0 minute 0 [Switch-ip-pool-30]quit #配置交换机和路由器间的静态路由 [Switch]iproute-static 0.0.0.0 0.0.0.0 192.168.100.1 #所有配置完成后保存配置 <Switch>save
2、路由器配置 进入路由器管理界面,添加两条静态路由
五、验证效果
1、PC 1自动获取IP地址
2、PC 1 ping百度
3、PC 1 ping服务器
4、PC 2 自动获取IP地址
5、PC 2 ping 百度
6、PC 2 ping 服务器
7、PC 1和PC 2互ping,VLAN隔离,不能互相访问
8、PC 2 访问交换机WEB网管
六、总结 通过本次实验,VLAN 20和VLAN 30的用户相互隔离,VLAN 20和VLAN 30内的用户都能自动获取IP地址访问互联网,同时也能访问服务器。由于是本人第一次配置,还请各位大神帮忙批评指正。
|