Skip to content

Commit 2a77473

Browse files
committed
Finished 'src/d21/labs.md'.
1 parent dafbb8b commit 2a77473

6 files changed

Lines changed: 236 additions & 5 deletions

File tree

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
+ [第 21 天 VLAN 间路由](d21-inter-VLAN_routing.md)
172172
- [VLAN 间路由](d21/inter-vlan_routing.md)
173173
- [VLAN 间路由的故障排除](d21/troubleshooting.md)
174+
- [第 21 天 实验](d21/labs.md)
174175

175176

176177

src/d21/labs.md

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# 第 21 天 实验
2+
3+
## VLAN 间路由器的子接口实验
4+
5+
### 实验拓扑图
6+
7+
![VLAN 间路由器的子接口实验拓扑结构](../images/d21_lab_topology_01.png)
8+
9+
10+
### 实验目的
11+
12+
13+
学习如何使用路由器子接口,配置 VLAN 间路由。
14+
15+
我(作者)已将 Packet Tracer 用于这个实验,但当咱们有着对全部可用设备的访问时,咱们也可以使用咱们自己的家庭实验室。要在每台电脑上设置下面显示的 IP 地址,并将顶部那台 PC 的默认网关,设置为 `10.10.10.254`,底部 PC 的默认网关设置为 `10.20.20.254`。下面是顶部 PC 的配置:
16+
17+
18+
![VLAN 间路由器子接口实验的顶部 PC 配置](../images/d21_lab_01_01.png)
19+
20+
21+
### 实验步骤
22+
23+
1. 在其中交换机上创建 `VLAN 10``VLAN 20`,并为正确 VLAN 设置正确端口;
24+
25+
```console
26+
Switch#conf t
27+
Enter configuration commands, one per line.  End with CNTL/Z.
28+
Switch(config)#vlan 10
29+
Switch(config-vlan)#vlan 20
30+
Switch(config-vlan)#int f0/2
31+
Switch(config-if)#switchport mode access
32+
Switch(config-if)#switchport access vlan 10
33+
Switch(config-if)#no shut
34+
Switch(config-if)#int f0/1
35+
Switch(config-if)#switchport mode access
36+
Switch(config-if)#switchport access vlan 20
37+
```
38+
39+
2. 将面向路由器的接口,设置为中继;
40+
41+
```console
42+
Switch(config-if)#int g0/1
43+
Switch(config-if)#switchport mode trunk
44+
```
45+
46+
47+
3. 在路由器上配置子接口,每个 VLAN 配置一个;
48+
49+
50+
```console
51+
Router(config)#int g0/1
52+
Router(config-if)#no ip address
53+
Router(config-if)#int g0/1.10
54+
Router(config-subif)#encap dot1Q 10
55+
Router(config-subif)#ip add 10.10.10.254 255.255.255.0
56+
Router(config-subif)#
57+
Router(config-subif)#int g0/1.20
58+
Router(config-subif)#encap dot
59+
Router(config-subif)#encap dot1Q 20
60+
Router(config-subif)#ip add 10.20.20.254 255.255.255.0
61+
Router(config-subif)#int g0/1
62+
Router(config-if)#no shut
63+
```
64+
65+
66+
4.`10.10.10.1` 设备上打开一个命令提示符并 `ping` 默认网关。然后 `ping` `VLAN 20` 中的 PC,证明这一子接口配置有效。
67+
68+
```console
69+
Packet Tracer PC Command Line 1.0
70+
C:\>ping 10.10.10.254
71+
72+
Pinging 10.10.10.254 with 32 bytes of data:
73+
74+
Reply from 10.10.10.254: bytes=32 time=1ms TTL=255
75+
Reply from 10.10.10.254: bytes=32 time=1ms TTL=255
76+
Reply from 10.10.10.254: bytes=32 time<1ms TTL=255
77+
Reply from 10.10.10.254: bytes=32 time<1ms TTL=255
78+
79+
Ping statistics for 10.10.10.254:
80+
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
81+
Approximate round trip times in milli-seconds:
82+
    Minimum = 0ms, Maximum = 1ms, Average = 0ms
83+
84+
C:\>ping 10.20.20.1
85+
86+
Pinging 10.20.20.1 with 32 bytes of data:
87+
88+
Request timed out.
89+
Reply from 10.20.20.1: bytes=32 time<1ms TTL=127
90+
Reply from 10.20.20.1: bytes=32 time<1ms TTL=127
91+
Reply from 10.20.20.1: bytes=32 time<1ms TTL=127
92+
93+
Ping statistics for 10.20.20.1:
94+
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
95+
Approximate round trip times in milli-seconds:
96+
Minimum = 0ms, Maximum = 0ms, Average = 0ms
97+
```
98+
99+
100+
## VLAN 间的 SVI
101+
102+
### 拓扑
103+
104+
![VLAN 间的 SVI 实验拓扑结构](../images/d21_lab_topology_02.png)
105+
106+
### 实验目的
107+
108+
学习如何使用 SVI 配置 VLAN 间路由。
109+
110+
我已将 Packet Tracer 用于这个实验,以及内置的三层交换机,但当咱们有着对全部可用设备的访问时,咱们可使用咱们自己的家庭实验室。要在每台 PC 上设置下面显示的 IP 地址,并按图中标记设置默认网关。
111+
112+
113+
### 实验步骤
114+
115+
1. 在交换机上创建 `VLAN 10``VLAN 20`,并针对正确 VLAN 设置正确端口;
116+
117+
118+
```console
119+
Switch#conf t
120+
Enter configuration commands, one per line.  End with CNTL/Z.
121+
Switch(config)#vlan 10
122+
Switch(config-vlan)#vlan 20
123+
Switch(config-vlan)#int f0/2
124+
Switch(config-if)#switchport
125+
Switch(config-if)#switchport mode access
126+
Switch(config-if)#switchport access vlan 10
127+
Switch(config-if)#no shut
128+
Switch(config-if)#int f0/1
129+
Switch(config-if)#switchport
130+
Switch(config-if)#switchport mode access
131+
Switch(config-if)#switchport access vlan 20
132+
```
133+
134+
135+
2. 因为我(作者)使用的是个三层交换机,所以我们必须以 `switchport` 命令,将接口设置为二层接口,即咱们在上面看到的。接下来,我们需要为 VLAN 添加一个 IP 地址,因为我们未连接到某个路由器;
136+
137+
138+
```console
139+
Switch(config)#interface vlan 10
140+
%LINK-5-CHANGED: Interface Vlan10, changed state to up
141+
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
142+
Switch(config-if)#ip add 10.10.10.1 255.255.255.0
143+
Switch(config-if)#no shut
144+
Switch(config-if)#int vlan 20
145+
%LINK-5-CHANGED: Interface Vlan20, changed state to up
146+
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
147+
Switch(config-if)#ip add 10.20.20.1 255.255.255.0
148+
Switch(config-if)#no shut
149+
Switch(config-if)#exit
150+
Switch#show vlan brief
151+
VLAN Name Status                   Ports
152+
---- -------------- --------- -------------------------------
153+
1 default active               Fa0/3, Fa0/4, Fa0/5, Fa0/6
154+
                               Fa0/7, Fa0/8, Fa0/9, Fa0/10
155+
                               Fa0/11, Fa0/12, Fa0/13, Fa0/14
156+
                               Fa0/15, Fa0/16, Fa0/17, Fa0/18
157+
                               Fa0/19, Fa0/20, Fa0/21, Fa0/22
158+
                               Fa0/23, Fa0/24, Gig0/1, Gig0/2
159+
                                Gig0/1, Gig0/2
160+
10   VLAN0010                         active    Fa0/2
161+
20   VLAN0020                         active    Fa0/1
162+
1002 fddi-default                     active
163+
1003 token-ring-default               active
164+
1004 fddinet-default                  active   
165+
1005 trnet-default                    active
166+
```
167+
168+
3. 由于我们没有使用路由器,所以我们启用该交换机上的 IP 路由,以便器可在两个子网间路由;
169+
170+
171+
```console
172+
Switch(config)#ip routing
173+
```
174+
175+
176+
4. 检查 VLAN 接口是否起来;
177+
178+
```console
179+
Switch#show ip interface brief
180+
GigabitEthernet0/1 unassigned  YES unset  down                  down
181+
GigabitEthernet0/2 unassigned  YES unset  down                  down
182+
Vlan1            unassigned    YES unset  administratively down down
183+
Vlan10            10.10.10.1   YES manual up                    up
184+
Vlan20           10.20.20.1    YES manual up                    up
185+
[Output Truncated]
186+
```
187+
188+
5. `ping` 默认网关,然后 `ping` 另一个 VLAN 上的 PC,检查 VLAN 间路由是否正常。
189+
190+
191+
```console
192+
C:\>ping 10.10.10.1
193+
194+
Pinging 10.10.10.1 with 32 bytes of data:
195+
196+
Reply from 10.10.10.1: bytes=32 time<1ms TTL=255
197+
Reply from 10.10.10.1: bytes=32 time<1ms TTL=255
198+
Reply from 10.10.10.1: bytes=32 time<1ms TTL=255
199+
Reply from 10.10.10.1: bytes=32 time<1ms TTL=255
200+
201+
Ping statistics for 10.10.10.1:
202+
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
203+
Approximate round trip times in milli-seconds:
204+
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
205+
206+
C:\>ping 10.20.20.20
207+
208+
Pinging 10.20.20.20 with 32 bytes of data:
209+
210+
Request timed out.
211+
Reply from 10.20.20.20: bytes=32 time<1ms TTL=127
212+
Reply from 10.20.20.20: bytes=32 time<1ms TTL=127
213+
Reply from 10.20.20.20: bytes=32 time<1ms TTL=127
214+
215+
Ping statistics for 10.20.20.20:
216+
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
217+
Approximate round trip times in milli-seconds:
218+
Minimum = 0ms, Maximum = 0ms, Average = 0ms
219+
220+
C:\>
221+
```
222+
223+
224+

