华为模拟器三层交换机VALN兼路由

实验需求:

1.创建VLAN并且能正确地划分Hybrid VLAN

2.Hybrid端口配置正确

3.Tag标签能正确标记,去除

4.利用三层交换机实现全网互通

5.设置DHCP,PC可以自动获取IP地址

以下是拓扑图及详细步骤:

174744729.png

一.创建VLAN并且划分hybrid VLAN正确

以下是详细步骤:

LSW2

<Huawei>sys

Enter system view, return user view with Ctrl+Z.

[Huawei]

[Huawei]vlan 10

[Huawei-vlan10]vlan 20

[Huawei-vlan20]

Oct 21 2013 16:07:38-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 5, the

change loop count is 0, and the maximum number of records is 4095.

[Huawei-vlan20]int e0/0/1

[Huawei-Ethernet0/0/1]port hybrid pvid vlan 10

Oct 21 2013 16:08:08-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 6, the

change loop count is 0, and the maximum number of records is 4095.

[Huawei-Ethernet0/0/1]port hybrid untagged vlan 10 20

[Huawei-Ethernet0/0/1]int e0/0/2

Oct 21 2013 16:08:28-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 7, the

change loop count is 0, and the maximum number of records is 4095. h

[Huawei-Ethernet0/0/2]port hybrid pvid vlan 20

[Huawei-Ethernet0/0/2]port hybrid untagged vlan 10 20

[Huawei-Ethernet0/0/2]

Oct 21 2013 16:08:48-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 9, the

change loop count is 0, and the maximum number of records is 4095.

LSW2:

<Huawei>sys

Enter system view, return user view with Ctrl+Z.

[Huawei]vlan 30

[Huawei-vlan30]int e

Oct 21 2013 16:18:58-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 4, the

change loop count is 0, and the maximum number of records is 4095.

[Huawei-vlan30]int e0/0/1

[Huawei-Ethernet0/0/1]port hybrid pvid vlan 30

[Huawei-Ethernet0/0/1]port hybrid untagged vlan 30

[Huawei-Ethernet0/0/1]

Oct 21 2013 16:19:28-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 6, the

change loop count is 0, and the maximum number of records is 4095.

二.创建Hybrid的端口

以下是详细步骤:

LSW2:

[Huawei]interface GigabitEthernet 0/0/1

[Huawei-GigabitEthernet0/0/1]

[Huawei-GigabitEthernet0/0/1]port hybrid tagged vlan 10 20

[Huawei-GigabitEthernet0/0/1]

Oct 21 2013 16:26:48-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 10, the

change loop count is 0, and the maximum number of records is 4095.

LSW3

[Huawei]interface GigabitEthernet 0/0/1

[Huawei-GigabitEthernet0/0/1]port hybrid tagged vlan 30

[Huawei-GigabitEthernet0/0/1]

Oct 21 2013 16:28:48-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 7, the

change loop count is 0, and the maximum number of records is 4095.

display vlan查看配置是否正确

如图所示:

174837953.png

174837489.png

三.在确保无误之后进行三层交换机创建VLAN,配置网关的工作

以下是详细步骤:

<Huawei>sys

Enter system view, return user view with Ctrl+Z.

[Huawei]vlan 10

Oct 21 2013 16:34:38-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 4, the

change loop count is 0, and the maximum number of records is 4095.

[Huawei-vlan10]vlan 20

[Huawei-vlan20]vlan 30

[Huawei-vlan30]

Oct 21 2013 16:34:48-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 6, the

change loop count is 0, and the maximum number of records is 4095.

[Huawei-vlan30]int vlan 10

[Huawei-Vlanif10]ip add 192.168.10.1 24

[Huawei-Vlanif10]int vlan 20

Oct 21 2013 16:35:08-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 7, the

change loop count is 0, and the maximum number of records is 4095.

[Huawei-Vlanif20]ip add 192.168.20.1 24

Oct 21 2013 16:35:28-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 8, the

change loop count is 0, and the maximum number of records is 4095.

[Huawei-vlan30]int vlan 30

[Huawei-Vlanif30]ip add 192.168.30.1 24

[Huawei-Vlanif30]

Oct 21 2013 16:35:48-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 9, the

change loop count is 0, and the maximum number of records is 4095.

四.进入VLAN创建DHCP,在此之前先开启DHCP功能

以下是详细步骤:

[Huawei]dhcp enable

Info: The operation may take a few seconds. Please wait for a moment.done.

