搜档网
当前位置:搜档网 › CISCO 单臂路由

CISCO 单臂路由

CISCO 单臂路由
CISCO 单臂路由

CISCO 单臂路由、VTP、STP的配置实验

拓扑图如下:

要求:1、PC0能PING通PC1

2、正常情况下VLAN 10走A线路去路由器;当A断了时,走线路BC到路由器。

正常情况下VLAN 20走B线路去路由器;当B断了时,走线路BA到路由器。具体配置步骤如下:

1、在路由器上配置子接口,并封装802.1Q。

Router>en

Router#config t

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#int f0/1

Router(config-if)#no sh

Router(config-subif)#encapsulation dot1Q 10

Router(config-subif)#ip add 192.168.2.1 255.255.255.0

Router(config-subif)#int f0/1.2

%LINK-5-CHANGED: Interface FastEthernet0/1.2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.2, changed state to up

Router(config-subif)#encapsulation dot1Q 20

Router(config-subif)#ip add 192.168.1.1 255.255.255.0

Router(config-subif)#no sh

Router(config-subif)#end

%SYS-5-CONFIG_I: Configured from console by console

Router#wr

Building configuration...

[OK]

2、交换机switch1上配置VTP server ,并把相应接口配置成TRUNK模式

Switch>en

Switch#vlan database

% Warning: It is recommended to configure VLAN from config mode,

as VLAN database mode is being deprecated. Please consult user

documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#vtp server

Device mode already VTP SERVER.

Switch(vlan)#vtp domain we

Changing VTP domain name from NULL to we

Switch(vlan)#vtp password 123

Setting device VLAN database password to 123

Switch(vlan)#vlan 10

VLAN 10 added:

Name: VLAN0010

Switch(vlan)#vlan 20

VLAN 20 added:

Name: VLAN0020

Switch(vlan)#exi

APPL Y completed.

Exiting....

Switch#config t

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#int range f0/1 - 4

Switch(config-if-range)#sw

Switch(config-if-range)#switchport mode trunk

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to up Switch(config-if-range)#end

%SYS-5-CONFIG_I: Configured from console by console

Switch#wr

Building configuration...

[OK]

3、交换机switch2上配置VTP client,并把相应接口加入VLAN中。配置成VLAN 10 的根网桥

Switch>en

Switch#vlan database

% Warning: It is recommended to configure VLAN from config mode,

as VLAN database mode is being deprecated. Please consult user

documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#vtp c

Switch(vlan)#vtp client

Setting device to VTP CLIENT mode.

Switch(vlan)#vtp domain we

Domain name already set to we.

Switch(vlan)#vtp password 123

Setting device VLAN database password to 123

Switch(vlan)#exit

APPL Y completed.

Exiting....

Switch#sh vlan

VLAN Name Status Ports

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

1 default active Fa0/1, Fa0/2, Fa0/4, Fa0/5

Fa0/6, Fa0/7, Fa0/8, Fa0/9

Fa0/10, Fa0/11, Fa0/12, Fa0/13

Fa0/14, Fa0/15, Fa0/16, Fa0/17

Fa0/18, Fa0/19, Fa0/20, Fa0/21

Fa0/22, Fa0/23, Fa0/24, Gig1/1

Gig1/2

10 VLAN0010 active

20 VLAN0020 active

1002 fddi-default act/unsup

1003 token-ring-default act/unsup

1004 fddinet-default act/unsup

1005 trnet-default act/unsup

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------

1 enet 100001 1500 - - - - - 0 0

10 enet 100010 1500 - - - - - 0 0

20 enet 100020 1500 - - - - - 0 0

1002 fddi 101002 1500 - - - - - 0 0

1003 tr 101003 1500 - - - - - 0 0

1004 fdnet 101004 1500 - - - ieee - 0 0

1005 trnet 101005 1500 - - - ibm - 0 0

Remote SPAN VLANs

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

Primary Secondary Type Ports

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

Switch#

Switch#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#spanning-tree vlan 10 priority 4096

Switch(config)#spanning-tree vlan 20 priority 8192

Switch(config)#exi

%SYS-5-CONFIG_I: Configured from console by console

Switch#sh spanning-tree

VLAN0001

Spanning tree enabled protocol ieee

Root ID Priority 32769

Address 000A.41D4.1821

Cost 19

Port 2(FastEthernet0/2)

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)

Address 00D0.97D7.6CCA

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Aging Time 20

Interface Role Sts Cost Prio.Nbr Type

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

Fa0/3 Desg FWD 19 128.3 P2p

Fa0/2 Root FWD 19 128.2 P2p

VLAN0010

Spanning tree enabled protocol ieee

Root ID Priority 4106

Address 00D0.97D7.6CCA

This bridge is the root

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 4106 (priority 4096 sys-id-ext 10)

Address 00D0.97D7.6CCA

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Aging Time 20

Interface Role Sts Cost Prio.Nbr Type

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

Fa0/3 Desg FWD 19 128.3 P2p

Fa0/2 Desg FWD 19 128.2 P2p

