拓扑图:


错误:对于整个拓扑来说,PC1无法ping通PC2


具体排错方法:PC1用ping命令测试,从最远程的网络开始到PC1的网关,一层一层地检查,找到对应的哪些能通,再通过测试结果分析可能存在的原因。


其中,错误原因可能有:路由器子接口上对应的VLAN封装错误、路由表不完整、交换机和路由器的链路上未启用trunk模式、交换机上端口所属VLAN划分错误、PC上的IP地址及网关配置错误


以本题为例,常见排错命令以及对应的信息显示:

1、S1#show interfaces gigabitEthernet 0/1 switchport

Name: Gig0/1

Switchport: Enabled

Administrative Mode: static access   //得出该接口没有启用trunk模式,使用的是access模式

Operational Mode: static access

Administrative Trunking Encapsulation: dot1q

Operational Trunking Encapsulation: native

Negotiation of Trunking: Off

Access Mode VLAN: 1 (default)

Trunking Native Mode VLAN: 1 (default)

Voice VLAN: none

Administrative private-vlan host-association: none

Administrative private-vlan mapping: none

Administrative private-vlan trunk native VLAN: none

Administrative private-vlan trunk encapsulation: dot1q

Administrative private-vlan trunk normal VLANs: none

Administrative private-vlan trunk private VLANs: none

Operational private-vlan: none

Trunking VLANs Enabled: ALL

Pruning VLANs Enabled: 2-1001

Capture Mode Disabled

Capture VLANs Allowed: ALL

Protected: false


2、S1#show vlan brief


VLAN Name                             Status    Ports

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

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

Fa0/5, Fa0/7, Fa0/8, Fa0/9

Fa0/10, 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, Gig0/2

10   Faculty/Staff                    active    Fa0/11

30   Guest(Default)                   active    Fa0/6

//得出VLAN划分是正确的

1002 fddi-default                     active

1003 token-ring-default               active

1004 fddinet-default                  active

1005 trnet-default                    active    


3、R1#show interfaces gigabitEthernet 0/1.10

GigabitEthernet0/1.10 is up, line protocol is up (connected)

Hardware is PQUICC_FEC, address is 000d.bde7.0c02 (bia 000d.bde7.0c02)

Internet address is 172.17.10.1/24

MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,

reliability 255/255, txload 1/255, rxload 1/255

Encapsulation 802.1Q Virtual LAN, Vlan ID 30 //从此处得出VLAN ID的封装错误

ARP type: ARPA, ARP Timeout 04:00:00,

Last clearing of "show interface" counters never


R1#show interfaces gigabitEthernet 0/1.30

GigabitEthernet0/1.30 is up, line protocol is up (connected)

Hardware is PQUICC_FEC, address is 000d.bde7.0c02 (bia 000d.bde7.0c02)

Internet address is 172.17.30.1/24

MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,

reliability 255/255, txload 1/255, rxload 1/255

Encapsulation 802.1Q Virtual LAN, Vlan ID 10 //从此处得出VLAN ID的封装错误

ARP type: ARPA, ARP Timeout 04:00:00,

Last clearing of "show interface" counters never


4、R1(config)#do show ip route或R1#show ip route

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route


Gateway of last resort is not set


172.17.0.0/16 is variably subnetted, 2 subnets, 2 masks

C       172.17.10.0/24 is directly connected, GigabitEthernet0/1.10

L       172.17.10.1/32 is directly connected, GigabitEthernet0/1.10

//从路由表得出,此路由表还缺少一条172.17.30.0/24的路