[Huawei]interface vlan 10

[Huawei-Vlanif10]

Oct 21 2013 16:42:29-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 10, the

change loop count is 0, and the maximum number of records is 4095.

[Huawei-Vlanif10]dhcp select interface

[Huawei-Vlanif10]

Oct 21 2013 16:42:49-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 11, the

change loop count is 0, and the maximum number of records is 4095.

[Huawei-Vlanif10]int vlan 20

[Huawei-Vlanif20]dhcp select interface

[Huawei-Vlanif20]int vlan 30

Oct 21 2013 16:43:09-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 12, the

change loop count is 0, and the maximum number of records is 4095.

[Huawei-Vlanif30]dhcp select interface

[Huawei-Vlanif30]

Oct 21 2013 16:43:19-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 13, the

还要将三层交换机下的两个二层接口改为Hybrid端口,并标记TAG标签

[Huawei]interface GigabitEthernet 0/0/1

[Huawei-GigabitEthernet0/0/1]port hybrid tagged vlan 10 20

[Huawei-GigabitEthernet0/0/1]

Oct 21 2013 16:46:46-08:00 Huawei %%01IFNET/4/IF_STATE(l)[0]:Interface Vlanif10 h

as turned into UP state.

Oct 21 2013 16:46:46-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol

IP on the interface Vlanif10 has entered the UP state.

Oct 21 2013 16:46:46-08:00 Huawei %%01IFNET/4/IF_STATE(l)[2]:Interface Vlanif20 h

as turned into UP state.

Oct 21 2013 16:46:46-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[3]:The line protocol

IP on the interface Vlanif20 has entered the UP state.

Oct 21 2013 16:46:49-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 14, the

change loop count is 0, and the maximum number of records is 4095.nt

[Huawei-GigabitEthernet0/0/1]int g0/0/2

[Huawei-GigabitEthernet0/0/2]port hybrid tagged vlan 30

[Huawei-GigabitEthernet0/0/2]

Oct 21 2013 16:47:14-08:00 Huawei %%01IFNET/4/IF_STATE(l)[4]:Interface Vlanif30 h

as turned into UP state.

Oct 21 2013 16:47:14-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[5]:The line protocol

IP on the interface Vlanif30 has entered the UP state.

Oct 21 2013 16:47:19-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 15, the

change loop count is 0, and the maximum number of records is 4095.

验证一下如果PC能自动获得IP地址且三台PC能够互通则前期工作完成

如图所示:

174928355.png

174928616.png

174928231.png

Ping 192.168.20.254: 32 data bytes, Press Ctrl_C to break

From 192.168.20.254: bytes=32 seq=1 ttl=127 time=94 ms

From 192.168.20.254: bytes=32 seq=2 ttl=127 time=47 ms

From 192.168.20.254: bytes=32 seq=3 ttl=127 time=78 ms

From 192.168.20.254: bytes=32 seq=4 ttl=127 time=62 ms

From 192.168.20.254: bytes=32 seq=5 ttl=127 time=63 ms

--- 192.168.20.254 ping statistics ---

5 packet(s) transmitted

5 packet(s) received

0.00% packet loss

round-trip min/avg/max = 47/68/94 ms

PC>ping 192.168.30.254

Ping 192.168.30.254: 32 data bytes, Press Ctrl_C to break

From 192.168.30.254: bytes=32 seq=1 ttl=127 time=78 ms

From 192.168.30.254: bytes=32 seq=2 ttl=127 time=47 ms

From 192.168.30.254: bytes=32 seq=3 ttl=127 time=78 ms

From 192.168.30.254: bytes=32 seq=4 ttl=127 time=78 ms

From 192.168.30.254: bytes=32 seq=5 ttl=127 time=94 ms

--- 192.168.30.254 ping statistics ---

5 packet(s) transmitted

5 packet(s) received

0.00% packet loss

round-trip min/avg/max = 47/75/94 ms

五,在三层交换机上创建一个新的VLAN,用于访问路由器的端口

详细步骤如下:

[Huawei]

[Huawei]vlan 6

[Huawei-vlan6]

Oct 21 2013 16:58:39-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 16, the

change loop count is 0, and the maximum number of records is 4095.

[Huawei-vlan6]int vlan 6

[Huawei-Vlanif6]ip add 1.1.1.1 24

[Huawei-Vlanif6]

Oct 21 2013 17:01:19-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 17, the

