CCNA.VLAN专题.part2 - Aaron的日志 - 网易博客
来源:百度文库 编辑:神马文学网 时间:2024/04/28 01:29:43
CCNA.VLAN专题.part2
技术┃Cisco 2006-12-23 09:04:12 阅读167 评论2 字号:大中小
配置VLAN之间的路由【179.18】【250.33】
配置VLAN根据不同的设备的连接,大致有3种配置方案,如图:
1. 交换机to交换机
2. 交换机to路由器
3. 交换机to PC
PS: 为了便于浏览,我假设trunk的封装类型为802.1Q
Trunk的封装类型一共有 ISL和802.1Q两种,而802.1Q在输入的时候则为dot1q。
1.交换机to交换机的配置方案:
Sw1(config)#int fa0/2
Sw1(config-if)#switchport mode trunk
Sw1(config-if)#switchport trunk encapsulation dot1q
Sw2(config)#int fa0/1
Sw2(config-if)#switchport mode trunk
Sw2(config-if)#switchport trunk encapsulation dot1q
2. 交换机to路由器的配置方案:
Sw1(config)#int fa0/1
Sw1(config-if)#switchport mode trunk
Sw1(config-if)#switchport trunk encapsulation dot1q ―――――――――-[1]
PS:
[1] 对于我们来说,2950交换机是比较容易接触到的,你会发现此句命令(switchport trunk encapsulation dot1q)是不能够配置的。因此需要记住,3550交换机可以运行ISL和IEEE 802.1Q的中继封装,而2950交换机只能够运行802.1Q。当然,考试是会按照可以配置的来,所以我们也要记住这个步骤。
R1(config)#int f0/0
R1(config-if)#no shutdown ―――――――――――――――――――――[1]
R1(config-if)#int f0/0.1
R1(config-if)#encapsulation dot1q 1 ―――――――――――――――――[2]
R1(config-subif)#ip address 172.16.10.1 255.255.255.128
R1(config-subif)#int f0/0.2
R1(config-subif)#encapsulation dot1q 2
R1(config-subif)#ip address 172.16.10.254 255.255.255.128
PS:
[1]在物理接口上no shutdown是开启接口,其实你反过来想想,你要在子接口上配置命令,物理接口都没有开启,子接口就更不用谈什么配置了。
[2]在路由器上配置trunk的封装协议的命令:
encapsulation [isl/dot1q] vlan#
解析一下:上面的路由器配置了dot1q中继封装,1是VLAN 1。
还有一点需要注意的是: 要将路由器的端口配置为trunk端口,其端口带宽必须至少是100Mbps。
3.交换机to PC的配置方案:
Sw2(config)#int fa0/2
Sw2(config-if)#switchport access vlan 1
Sw2(config-if)#switchport access vlan 2
配置VLAN之间的路由大致就三种情况,这道例子很重要,做下面的题就是要考上面的这些固定的思路。要是在下面的题有什么不懂的就立即回头看,希望对你有用。
上面内容ok了后,就可以开始讲题罗。
【179.18】
An 802.1Q trunk is configured between a Testking switch and router TK1 as shown
below:
Which of the following are valid configuration values for the host shown in the
graphic? (Choose three)
A. host A IP address: 192.1.1.65
B. host A subnet mask: 255.255.255.224
C. host B IP address: 192.1.1.125
D. host B default gateway: 192.1.1.65
E. host C IP address: 192.1.1.166
F. host C subnet mask: 255.255.255.224
Answer: C, D, F
解析:
先看图里的这部分:
可以知道A、B在VLAN1,C在VLAN10
然后再看这部分,留意红色高亮的部分:
结合一下上面的信息,可以知道vlan 1的网关IP地址是192.1.1.65 255.255.255.192,而vlan 10 的网关IP地址是192.1.1.129 255.255.255.224。这道题的关键点就出来了。
A错。192.1.1.65这个地址是vlan 1的网关地址,所以这个地址不可以是hostA的IP地址。
B错。主机A的子网掩码不是255.255.255.224,而是255.255.255.192,这从下面的这张图就可以知道:
C对。从下面的这张图我们可以知道主机B在VLAN1中:
上面说了,vlan 1的网关IP地址是192.1.1.65 255.255.255.192。其实通过这个地址我们就可以算出vlan 1的网段来,其范围为:64~127,而64是网络地址,127是广播地址,65已被用做网关地址。所以主机B的IP地址为 192.1.1.125是没有问题的。
D对。B主机在VLAN1中,而vlan 1的网关IP地址是192.1.1.65 255.255.255.192,这些信息都是从图中看到的。
E错。从下面的这张图我们可以知道主机C在VLAN2中:
我们知道,vlan 2的网关地址是192.1.1.129 255.255.255.224。其实通过这个地址,我们就可以算出vlan 2的网段,其范围为:128~159,而现在选项中给出的IP地址是192.1.1.166,这就超出了vlan 2的范围128~159,所以是错的。
F对。通过下面的这张图我们就可以知道主机C的子网掩码是255.255.255.224。
上面的这道题结合了VLSM的知识,所以如果对子网划分仍有任何不懂的,可以看我前面讲过的VLSM专题笔记。
【250.33】
Exhibit:
Refer to the exhibit. What commands must be configured on the 2950 switch and
the router to allow communication between host 1 and host 2? (Choose two.)
A. Router(config)# interface fastethernet 0/0
Router(config-if)# ip address 192.168.1.1 255.255.255.0
Router(config-if)# no shut down
B. Router(config)# interface fastethernet 0/0
Router(config-if)# no shutdown
Router(config)# interface fastethernet 0/0.1
Router(config-subif)# encapsulation dot1q 10
Router(config-subif)# ip address 192.168.10.1 255.255.255.0
Router(config)# interface fastethernet 0/0.2
Router(config-subif)# encapsulation dot1q 20
Router(config-subif)# ip address 192.168.20.1 255.255.255.0
C. Router(config)# router eigrp 100
Router(config-router)# network 192.168.10.0
Router(config-router)# network 192.168.20.0
D. Switch1(config)# vlan database
Switch1(config-vlan)# vtp domain XYZ
Switch1(config-vlan)# vtp server
E. Switch1(config)# interface fastethernet 0/1
Switch1(config-if)# switchport mode trunk
F. Switch1(config)# interface vlan 1
Switch1(config-if)# ip default-gateway 192.168.1.1
Answer: B,E
解析:
这道题是上面方案2的配置过程,即:
B选项是在路由器上配置的命令。
E选项是在交换机上配置的命令。