src/d21/troubleshooting.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,21 @@ Fa0/2 1-99,201-4094
3737
`show interface trunk` 命令提供的另一重要细节,是中继的状态。这点确认中继是否形成,以及是否需要链路两端加以检查。当接口未处于 `trunking` 模式下时,那么必须要检查的最重要事项之一,就是运行模式(`on``auto` 等),以确定其是否被允许,与链路另一端形成中继状态。
3838

3939

40-
中继端口上另外一个需要检查的重要元素便是原生 VLAN。原生 VLAN 错误配置可能带来功能缺失,抑或安全问题。中继链路的两端的原生 VLAN 需要匹配
40+
原生 VLAN 是有关中继端口咱们应检查的另一重要元素。错误配置的原生 VLAN,会导致功能缺失或安全问题。原生 VLAN 应在中继链路两端匹配
4141

42-
假如在完成二层检查任务后,VLAN 间路由问题仍然存在,你就可以继续进行三层配置检查了。依据用于实现 VLAN 间路由的三层设备,可能会在下列设备上进行配置及配置检查。
42+
若在验证了这些二层检查任务后,VLAN 间问题仍未解决,那么咱们可继续检查三层的配置。根据用于确保实际 VLAN 间路由的三层设备,三层配置的检查,可在以下设备之一上配置/验证:
4343