change loop count is 0, and the maximum number of records is 4095.

[Huawei-Vlanif6]int g0/0/3

[Huawei-GigabitEthernet0/0/3]port hybrid untagged vlan all(这里要将TAG标签脱去,不然,路由器接收到的报文将无法识别)

[Huawei-GigabitEthernet0/0/3]

Oct 21 2013 17:02:58-08:00 Huawei %%01IFNET/4/IF_STATE(l)[6]:Interface Vlanif6 ha

s turned into UP state.

Oct 21 2013 17:02:58-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[7]:The line protocol

IP on the interface Vlanif6 has entered the UP state.

Oct 21 2013 17:02:59-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.

25.191.3.1 configurations have been changed. The current change number is 18, the

change loop count is 0, and the maximum number of records is 4095.

六.AR1路由器中将内网端口配置网关及子网掩码

详细步骤如下:

<Huawei>sys

Enter system view, return user view with Ctrl+Z.

[Huawei]

[Huawei]interface GigabitEthernet 0/0/0

[Huawei-GigabitEthernet0/0/0]ip add 1.1.1.2 24

O

[Huawei-cGigat 21 2013 14:23:20-05:13 HuaweibitEthernet0/ %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.

[Huawei-GigabitEthernet0/0/0]0/0]

接下来陆续将后面两台路由器的接口配置完毕,并实现三台路由器互通

以下是详细步骤:

AR1:

[Huawei]interface GigabitEthernet 0/0/1

[Huawei-GigabitEthernet0/0/1]ip add 202.106.1.1 24

Oct 21 2013 14:29:35-05:

[Huawei-GigabitEther13 Huawei %%01neIFNET/4/t0/0/1LINK_STATE(]l)[0]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state.

[Huawei-GigabitEthernet0/0/1]

AR2:

<Huawei>sys

Enter system view, return user view with Ctrl+Z.

[Huawei]interface GigabitEthernet 0/0/0

[Huawei-GigabitEthernet0/0/0]ip add 202.106.1.2 24

Oct 21 2013 1

[Huawei-Gi4:31:30-05:13 Huawei %%01IFNgabitEthernet0/0/0]ET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.

[Huawei-GigabitEthernet0/0/0]int g0/0/1

[Huawei-GigabitEthernet0/0/1]ip add 202.106.2.1 24

Oct 21 2013

[Huawei-Gigabi 1tEtherne4:31:51-05:13 Huawei %%01IFNt0/0/1]ET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state.

[Huawei-GigabitEthernet0/0/1]

AR3:

<Huawei>sys

Enter system view, return user view with Ctrl+Z.

[Huawei]interface GigabitEthernet 0/0/0

[Huawei-GigabitEthernet0/0/0]ip add 202.106.2.2 24

Oct 21 2013 14:34:47-05:13 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered t

[Huawei-Gigahe UP state. b

[Huawei-GigabitEthernet0/0/0]itEthernet0/0/0]

以上是配置IP地址,接下来是做静态路由

AR1

[Huawei]ip route-static 202.106.2.0 24 202.106.1.2

AR3

[Huawei]ip route-static 202.106.1.0 24 202.106.2.1

来验证一下三台路由器是否互通了

如图所示:

175003445.png

175004856.png

七.在三层交换机上做默认路由并在AR1上做到达内网的静态路由

以下是详细步骤:

LSW

[Huawei]ip route-static 0.0.0.0 0.0.0.0 1.1.1.2

AR1:

[Huawei]ip route-static 192.168.10.0 24 1.1.1.1

[Huawei]ip route-static 192.168.20.0 24 1.1.1.1

[Huawei]ip route-static 192.168.30.0 24 1.1.1.1

做到这一步要来个小检查,查看自己的PC能否Ping通三层交换机中所创建的VLAN的网关和AR1内网口的网关

如图所示:

175032384.png

175034868.png

八.最后一步,在AR1上做PAT即可实现全网互通

以下是详细步骤:

<Huawei>sys

Enter system view, return user view with Ctrl+Z.

[Huawei]

[Huawei]acl 2000

[Huawei-acl-basic-2000]rule 5 permit source any

[Huawei-acl-basic-2000]qu

[Huawei]interface GigabitEthernet 0/0/1

[Huawei-GigabitEthernet0/0/1]nat outbound 2000

[Huawei-GigabitEthernet0/0/1]

最后验证:

如图:

175109449.png

175111887.png

就此完成!