公司网段192.168.22.0/24,
生产部VLAN10有主机50台,销售部VLAN20有90台,
财务部VLAN30有15台,客服部VLAN40有26台,
要求划分子网实现网络互通。
192.168.22.0/24
先关注主机数量最多的子网
VLAN20 90台可用主机
2的n次方 大于等于90+2
n=7
新网段的网络位是25个,主机位是7个
子网掩码为:255.255.255.1000000/255.255.255.128
子网数量2个 255.255.255.0000000/255.255.255.10000000
子网1:192.168.22.0/25,给VLAN20使用
可用网络地址:1-126
子网2:192.168.22.128/25给VLAN10使用
可用网络地址:129-192
主机数量为50,VLAN10
2的n次方 大于等于 50+2 ;
n >=6,所以最终 N 为 6 ;
新网段的网络位的个数为 : 26个;
子网掩码为:255.255.255.192
子网的数量为2个,分别是:
子网 192.168.22.128/26 给VLAN30
可用网络地址 192-222
子网 192.168.22.192/26 给VLAN40
可用网络地址 192-254
sw2配置
创建VLAN10 20
Huawei>
<Huawei>sys
[Huawei]vlan batch 10 20 创建VLAN10 20
[Huawei]inter gi 0/0/1
[Huawei-GigabitEthernet0/0/1]undo shutdown 开启端口
[Huawei-GigabitEthernet0/0/1]port link-type access
[Huawei-GigabitEthernet0/0/1]port default vlan 10 加入VLAN10
[Huawei-GigabitEthernet0/0/1]q
[Huawei]inter gi0/0/2
[Huawei-GigabitEthernet0/0/2]undo shutdown
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 20
[Huawei-GigabitEthernet0/0/2]q
[Huawei]inter gi0/0/3 此端口配置trunk 允许所有VLAN通过
[Huawei-GigabitEthernet0/0/3]undo shutdown
Info: Interface GigabitEthernet0/0/3 is not shutdown.
[Huawei-GigabitEthernet0/0/3]port link-type trunk
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan all
sw3配置
<Huawei>
<Huawei>sys
[Huawei]vlan batch 30 40 创建VLAN30 40
[Huawei]inter gi0/0/1
[Huawei-GigabitEthernet0/0/1]undo shutdown
[Huawei-GigabitEthernet0/0/1]port link-type access
[Huawei-GigabitEthernet0/0/1]port default vlan 30
[Huawei-GigabitEthernet0/0/1]q
[Huawei]inter gi 0/0/2
[Huawei-GigabitEthernet0/0/2]
[Huawei-GigabitEthernet0/0/2]undo shutdown
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 40
[Huawei-GigabitEthernet0/0/2]q
[Huawei]inter gi0/0/3
[Huawei-GigabitEthernet0/0/3]undo shutdown
[Huawei-GigabitEthernet0/0/3]port link-type trunk
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan all
sw1配置
<Huawei>sys
[Huawei]vlan batch 10 20 30 40 创建VLAN10 20 30 40
[Huawei]inter vlan 10
[Huawei-Vlanif10]ip address 192.168.22.190 255.255.255.192 给每个VLAN配置IP
[Huawei-Vlanif10]inter vlan 20
[Huawei-Vlanif20]ip address 192.168.22.126 255.255.255.128
[Huawei-Vlanif20]inter vlan 30
.
[Huawei-Vlanif30]ip address 192.168.22.222 255.255.255.224
[Huawei]inter vlan 40
[Huawei-Vlanif40]ip address 192.168.22.253 255.255.255.224
[Huawei-Vlanif40]undo shutdown
[Huawei-Vlanif40]q
[Huawei]inter gi 0/0/1
[Huawei-GigabitEthernet0/0/1]undo shutdown 连接交换机的端口加入trunk
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/1]q
[Huawei]inter GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]undo shutdown
[Huawei-GigabitEthernet0/0/2]port link-type trunk
[Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/2]q
配置DHCP 创建地址池
[Huawei]ip pool 01 地址池名称01
[Huawei-ip-pool-01]gateway 192.168.22.190 配置网关
[Huawei-ip-pool-01]network 192.168.22.128 mask 255.255.255.192 配置网段和子网掩码
[Huawei-ip-pool-01]dns-list 1.1.1.1 配置DNS
[Huawei-ip-pool-01]lease day 1 租用期 1天
[Huawei-ip-pool-01]q
[Huawei]ip pool 02 创建地址池 02
[Huawei-ip-pool-02]gateway-list 192.168.22.126
[Huawei-ip-pool-02]network 192.168.22.0 mask 255.255.255.128
[
[Huawei-ip-pool-02]dns-list 2.2.2.2
[Huawei-ip-pool-02]lease day 2
[Huawei-ip-pool-02]q
创建地址池03
[Huawei]ip pool 03
[Huawei-ip-pool-03]gateway-list 192.168.22.222
[Huawei-ip-pool-03]network 192.168.22.192 mask 255.255.255.224
[Huawei-ip-pool-03]dns-list 3.3.3.3
[Huawei-ip-pool-03]lease day 3
[Huawei-ip-pool-03]q
创建地址池04
[Huawei]ip pool 04
[Huawei-ip-pool-04]gateway-list 192.168.22.253
[Huawei-ip-pool-04]network 192.168.22.224 mask 255.255.255.224
[Huawei-ip-pool-04]dns-list 4.4.4.4
[Huawei-ip-pool-04]lease day 3
[Huawei-ip-pool-04] q
[Huawei]dhcp enable 开启DHCP
[Huawei]inter vlan 10
[Huawei-Vlanif10]dhcp select global 每个VLAN激活DHCP
[Huawei-Vlanif10]inter vlan 10
[Huawei-Vlanif10]dhcp select global
[Huawei-Vlanif10]inter vlan 20
[Huawei-Vlanif20]dhcp select global
[Huawei-Vlanif20]inter vlan 30
[Huawei-Vlanif30]dhcp select global
[Huawei-Vlanif30]inter vlan 40
[Huawei-Vlanif40]dhcp select global
[Huawei-Vlanif40]q
验证是否获取IP,是否全网通
转载于:https://blog.51cto.com/13555885/2059460