Fa0/1 Desg FWD 19 128.1 P2p

VLAN0020

Spanning tree enabled protocol ieee

Root ID Priority 4116

Address 000A.41D4.1821

Cost 19

Port 2(FastEthernet0/2)

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 8212 (priority 8192 sys-id-ext 20)

Address 00D0.97D7.6CCA

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Aging Time 20

Interface Role Sts Cost Prio.Nbr Type

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

Fa0/3 Desg FWD 19 128.3 P2p

Fa0/2 Root FWD 19 128.2 P2p

Switch(config)#int f0/1

Switch(config-if)#switchport access vlan 10

Switch(config-if)#int range f0/2 - 3

Switch(config-if-range)#switchport mode trunk

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up Switch(config)#end

Switch#

%SYS-5-CONFIG_I: Configured from console by console

wr

Building configuration...

[OK]

4、交换机switch3上配置VTP client,并把相应接口加入VLAN中。配置成VLAN 20的根网桥

Switch>en

Switch#vlan database

% Warning: It is recommended to configure VLAN from config mode,

as VLAN database mode is being deprecated. Please consult user

documentation for configuring VTP/VLAN in config mode.

Switch(vlan)#vtp c

Switch(vlan)#vtp client

Setting device to VTP CLIENT mode.

Switch(vlan)#vtp domain we

Domain name already set to we.

Switch(vlan)#vtp password 123

Setting device VLAN database password to 123

Switch(vlan)#exi

APPL Y completed.

Exiting....

Switch#sh vlan

VLAN Name Status Ports

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

1 default active Fa0/1, Fa0/3, Fa0/5, Fa0/6

Fa0/7, Fa0/8, Fa0/9, Fa0/10

Fa0/11, Fa0/12, Fa0/13, Fa0/14

Fa0/15, Fa0/16, Fa0/17, Fa0/18

Fa0/19, Fa0/20, Fa0/21, Fa0/22

Fa0/23, Fa0/24, Gig1/1, Gig1/2

10 VLAN0010 active

20 VLAN0020 active

1002 fddi-default act/unsup

1003 token-ring-default act/unsup

1004 fddinet-default act/unsup

1005 trnet-default act/unsup

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2

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

1 enet 100001 1500 - - - - - 0 0 10 enet 100010 1500 - - - - - 0 0 20 enet 100020 1500 - - - - - 0 0 100

2 fddi 101002 1500 - - - - - 0 0 100

3 tr 101003 1500 - - - - - 0 0 100

4 fdnet 101004 1500 - - - ieee - 0 0 100

5 trnet 101005 1500 - - - ibm - 0 0

Remote SPAN VLANs

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

Primary Secondary Type Ports

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

Switch#confi t

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#int f0/1

Switch(config-if)#switchport access vlan 20

Switch(config-if)#int range f0/2 - 4

Switch(config-if-range)#sw

Switch(config-if-range)#switchport mode trunk

Switch(config-if-range)#end

%SYS-5-CONFIG_I: Configured from console by console

Switch#config

Configuring from terminal, memory, or network [terminal]?

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#spanning-tree vlan 20 priority 4096

Switch(config)#exi

%SYS-5-CONFIG_I: Configured from console by console

Switch#sh spanning-tree vlan 20

VLAN0020

Spanning tree enabled protocol ieee

Root ID Priority 4116

Address 000A.41D4.1821

This bridge is the root

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 4116 (priority 4096 sys-id-ext 20)

Address 000A.41D4.1821

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Aging Time 20

Interface Role Sts Cost Prio.Nbr Type

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

Fa0/2 Desg FWD 19 128.2 P2p

Fa0/4 Desg FWD 19 128.4 P2p

Fa0/1 Desg FWD 19 128.1 P2p

Switch(config)#spanning-tree vlan 10 priority 8192

Switch(config)#exi

%SYS-5-CONFIG_I: Configured from console by console

Switch#sh span

Switch#sh spanning-tree vlan 10

VLAN0010

Spanning tree enabled protocol ieee

Root ID Priority 8202

Address 000A.41D4.1821

This bridge is the root

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Bridge ID Priority 8202 (priority 8192 sys-id-ext 10)

Address 000A.41D4.1821

Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Aging Time 20

Interface Role Sts Cost Prio.Nbr Type

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

Fa0/2 Desg FWD 19 128.2 P2p

Fa0/4 Desg FWD 19 128.4 P2p

Switch#wr

Building configuration...

[OK]

5、给PC配置IP并用PING检测

PC>ping 192.168.1.2

Pinging 192.168.1.2 with 32 bytes of data:

Request timed out.

Reply from 192.168.1.2: bytes=32 time=172ms TTL=127

Reply from 192.168.1.2: bytes=32 time=187ms TTL=127

Reply from 192.168.1.2: bytes=32 time=187ms TTL=127

Ping statistics for 192.168.1.2:

Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),

Approximate round trip times in milli-seconds:

Minimum = 172ms, Maximum = 187ms, Average = 182ms

相关主题