模拟单网段但需要将服务器中的两张网卡划分为不同网段
准备:一台服务器(至少存在两张网卡),交换机
模拟软件:ensp
划分vlan端口
1.创建vlan 10 vlan 20
[Huawei]vlan 10
[Huawei-vlan10]vlan 20
2.划分vlan
vlan 10
[Huawei]port-group 1
[Huawei-port-group-1]group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/8
[Huawei-port-group-1]port link-type access
[Huawei-port-group-1]q
[Huawei]vlan 10
[Huawei-vlan10]port GigabitEthernet 0/0/1 to 0/0/8
[Huawei]interface Vlanif 10
[Huawei-Vlanif10]ip address 192.168.100.1 24
vlan 20
[Huawei]port-group 2
[Huawei-port-group-2]group-member GigabitEthernet 0/0/9 to GigabitEthernet 0/0/16
[Huawei-port-group-2]port link-type access
[Huawei-port-group-2]q
[Huawei]vlan 20
[Huawei-vlan20]port GigabitEthernet 0/0/9 to 0/0/16
[Huawei]interface Vlanif 20
[Huawei-Vlanif20]ip address 192.168.200.1 24
查询vlan
vlan 10
可以看到划分出了g0/0/1到g0/0/8
这意味着在实体交换机上将网线插入0-8的任意一个端口中它的网段都是192.168.100.0/24
[Huawei]display vlan 10
--------------------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged;
MP: Vlan-mapping; ST: Vlan-stacking;
#: ProtocolTransparent-vlan; *: Management-vlan;
--------------------------------------------------------------------------------
VID Type Ports
--------------------------------------------------------------------------------
10 common UT:GE0/0/1(U) GE0/0/2(D) GE0/0/3(D) GE0/0/4(D)
GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) GE0/0/8(D)
VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------------------
10 enable default enable disable VLAN 0010
vlan 20
可以看到划分出了g0/0/9到g0/0/16
这意味着在实体交换机上将网线插入9-16的任意一个端口中它的网段都是192.168.200.0/24
[Huawei]display vlan 20
--------------------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged;
MP: Vlan-mapping; ST: Vlan-stacking;
#: ProtocolTransparent-vlan; *: Management-vlan;
--------------------------------------------------------------------------------
VID Type Ports
--------------------------------------------------------------------------------
20 common UT:GE0/0/9(U) GE0/0/10(D) GE0/0/11(D) GE0/0/12(D)
GE0/0/13(D) GE0/0/14(D) GE0/0/15(D) GE0/0/16(D)
VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------------------
20 enable default enable disable VLAN 0020
查询ip
[Huawei]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
MEth0/0/1 unassigned down down
NULL0 unassigned up up(s)
Vlanif1 unassigned up down
Vlanif10 192.168.100.1/24 up up
Vlanif20 192.168.200.1/24 up up
测试
1.配置pc1、pc2的Ip
2.测试连通性
使用pc1 ping pc2
使用pc2 ping pc1
注意
配置好交换机后需要保存配置
<Huawei>save
以上操作没有提到vlan1,vlan1是默认存在的,将真实的网段划分到vlan1中
(操作和以上类划分vlan端口类似)
将网关更改为真实网关,将剩余的端口划分给vlan1改即可。