路由器可以对多个以太网接口捆绑形成一个Eth-Trunk逻辑接口,Eth-Trunk接口的主要目的是增大带宽和提高设备之间链路的可靠性。Eth-Trunk接口可以工作在二层模式或三层模式。二层模式的Eth-Trunk接口类似交互机的接口,只负责二层数据包的转发;三层模式的Eth-Trunk接口则类似路由器的接口,可以配上IP地址实现路由功能。本文为大家介绍如何在华为的路由器里配置二层和三层Eth-Trunk接口。

一、二层Eth-Trunk接口配置实例

 

1、组网结构和需求

       如下图所示,RouterA和RouterB之间通过Eth-Trunk1连接,Eth-Trunk1是二层端口。将Eth-Trunk1配置为Trunk类型接口,允许RouterA和RouterB之间的所有VLAN帧通过。

   

2、配置思路

采用如下的思路配置二层Eth-Trunk端口允许VLAN通过:

1)创建Eth-Trunk接口。

2)将Eth-Trunk接口转为二层端口。

3)将Eth-Trunk端口配置为Trunk类型的端口,并允许所有VLAN帧通过。

4)将成员口接入Eth-Trunk端口中。

 

3、配置步骤

 

1)配置RouterA

# 创建Eth-Trunk接口,并配置允许通过的VLAN。

[RouterA] interface eth-trunk 1

[RouterA-Eth-Trunk1] portswitch

[RouterA-Eth-Trunk1] port link-type trunk

[RouterA-Eth-Trunk1] port trunk allow-pass vlan all

[RouterA-Eth-Trunk1] quit

# 将接口GE1/0/0、GE2/0/0加入到Eth-Trunk 1中。

[RouterA] interface gigabitethernet 1/0/0

[RouterA-GigabitEthernet1/0/0] undo shutdown

[RouterA-GigabitEthernet1/0/0] eth-trunk 1

[RouterA-GigabitEthernet1/0/0] quit

[RouterA] interface gigabitethernet 2/0/0

[RouterA-GigabitEthernet2/0/0] undo shutdown

[RouterA-GigabitEthernet2/0/0] eth-trunk 1

[RouterA-GigabitEthernet2/0/0] quit

 

2)配置RouterB

# 创建Eth-Trunk接口,并配置允许通过的VLAN。

[RouterB] interface eth-trunk 1

[RouterB-Eth-Trunk1] portswitch

[RouterB-Eth-Trunk1] port link-type trunk

[RouterB-Eth-Trunk1] port trunk allow-pass vlan all

[RouterB-Eth-Trunk1] quit

# 将接口GE1/0/0、GE2/0/0加入到Eth-Trunk 1中。

[RouterB] interface gigabitethernet 1/0/0

[RouterB-GigabitEthernet1/0/0] undo shutdown

[RouterB-GigabitEthernet1/0/0] eth-trunk 1

[RouterB-GigabitEthernet1/0/0] quit

[RouterB] interface gigabitethernet 2/0/0

[RouterB-GigabitEthernet2/0/0] undo shutdown

[RouterB-GigabitEthernet2/0/0] eth-trunk 1

[RouterB-GigabitEthernet2/0/0] quit

 

4、验证配置结果

查看Eth-Trunk1的状态,以RouterA为例:

display trunkmembership eth-trunk 1

Trunk ID: 1

used status: VALID

TYPE: ethernet

Working Mode : Normal

Working State: Normal

Number Of Ports in Trunk = 2

Number Of UP Ports in Trunk = 2

operate status: up

Interface Ethernet1/0/0, valid, selected, operate up, weight=1,

standby interface NULL

Interface Ethernet2/0/0, valid, selected, operate up, weight=1,

standby interface NULL

 

用display port vlan命令查看Eth-Trunk端口上可以通过的VLAN信息。以RouterA为例:

display port vlan Eth-Trunk 1

Port Link Type PVID Trunk VLAN List

-------------------------------------------------------------------------------

Eth-Trunk1 trunk 0 1-4094

 

5、配置文件

1)RouterA的配置文件

#

sysname RouterA

#

interface Eth-Trunk1

portswitch

port link-type trunk

port trunk allow-pass vlan 1 to 4094

#

interface GigabitEthernet1/0/0

undo shutdown

eth-trunk 1

#

interface GigabitEthernet2/0/0

undo shutdown

eth-trunk 1

#

return

 

2)RouterB的配置文件

#

sysname RouterB

#

interface Eth-Trunk1

portswitch

port link-type trunk

port trunk allow-pass vlan 1 to 4094

#

interface GigabitEthernet1/0/0

undo shutdown

eth-trunk 1

#

interface GigabitEthernet2/0/0

undo shutdown

eth-trunk 1

#

return

 

二、三层Eth-Trunk接口配置实例

 

