Top

NTD TCNA DAY03

  1. 案例1:华为单臂路由配置
  2. 案例2:三层交换实现VLAN间通信
  3. 案例3:多交换机VLAN间通信
  4. 案例4:三层交换配置路由

1 案例1:华为单臂路由配置

1.1 问题

如何使用路由的一个接口实现vlan间的通信?

1.2 方案

使用eNSP搭建实验环境, 如图-1所示。
TCNA DAY03 - 图1
图-1

1.3 步骤

实现此案例需要按照如下步骤进行。
步骤一:配置交换机
[Huawei]vlan batch 10 20

[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]port link-t access
[Huawei-Ethernet0/0/1]port default vlan 10

[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port link-t access
[Huawei-Ethernet0/0/2]port default vlan 20

[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-t trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20

步骤二:配置路由器
[Huawei]int g0/0/1.1
[Huawei-GigabitEthernet0/0/1.1]dot1q termination vid 10 //关联vlan信息
[Huawei-GigabitEthernet0/0/1.1]ip add 10.10.0.1 24
[Huawei-GigabitEthernet0/0/1.1]arp broadcast enable //开启arp广播

[Huawei-GigabitEthernet0/0/1.1]int g0/0/1.2
[Huawei-GigabitEthernet0/0/1.2]dot1q termination vid 20
[Huawei-GigabitEthernet0/0/1.2]ip add 10.20.0.1 24
[Huawei-GigabitEthernet0/0/1.2]arp broadcast enable

步骤三:测试
使用ping命令测试,如图-2所示。
TCNA DAY03 - 图2
图-2

2 案例2:三层交换实现VLAN间通信

2.1 问题

如何使用三层交换机实现不同VLAN间的通信?

2.2 方案

使用eNSP搭建实验环境,如图-3所示。
TCNA DAY03 - 图3
图-3

2.3 步骤

实现此案例需要按照如下步骤进行。
1)配置VLAN
system-view
[Huawei]vlan 2
[Huawei]vlan 3

[Huawei]interface Ethernet0/0/1
[Huawei-Ethernet0/0/1]port link-type access
[Huawei-Ethernet0/0/1]port default vlan 1

[Huawei]interface Ethernet0/0/2
[Huawei-Ethernet0/0/2]port link-type access
[Huawei-Ethernet0/0/2]port default vlan 2

[Huawei]interface Ethernet0/0/3
[Huawei-Ethernet0/0/3]port link-type access
[Huawei-Ethernet0/0/3]port default vlan 3

[Huawei]dis port vlan
Port Link Type PVID Trunk VLAN List
———————————————————————————————————————-
Ethernet0/0/1 access 1 -
Ethernet0/0/2 access 2 -
Ethernet0/0/3 access 3 -
Ethernet0/0/4 hybrid 1 -
Ethernet0/0/5 hybrid 1 -
Ethernet0/0/6 hybrid 1 -
Ethernet0/0/7 hybrid 1 -
Ethernet0/0/8 hybrid 1 -
Ethernet0/0/9 hybrid 1 -
Ethernet0/0/10 hybrid 1 -
Ethernet0/0/11 hybrid 1 -
Ethernet0/0/12 hybrid 1 -
Ethernet0/0/13 hybrid 1 -
Ethernet0/0/14 hybrid 1 -
Ethernet0/0/15 hybrid 1 -
Ethernet0/0/16 hybrid 1 -
Ethernet0/0/17 hybrid 1 -
Ethernet0/0/18 hybrid 1 -
Ethernet0/0/19 hybrid 1 -
Ethernet0/0/20 hybrid 1 -
Ethernet0/0/21 hybrid 1 -
Ethernet0/0/22 hybrid 1 -
GigabitEthernet0/0/1 hybrid 1 -
GigabitEthernet0/0/2 hybrid 1 -

2)配置VLAN网关
[Huawei]int Vlanif 1
[Huawei-Vlanif1]ip add 192.168.1.254 24
[Huawei]int Vlanif 2
[Huawei-Vlanif2]ip add 192.168.2.254 24
[Huawei]int Vlanif 3
[Huawei-Vlanif3]ip add 192.168.3.254 24

[Huawei]dis ip routing-table //显示路由表
Route Flags: R - relay, D - download to fib
———————————————————————————————————————
Routing Tables: Public
Destinations : 8 Routes : 8