44-
- 多层交换机,multilayer switch
45-
- 路由器 -- 物理接口, router -- physical interfaces
46-
- 路由器 -- 子接口,router -- subinterfaces
44+
- 多层交换机
45+
- 路由器 - 物理接口
46+
- 路由器 - 子接口
4747

4848

49+
在三层设备上,咱们应检查是否为各个接口(或 SVI),分配了正确的子网,且在需要时,咱们还应检查路由协议。通常,每个 VLAN 都会分配不同子网,因此咱们应确保咱们没有错误配置接口。为了验证这点,咱们可针对特定物理接口、子接口或 SVL,使用 `show interface` 这条命令。
50+
51+
52+
53+
请参加 [Free CCNA Training Bonus – Cisco CCNA in 60 Days v4](https://www.in60days.com/free/ccnain60days/) 处今天的考试。
54+
4955
三层设备上应该检查一下其各接口(或者交换机虚拟接口,SVI)都有分配的正确的子网,同时如有必要,你还应检查一下路由协议。通常情况下,各个 VLAN 都有分配不同的子网,所以你应确保你未曾错误配置了接口。而为检查此项,你可以对特定物理接口、子接口或是 SVI,使用 `show interface` 命令。
5056

5157

src/images/d21_lab_01_01.png

324 KB
Loading

src/images/d21_lab_topology_01.png

140 KB
Loading

src/images/d21_lab_topology_02.png

139 KB
Loading

0 commit comments

Comments
 (0)