用路由器实现VLAN之间的访问---4

实验环境:

用路由器实现VLAN之间的访问---4 - ibm.chick - MingKang.Zhou
 
 
操作步骤
交换机设置:
Switch>enable
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 2                                             (创建VLAN 2)
Switch(config-vlan)#exit
Switch(config)#vlan 3                                               (创建VLAN 3)
Switch(config-vlan)#exit
Switch(config)#int f0/2                                             (进入F0/2接口)
Switch(config-if)#switchport mode access              (设置为端口为访问模式:ACCESS)
Switch(config-if)#switchport access vlan 2               (并加入到VLAN2中)
Switch(config-if)#exit
Switch(config)#int f0/3                                             (进入F0/3接口)
Switch(config-if)#switchport mode access                (设置为端口为访问模式:ACCESS)
Switch(config-if)#switchport access vlan 3                (并加入到VLAN3中)
Switch(config-if)#exit
Switch(config)#int f0/1                                                (进入F0/1接口)
Switch(config-if)#switchport mode trunk                      (设置为端口为访问模式:trunk)
Switch(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
 
路由器设置:
Router>enable
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f0/0                                                     (进入F0/0端口)
Router(config-if)#no shutdown                                        (启用该端口)
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#int f0/0.2                                              (进入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 up
Router(config-subif)#encapsulation dot1Q 2                   (封装 802.1Q (dot1Q),2 为 VLAN_ID)
Router(config-subif)#ip address 10.1.2.254 255.255.255.0       (配置IP地址)
Router(config-subif)#end
Router#
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f0/0.3                                                        (进入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 up
Router(config-subif)#encapsulation dot1Q 3                           (封装 802.1Q (dot1Q),3 为 VLAN_ID)
Router(config-subif)#ip add 10.1.3.254 255.255.255.0              (配置IP地址)
Router(config-subif)#end
Router#show run                                                                       (查看路由器配置状态)
Building configuration...
 
Current configuration : 620 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
!
interface FastEthernet0/0.2
 encapsulation dot1Q 2
 ip address 10.1.2.254 255.255.255.0
!
interface FastEthernet0/0.3
 encapsulation dot1Q 3
 ip address 10.1.3.254 255.255.255.0
!
interface FastEthernet0/1
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Vlan1
 no ip address
 
设置设置相应的PC地址,测试连通性:
用路由器实现VLAN之间的访问---4 - ibm.chick - MingKang.Zhou
posted @ 2016-06-01 17:44  亦非台  阅读(299)  评论(0)    收藏  举报