Destination/Mask Proto Pre Cost Flags NextHop Interface

  1. 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0<br /> 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0<br /> 192.168.1.0/24 Direct 0 0 D 192.168.1.254 Vlanif1<br /> 192.168.1.254/32 Direct 0 0 D 127.0.0.1 Vlanif1<br /> 192.168.2.0/24 Direct 0 0 D 192.168.2.254 Vlanif2<br /> 192.168.2.254/32 Direct 0 0 D 127.0.0.1 Vlanif2<br /> 192.168.3.0/24 Direct 0 0 D 192.168.3.254 Vlanif3<br /> 192.168.3.254/32 Direct 0 0 D 127.0.0.1 Vlanif3

3)测试PC间互通

3 案例3:多交换机VLAN间通信

3.1 问题

如何在多台交换机的网络环境下实现VLAN间通信?

3.2 方案

使用eNSP搭建实验环境,如图-4所示。
TCNA DAY03 - 图4
图-4

3.3 步骤

实现此案例需要按照如下步骤进行。
1)在二层交换机SW1和SW2上配置VLAN
[SW1]vlan 2
[SW1]vlan 3

[SW1]interface Ethernet0/0/1
[SW1-Ethernet0/0/1]port link-type access
[SW1-Ethernet0/0/1]port default vlan 1

[SW1]interface Ethernet0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 2

[SW1]interface Ethernet0/0/3
[SW1-Ethernet0/0/3]port link-type access
[SW1-Ethernet0/0/3]port default vlan 3

[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all

[SW2]vlan 4
[SW2]vlan 5

[SW2]interface Ethernet0/0/1
[SW2-Ethernet0/0/1]port link-type access
[SW2-Ethernet0/0/1]port default vlan 4

[SW2]interface Ethernet0/0/2
[SW2-Ethernet0/0/2]port link-type access
[SW2-Ethernet0/0/2]port default vlan 5

[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all

2)配置三层交换机
[SW3]vlan batch 1 to 5 //批量创建vlan

[SW3]int g0/0/1
[SW3-GigabitEthernet0/0/1]port link-type trunk
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW3]int g0/0/2
[SW3-GigabitEthernet0/0/2]port link-type trunk
[SW3-GigabitEthernet0/0/2]port trunk allow-pass vlan all

[SW3]int Vlanif 1
[SW3-Vlanif1]ip add 192.168.1.254 24
[SW3]int Vlanif 2
[SW3-Vlanif2]ip add 192.168.2.254 24
[SW3]int Vlanif 3
[SW3-Vlanif3]ip add 192.168.3.254 24
[SW3]int Vlanif 4
[SW3-Vlanif1]ip add 192.168.4.254 24
[SW3]int Vlanif 5
[SW3-Vlanif2]ip add 192.168.5.254 24

3)测试PC间互通

4 案例4:三层交换配置路由

4.1 问题

如何在三层交换机上配置路由,实现全网互通?

4.2 方案

使用eNSP搭建实验环境,如图-5所示。
TCNA DAY03 - 图5
图-5

4.3 步骤

实现此案例需要按照如下步骤进行。
1)交换机配置参见案例4
2)配置路由
[SW3]vlan 6

[SW3]int g0/0/3
[SW3 -GigabitEthernet0/0/3]port link-type access
[SW3 -GigabitEthernet0/0/3]port default vlan 6

[SW3]int Vlanif 6
[SW3-Vlanif6]ip add 192.168.6.254 24

[SW3]ip route-static 192.168.7.0 255.255.255.0 192.168.6.1

[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.6.1 24
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.7.254 24
[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.6.254

[R1]dis ip ro
Route Flags: R - relay, D - download to fib
———————————————————————————————————————
Routing Tables: Public
Destinations : 11 Routes : 11

Destination/Mask Proto Pre Cost Flags NextHop Interface

  1. 0.0.0.0/0 Static 60 0 RD 192.168.6.254 GigabitEthernet<br />0/0/0<br /> 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0<br /> 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0<br />127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0<br /> 192.168.6.0/24 Direct 0 0 D 192.168.6.1 GigabitEthernet<br />0/0/0<br /> 192.168.6.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet<br />0/0/0<br /> 192.168.6.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet<br />0/0/0<br /> 192.168.7.0/24 Direct 0 0 D 192.168.7.254 GigabitEthernet<br />0/0/1<br /> 192.168.7.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet<br />0/0/1<br /> 192.168.7.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet<br />0/0/1<br />255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0

3)测试PC间互通