ccna学习指南中文第五版中的vlan路由实验

[顶]ccna学习指南中文第五版中的vlan路由实验附带图片


ccna学习指南(中文第五版)第349页“配置示例互联网络中的交换”(实验用模拟器packet tracer 5.0)
今天比着这一页的配置示例做了以下实验,书上的拓扑图中只用到了4台pc,两台交换机和1台路由器。
一、设置vlan1的管理地址:
   在2950c上设置为172.16.10.2/24,网关为172.16.10.1
   在2950b上设置为172.16.10.3/24,网关为172.16.10.1
   pc的ip地址设置:
   pc1:172.16.20.10/24    网关:172.16.20.1
   pc1:172.16.30.10/24    网关:172.16.30.1
   pc1:172.16.20.20/24    网关:172.16.20.1
   pc1:172.16.30.20/24    网关:172.16.30.1

@对于2950c的配置:
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hostname 2950c
2950c(config)#int vlan1
2950c(config-if)#ip add 172.16.10.2 255.255.255.0
2950c(config-if)#no shut
2950c(config-if)#exit
2950c(config)#ip default
2950c(config)#ip default-gateway 172.16.10.1
2950c(config)#^Z
%SYS-5-CONFIG_I: Configured from console by console
2950c#
@对于2950b的配置:
Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hostname 2950b
2950b(config)#int vlan 1
2950b(config-if)#ip addr 172.16.10.3 255.255.255.0
2950b(config-if)#no shut
2950b(config-if)#exit
2950b(config)#ip def
2950b(config)#ip default-gateway 172.16.10.1
2950b(config)#exit
2950b#ping 172.16.10.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.10.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/28/32 ms
2950b#
二、在端口上设置中继
2950b#
2950b#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
2950b(config)#int f0/1
2950b(config-if)#switch mode trunk
2950b(config-if)#int f0/4
2950b(config-if)#switch mode trunk
%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
2950b(config-if)#int f0/5
2950b(config-if)#switch mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up
2950b(config-if)#exit
2950b(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
2950b#
、、、、、、、、、、、、、、、、< br />2950c>
2950c>en
2950c#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
2950c(config)#int f0/4
2950c(config-if)#switch mode trunk
2950c(config-if)#int f0/5
2950c(config-if)#switch mode trunk
2950c(config-if)#exit
2950c(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
2950c#
三、设置vtp信息
2950c#
2950c#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
2950c(config)#vtp mode server
Device mode already VTP SERVER.
2950c(config)#vtp domain routersim
Changing VTP domain name from NULL to routersim
2950c(config)#vlan 2
2950c(config-vlan)#name sales
2950c(config-vlan)#vlan 3
2950c(config-vlan)#name marketing
2950c(config-vlan)#^Z
设置端口访问vlan
2950c(config)#int f0/2
2950c(config-if)#switch access vlan 2
2950c(config-if)#int f0/3
2950c(config-if)#switch access vlan 3
2950c(config-if)#
设置2950b为vtp客户机,可以自动更新vlan
2950b#
2950b#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
2950b(config)#vtp domain routersim
Domain name already set to routersim.
2950b(config)#vtp mode client
Setting device to VTP CLIENT mode.
2950b(config)#^Z
在2950b上设置vlan成员
2950b#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
2950b(config)#int f0/2
2950b(config-if)#switch access vlan 2
2950b(config-if)#int f0/3
2950b(config-if)#switch access vlan 3
2950b(config-if)#^Z
%SYS-5-CONFIG_I: Configured from console by console
2950b#
四、使用lab_b路由器来配置vlan间的通信,使用单臂路由
Router>
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host trunkrouter
trunkrouter(config)#int f0/0
trunkrouter(config-if)#no ip address
trunkrouter(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
trunkrouter(config-if)#int f0/0.1
%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to uptrunkrouter
(config-subif)#ip address 172.16.10.1 255.255.255.0
% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.
trunkrouter(config-subif)#en
trunkrouter(config-subif)#encapsulation dot1q 1
trunkrouter(config-subif)#int f0/0.2
%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to uptrunkrouter
(config-subif)#encap dot1q 2
trunkrouter(config-subif)#ip address 172.16.20.1 255.255.255.0
trunkrouter(config-subif)#int f0/0.3
%LINK-5-CHANGED: Interface FastEthernet0/0.3, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.3, changed state to uptrunkrouter
(config-subif)#encap dot1q 3
trunkrouter(config-subif)#ip address 172.16.30.1 255.255.255.0
trunkrouter(config-subif)#exit
trunkrouter(config)#^Z
%SYS-5-CONFIG_I: Configured from console by console
trunkrouter#

用pc1 ping 其他三台pc都可以ping通,实验成功

你可能感兴趣的:(路由,VLAN,休闲,实验,CCNA)