1、组网结构和需求

       如下图所示,在RouterA与RouterB之间创建Eth-Trunk,将两个GE捆绑成一个Eth-Trunk,并在Eth-Trunk接口配上IP地址。

   

2、配置思路

采用如下的思路配置Eth-Trunk:

1)创建Eth-Trunk接口并配置IP地址。

2)把以太网接口加入Eth-Trunk接口。

 

3、配置步骤

 

1)配置RouterA

# 创建Eth-Trunk接口,并配置IP地址。

[RouterA] interface eth-trunk 1

[RouterA-Eth-Trunk1] ip address 192.168.0.1 255.255.255.0

[RouterA-Eth-Trunk1] quit

# 将接口GE1/0/0、GE2/0/0加入到Eth-Trunk 1中。

[RouterA] interface gigabitethernet 1/0/0

[RouterA-GigabitEthernet1/0/0] undo shutdown

[RouterA-GigabitEthernet1/0/0] eth-trunk 1

[RouterA-GigabitEthernet1/0/0] quit

[RouterA] interface gigabitethernet 2/0/0

[RouterA-GigabitEthernet2/0/0] undo shutdown

[RouterA-GigabitEthernet2/0/0] eth-trunk 1

[RouterA-GigabitEthernet2/0/0] quit

 

2)配置RouterB

# 创建Eth-Trunk接口,并配置IP地址。

[RouterB] interface eth-trunk 1

[RouterB-Eth-Trunk1] ip address 192.168.0.2 255.255.255.0

[RouterB-Eth-Trunk1] quit

# 将接口GE1/0/0、GE2/0/0加入到Eth-Trunk 1中。

[RouterB] interface gigabitethernet 1/0/0

[RouterB-GigabitEthernet1/0/0] undo shutdown

[RouterB-GigabitEthernet1/0/0] eth-trunk 1

[RouterB-GigabitEthernet1/0/0] quit

[RouterB] interface gigabitethernet 2/0/0

[RouterB-GigabitEthernet2/0/0] undo shutdown

[RouterB-GigabitEthernet2/0/0] eth-trunk 1

[RouterB-GigabitEthernet2/0/0] quit

 

4、检查配置结果

在RouterA或RouterB上执行display interface eth-trunk命令,可以看到接口状态为UP。以RouterA的显示为例。

[RouterA] display interface eth-trunk 1

Eth-Trunk1 current state : UP

Line protocol current state : UP

Last up time: 2011-01-13, 14:50:20

Description : HUAWEI, Quidway Series, Eth-Trunk1 Interface, Route Port

Hash arithmatic : According to flow

The Maximum Transmit Unit is 1500 bytes

Internet Address is 192.168.0.1/24

IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 00e0-fc09-9722

Physical is ETH_TRUNK

Last 300 seconds input rate 0 bytes/sec, 0 packets/sec

Last 300 seconds output rate 0 bytes/sec, 0 packets/sec

Input: 1 packets,3 bytes,

7 unicast,9 broadcast,8 multicasts

10 errors,5 drops,11 unknowprotocol

Output: 2 packets,4 bytes,

12 unicast,14 broadcast,13x multicasts

15 errors,6 drops

-----------------------------------------------------

PortName Status Weight

-----------------------------------------------------

GigabitEthernet1/0/0 UP 1

GigabitEthernet2/0/0 UP 1

-----------------------------------------------------

The Number of Ports in Trunk : 2

The Number of UP Ports in Trunk : 2

 

RouterA和RouterB的Eth-Trunk接口能够互相Ping通。

[RouterA] ping 192.168.0.2

PING 192.168.0.2: 56 data bytes, press CTRL_C to break

Reply from 192.168.0.2: bytes=56 Sequence=1 ttl=255 time=31 ms

Reply from 192.168.0.2: bytes=56 Sequence=2 ttl=255 time=31 ms

Reply from 192.168.0.2: bytes=56 Sequence=3 ttl=255 time=62 ms

Reply from 192.168.0.2: bytes=56 Sequence=4 ttl=255 time=62 ms

Reply from 192.168.0.2: bytes=56 Sequence=5 ttl=255 time=62 ms

--- 192.168.0.2 ping statistics ---

5 packet(s) transmitted

5 packet(s) received

0.00% packet loss

round-trip min/avg/max = 31/49/62 ms

 

5、配置文件

1)RouterA的配置文件

#

sysname RouterA

#

interface Eth-Trunk1

ip address 192.168.0.1 255.255.255.0

#

interface GigabitEthernet1/0/0

undo shutdown

eth-trunk 1

#

interface GigabitEthernet2/0/0

undo shutdown

eth-trunk 1

#

return

 

2)RouterB的配置文件

#

sysname RouterB

#

interface Eth-Trunk1

ip address 192.168.0.2 255.255.255.0

#

interface GigabitEthernet1/0/0

undo shutdown

eth-trunk 1

#

interface GigabitEthernet2/0/0

undo shutdown

eth-trunk 1

#

return