一.vlan的划分
实验目的:
①pc1 只可以和pc2通信,不可以和pc3 pc4通信
②pc1和pc2只能到Server1,pc3和pc4到Server2
1.拓扑图
2.配置
PC1-4 同理配置
SW1
<Huawei>
<Huawei>u t m //关闭注释
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname SW1 //改名
[SW1]vlan bat
[SW1]vlan batch 10 20 //一次性建立vlan 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]int e0/0/1
[SW1-Ethernet0/0/1]p
[SW1-Ethernet0/0/1]port l
[SW1-Ethernet0/0/1]port link-t
[SW1-Ethernet0/0/1]port link-type ac
[SW1-Ethernet0/0/1]port link-type access
[SW1-Ethernet0/0/1]p
[SW1-Ethernet0/0/1]port de
[SW1-Ethernet0/0/1]port default v
[SW1-Ethernet0/0/1]port default vlan 10 //选择端口类型,将端口加入到vlan中
[SW1-Ethernet0/0/1]int e0/0/2
[SW1-Ethernet0/0/2]p
[SW1-Ethernet0/0/2]port l
[SW1-Ethernet0/0/2]port link-t
[SW1-Ethernet0/0/2]port link-type ac
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]p
[SW1-Ethernet0/0/2]port de
[SW1-Ethernet0/0/2]port default v
[SW1-Ethernet0/0/2]port default vlan 10
[SW1-Ethernet0/0/2]int e0/0/3
[SW1-Ethernet0/0/3]p
[SW1-Ethernet0/0/3]port l
[SW1-Ethernet0/0/3]port link-t
[SW1-Ethernet0/0/3]port link-type ac
[SW1-Ethernet0/0/3]port link-type access
[SW1-Ethernet0/0/3]p
[SW1-Ethernet0/0/3]port de
[SW1-Ethernet0/0/3]port default vl
[SW1-Ethernet0/0/3]port default vlan 20
[SW1-Ethernet0/0/3]int e0/0/4
[SW1-Ethernet0/0/4]p
[SW1-Ethernet0/0/4]port l
[SW1-Ethernet0/0/4]port link-t
[SW1-Ethernet0/0/4]port link-type ac
[SW1-Ethernet0/0/4]port link-type access
[SW1-Ethernet0/0/4]p
[SW1-Ethernet0/0/4]port de
[SW1-Ethernet0/0/4]port default vl
[SW1-Ethernet0/0/4]port default vlan 20
[SW1]int e0/0/5
[SW1-Ethernet0/0/5]p
[SW1-Ethernet0/0/5]port l
[SW1-Ethernet0/0/5]port link-t
[SW1-Ethernet0/0/5]port link-type t
[SW1-Ethernet0/0/5]port link-type trunk
[SW1-Ethernet0/0/5]p
[SW1-Ethernet0/0/5]port t
[SW1-Ethernet0/0/5]port trunk al
[SW1-Ethernet0/0/5]port trunk allow-pass v
[SW1-Ethernet0/0/5]port trunk allow-pass vlan a
[SW1-Ethernet0/0/5]port trunk allow-pass vlan all
[SW1-Ethernet0/0/5]
SW2
<Huawei>
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname SW2
[SW2]vlan bat
[SW2]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2]int e0/0/1
[SW2-Ethernet0/0/1]p
[SW2-Ethernet0/0/1]port l
[SW2-Ethernet0/0/1]port link-t
[SW2-Ethernet0/0/1]port link-type t
[SW2-Ethernet0/0/1]port link-type trunk
[SW2-Ethernet0/0/1]p
[SW2-Ethernet0/0/1]port t
[SW2-Ethernet0/0/1]port trunk a
[SW2-Ethernet0/0/1]port trunk allow-pass v
[SW2-Ethernet0/0/1]port trunk allow-pass vlan a
[SW2-Ethernet0/0/1]port trunk allow-pass vlan all
[SW2-Ethernet0/0/1]int e0/0/2
[SW2-Ethernet0/0/2]p
[SW2-Ethernet0/0/2]port l
[SW2-Ethernet0/0/2]port link-t
[SW2-Ethernet0/0/2]port link-type a
[SW2-Ethernet0/0/2]port link-type access
[SW2-Ethernet0/0/2]p
[SW2-Ethernet0/0/2]port de
[SW2-Ethernet0/0/2]port default v
[SW2-Ethernet0/0/2]port default vlan 10
[SW2-Ethernet0/0/2]int e0/0/3
[SW2-Ethernet0/0/3]p
[SW2-Ethernet0/0/3]port l
[SW2-Ethernet0/0/3]port link-t
[SW2-Ethernet0/0/3]port link-type a
[SW2-Ethernet0/0/3]port link-type access
[SW2-Ethernet0/0/3]p
[SW2-Ethernet0/0/3]port de
[SW2-Ethernet0/0/3]port default v
[SW2-Ethernet0/0/3]port default vlan 20
[SW2-Ethernet0/0/3]
Server1配置IP地址,配置好一定点保存 Server2同理
3.测试
Server1--->PC1 成功
Server2-----PC3 成功
Server1---->PC3 失败
二.单臂路由
实验目的:实现不同网段间的通信
1.拓扑图
2.配置
PC1配置IP地址,子网掩码,网关 PC2同理
SW1
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname SW1
[SW1]vla
[SW1]vlan ba
[SW1]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]p
[SW1-GigabitEthernet0/0/1]port l
[SW1-GigabitEthernet0/0/1]port link-t
[SW1-GigabitEthernet0/0/1]port link-type a
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]p
[SW1-GigabitEthernet0/0/1]port d
[SW1-GigabitEthernet0/0/1]port default v
[SW1-GigabitEthernet0/0/1]port default vlan 10
[SW1-GigabitEthernet0/0/1]int g0/0/2
[SW1-GigabitEthernet0/0/2]p
[SW1-GigabitEthernet0/0/2]port l
[SW1-GigabitEthernet0/0/2]port link-t
[SW1-GigabitEthernet0/0/2]port link-type a
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]p
[SW1-GigabitEthernet0/0/2]port de
[SW1-GigabitEthernet0/0/2]port default v
[SW1-GigabitEthernet0/0/2]port default vlan 20
[SW1-GigabitEthernet0/0/2]int g0/0/3
[SW1-GigabitEthernet0/0/3]p
[SW1-GigabitEthernet0/0/3]port l
[SW1-GigabitEthernet0/0/3]port link-t
[SW1-GigabitEthernet0/0/3]port link-type t
[SW1-GigabitEthernet0/0/3]port link-type trunk
[SW1-GigabitEthernet0/0/3]p
[SW1-GigabitEthernet0/0/3]port t
[SW1-GigabitEthernet0/0/3]port trunk a
[SW1-GigabitEthernet0/0/3]port trunk allow-pass v
[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan a
[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/3]
R1
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]int g0/0/0.10
[R1-GigabitEthernet0/0/0.10]ip add 192.168.1.254 24
[R1-GigabitEthernet0/0/0.10]do
[R1-GigabitEthernet0/0/0.10]dot1q ter
[R1-GigabitEthernet0/0/0.10]dot1q termination vi
[R1-GigabitEthernet0/0/0.10]dot1q termination vid 10 //在子接口上,做vlan10
[R1-GigabitEthernet0/0/0.10]ar
[R1-GigabitEthernet0/0/0.10]arp br
[R1-GigabitEthernet0/0/0.10]arp broadcast en
[R1-GigabitEthernet0/0/0.10]arp broadcast enable //开启arp广播
[R1-GigabitEthernet0/0/0.10]int g0/0/0.20
[R1-GigabitEthernet0/0/0.20]ip add 192.168.2.254 24
[R1-GigabitEthernet0/0/0.20]do
[R1-GigabitEthernet0/0/0.20]dot1q ter
[R1-GigabitEthernet0/0/0.20]dot1q termination vi
[R1-GigabitEthernet0/0/0.20]dot1q termination vid 20 //在子接口上,做vlan20
[R1-GigabitEthernet0/0/0.20]ar
[R1-GigabitEthernet0/0/0.20]arp br
[R1-GigabitEthernet0/0/0.20]arp broadcast en
[R1-GigabitEthernet0/0/0.20]arp broadcast enable
[R1-GigabitEthernet0/0/0.20]
3.测试
PC1----->PC2 成功
三:组合
1.拓扑图
2.配置
SW3
<Huawei>
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname SW3
[SW3]vlan ba
[SW3]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW3]int g0/0/1
[SW3-GigabitEthernet0/0/1]p
[SW3-GigabitEthernet0/0/1]port l
[SW3-GigabitEthernet0/0/1]port link-t
[SW3-GigabitEthernet0/0/1]port link-type a
[SW3-GigabitEthernet0/0/1]port link-type access
[SW3-GigabitEthernet0/0/1]p
[SW3-GigabitEthernet0/0/1]port de
[SW3-GigabitEthernet0/0/1]port default vlan 10
[SW3-GigabitEthernet0/0/1]int g0/0/2
[SW3-GigabitEthernet0/0/2]p
[SW3-GigabitEthernet0/0/2]port l
[SW3-GigabitEthernet0/0/2]port link-t
[SW3-GigabitEthernet0/0/2]port link-type a
[SW3-GigabitEthernet0/0/2]port link-type access
[SW3-GigabitEthernet0/0/2]p
[SW3-GigabitEthernet0/0/2]port de
[SW3-GigabitEthernet0/0/2]port default v
[SW3-GigabitEthernet0/0/2]port default vlan 10
[SW3-GigabitEthernet0/0/2]
[SW3-GigabitEthernet0/0/2]int g0/0/3
[SW3-GigabitEthernet0/0/3]p
[SW3-GigabitEthernet0/0/3]port l
[SW3-GigabitEthernet0/0/3]port link-t
[SW3-GigabitEthernet0/0/3]port link-type a
[SW3-GigabitEthernet0/0/3]port link-type access
[SW3-GigabitEthernet0/0/3]p
[SW3-GigabitEthernet0/0/3]port de
[SW3-GigabitEthernet0/0/3]port default v
[SW3-GigabitEthernet0/0/3]port default vlan 20
[SW3-GigabitEthernet0/0/3]int g0/0/4
[SW3-GigabitEthernet0/0/4]p
[SW3-GigabitEthernet0/0/4]port l
[SW3-GigabitEthernet0/0/4]port link-t
[SW3-GigabitEthernet0/0/4]port link-type a
[SW3-GigabitEthernet0/0/4]port link-type access
[SW3-GigabitEthernet0/0/4]p
[SW3-GigabitEthernet0/0/4]port de
[SW3-GigabitEthernet0/0/4]port default vlan 20
[SW3-GigabitEthernet0/0/4]int g0/0/5
[SW3-GigabitEthernet0/0/5]p
[SW3-GigabitEthernet0/0/5]port l
[SW3-GigabitEthernet0/0/5]port li
[SW3-GigabitEthernet0/0/5]port link-t
[SW3-GigabitEthernet0/0/5]port link-type t
[SW3-GigabitEthernet0/0/5]port link-type trunk
[SW3-GigabitEthernet0/0/5]p
[SW3-GigabitEthernet0/0/5]port t
[SW3-GigabitEthernet0/0/5]port trunk a
[SW3-GigabitEthernet0/0/5]port trunk allow-pass v
[SW3-GigabitEthernet0/0/5]port trunk allow-pass vlan a
[SW3-GigabitEthernet0/0/5]port trunk allow-pass vlan all
[SW3-GigabitEthernet0/0/5]q
[SW3]
SW4
<Huawei>
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname R4
[R4]v
[R4]vlan bat
[R4]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]p
[R4-GigabitEthernet0/0/1]port l
[R4-GigabitEthernet0/0/1]port link-t
[R4-GigabitEthernet0/0/1]port link-type t
[R4-GigabitEthernet0/0/1]port link-type trunk
[R4-GigabitEthernet0/0/1]p
[R4-GigabitEthernet0/0/1]port t
[R4-GigabitEthernet0/0/1]port trunk a
[R4-GigabitEthernet0/0/1]port trunk allow-pass v
[R4-GigabitEthernet0/0/1]port trunk allow-pass vlan a
[R4-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[R4-GigabitEthernet0/0/1]int g0/0/2
[R4-GigabitEthernet0/0/2]p
[R4-GigabitEthernet0/0/2]port l
[R4-GigabitEthernet0/0/2]port link-t
[R4-GigabitEthernet0/0/2]port link-type a
[R4-GigabitEthernet0/0/2]port link-type access
[R4-GigabitEthernet0/0/2]p
[R4-GigabitEthernet0/0/2]port de
[R4-GigabitEthernet0/0/2]port default v
[R4-GigabitEthernet0/0/2]port default vlan 10
[R4-GigabitEthernet0/0/2]int g0/0/3
[R4-GigabitEthernet0/0/3]port link-type access
[R4-GigabitEthernet0/0/3]port default vlan 20
[R4-GigabitEthernet0/0/3]int g0/0/4
[R4-GigabitEthernet0/0/4]p
[R4-GigabitEthernet0/0/4]port l
[R4-GigabitEthernet0/0/4]port link--
[R4-GigabitEthernet0/0/4]port link-t
[R4-GigabitEthernet0/0/4]port link-type t
[R4-GigabitEthernet0/0/4]port link-type trunk
[R4-GigabitEthernet0/0/4]p
[R4-GigabitEthernet0/0/4]port t
[R4-GigabitEthernet0/0/4]port trunk a
[R4-GigabitEthernet0/0/4]port trunk allow-pass v
[R4-GigabitEthernet0/0/4]port trunk allow-pass vlan a
[R4-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[R4-GigabitEthernet0/0/4]
[R4-GigabitEthernet0/0/4]
[R4-GigabitEthernet0/0/4]q
[R4]
R1
<Huawei>
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname R1
[R1]int g0/0/0.10
[R1-GigabitEthernet0/0/0.10]ip add 192.168.1.254 24
[R1-GigabitEthernet0/0/0.10]d
[R1-GigabitEthernet0/0/0.10]do
[R1-GigabitEthernet0/0/0.10]dot1q ter
[R1-GigabitEthernet0/0/0.10]dot1q termination vi
[R1-GigabitEthernet0/0/0.10]dot1q termination vid 10
[R1-GigabitEthernet0/0/0.10]ar
[R1-GigabitEthernet0/0/0.10]arp br
[R1-GigabitEthernet0/0/0.10]arp broadcast en
[R1-GigabitEthernet0/0/0.10]arp broadcast enable
[R1-GigabitEthernet0/0/0.10]int g0/0/0.20
[R1-GigabitEthernet0/0/0.20]ip add 192.168.2.254 24
[R1-GigabitEthernet0/0/0.20]do
[R1-GigabitEthernet0/0/0.20]dot1q ter
[R1-GigabitEthernet0/0/0.20]dot1q termination vid 20
[R1-GigabitEthernet0/0/0.20]arp bro
[R1-GigabitEthernet0/0/0.20]arp broadcast en
[R1-GigabitEthernet0/0/0.20]arp broadcast enable
[R1-GigabitEthernet0/0/0.20]
3.测试
Server1---->PC3
PC1---->PC4