分析华为路由器单臂路由实例应用(图)

网络 路由交换
本文主要针对华为路由器的单臂路由实例,详细的讲述了配置过程和操作步骤,并且给出了配置命令,相信看过此文会对你有所帮助。

需求:在局域网中,通过交换机上配置VLAN可以减少主机通信广播域的范围,当VLAN之间有部分主机需要通信,但交换机不支持三层交换时,可以采用一台支持802.1Q的路由器实现VLAN的互通.这需要在以太口上建立子接口,分配IP地址作为该VLAN的网关,同时启动802.1Q.

组网:路由器E0端口与交换机的上行trunk端口(第24端口)相连,交换机下行口划分3个VLAN,带若干主机.
拓扑图如下:


 

1.路由器的配置

[Router]
[Router]inter e0
[Router-Ethernet0]ip add 10.0.0.1 255.255.255.0
[Router-Ethernet0]inter e0.1 //定义子接口E0.1
[Router-Ethernet0.1]ip add 172.16.1.1 255.255.255.0
[Router-Ethernet0.1]vlan-type dot1q vid 1 //指定以太网子接口属于VLAN1,此命令应用在以太网子接口上。只有配置了该命令之后,以太网子接口才会根据配置的VLAN ID 号在以太网帧头中嵌入VLAN 标签,与该网口相连的交换机接口才能正确处理接收到的帧。
[Router-Ethernet0.1]inter e0.2 //定义子接口E0.2
[Router-Ethernet0.2]ip add 172.16.2.1 255.255.255.0
[Router-Ethernet0.2]vlan-type dot1q vid 2 //指定以太网子接口属于VLAN2
[Router-Ethernet0.2]inter e0.3 //定义子接口E0.3
[Router-Ethernet0.3]ip add 172.16.3.1 255.255.255.0
[Router-Ethernet0.3]vlan-type dot1q vid 3 //指定以太网子接口属于VLAN3
[Router-Ethernet0.3]inter e0
[Router-Ethernet0]undo shut
% Interface Ethernet0 is up
[Router-Ethernet0] //用网线将E0端口连到S3026第24端口
%19:46:32: Interface Ethernet0 changed state to UP
%19:46:32: Line protocol ip on interface Ethernet0, changed state to UP
%19:46:32: Line protocol ip on interface Ethernet0.1, changed state to UP
%19:46:32: Line protocol ip on interface Ethernet0.2, changed state to UP
%19:46:32: Line protocol ip on interface Ethernet0.3, changed state to UP

2.交换机的配置

<Quidway>
<Quidway>sys
Enter system view , return user view with Ctrl+Z.
[Quidway]vlan 1
[Quidway-vlan1]vlan 2
[Quidway-vlan2]port ethernet 0/17 to eth 0/19 eth 0/22 //将第17至19端口,和第22端口加入VLAN2
[Quidway-vlan2]vlan 3
[Quidway-vlan3]port eth 0/21 //将第21端口加入VLAN2
[Quidway-vlan3]inter e0/24
[Quidway-Ethernet0/24]port link-type trunk //将第24端口设为trunk口
[Quidway-Ethernet0/24]port trunk permit vlan all//允许所有VLAN流量通过
Please wait........................................... Done.
[Quidway-Ethernet0/24]dis port trunk //检验TRUNK口配置
Now, the following trunking ports exist:
Ethernet0/24
[Quidway-Ethernet0/24]dis vlan 2 //检验VLAN2的配置
VLAN ID: 2
VLAN Type: static
Route Interface: not configured
Description: VLAN 0002
Tagged Ports:
Ethernet0/24
Untagged Ports:
Ethernet0/17 Ethernet0/18 Ethernet0/19 Ethernet0/22

[Quidway-Ethernet0/24]dis vlan 3 //检验VLAN3的配置
VLAN ID: 3
VLAN Type: static
Route Interface: not configured
Description: VLAN 0003
Tagged Ports:
Ethernet0/24
Untagged Ports:
Ethernet0/21

3.在工作站上检查网络是否连通。此工作站连接S3026第21端口,属于VLAN2。

C:\Documents and Settings\Administrator>ipconfig

Windows 2000 IP Configuration

Ethernet adapter 本地连接:

Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 172.16.2.22
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 172.16.2.1

C:\Documents and Settings\Administrator>ping 172.16.3.1

Pinging 172.16.3.1 with 32 bytes of data:

Reply from 172.16.3.1: bytes=32 time<10ms TTL=255
Reply from 172.16.3.1: bytes=32 time<10ms TTL=255
Reply from 172.16.3.1: bytes=32 time<10ms TTL=255
Reply from 172.16.3.1: bytes=32 time<10ms TTL=255

Ping statistics for 172.16.3.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

4.在路由器上查看路由表。可以发现,由于172.16各网段都是直连路由,故不需启用路由协议或静态路由即能实现VLAN之间的通讯。

[Router]display ip routing-table
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
10.0.0.0/24 Direct 0 0 10.0.0.1 Ethernet0
10.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
172.16.1.0/24 Direct 0 0 172.16.1.1 Ethernet0.1
172.16.1.1/32 Direct 0 0 127.0.0.1 LoopBack0
172.16.2.0/24 Direct 0 0 172.16.2.1 Ethernet0.2
172.16.2.1/32 Direct 0 0 127.0.0.1 LoopBack0
172.16.3.0/24 Direct 0 0 172.16.3.1 Ethernet0.3
172.16.3.1/32 Direct 0 0 127.0.0.1 LoopBack0

【编辑推荐】

  1. 华为路由器与CISCO路由器在配置上的差别
  2. 华为路由器简单配置详解
  3. 理解华为路由器配置命令中清除列表规则
  4. 应用视点:看华为路由器接入的实际应用
  5. 应用视点:华为路由器网守配合技巧
责任编辑:chenqingxiang 来源: IT实验室
相关推荐

2010-08-12 09:44:39

华为路由器单臂路由

2010-08-05 09:26:37

路由器配置

2010-01-12 09:28:48

思科路由器交换机

2011-09-15 13:56:35

2009-12-02 10:34:04

华为路由器配置实例

2010-08-09 10:31:00

华为路由器路由配置命令

2009-11-30 14:15:17

Cisco路由器配置实

2009-11-19 15:01:58

2009-11-18 16:29:37

WAN口路由器技术

2009-11-17 13:37:23

2009-11-16 10:36:48

华为路由器

2009-12-11 15:09:15

华为路由器

2010-07-30 17:07:37

路由器配置

2011-09-07 12:36:40

路由器连接路由器

2013-03-06 10:12:18

2009-12-01 10:45:29

2009-12-11 15:27:26

华为路由器配置

2010-08-09 14:18:53

路由器telnet

2009-12-03 17:02:37

华为网络路由器

2010-07-28 15:26:10

路由器命令
点赞
收藏

51CTO技术栈公众号