VLAN之間的路由

VLAN之間的路由

本實驗演示了VLAN及單臂路由的發展歷史
 要求:1.將交換機劃成2個VLAN;
       2.把後3個端口加入VLAN2;
       3.把路由器的Fa0/0口加入VLAN1,Fa0/1口加入VLAN2口;
       4.僅使路由器的Fa0/0與VLAN1連接,配置單臂路由。
 說明:1.本實驗須2900交換機一臺,2621路由器一臺,PC機兩臺
       2.2900交換機的E0/1口與PC1相連,E0/2口與路由器的F0/0相連,
         E0/12PC2相連,F0/27與路由器的F0/1相連
       3.PC1IP地址是192.168.1.2/24,網關是192.168.1.1;
         PC2IP地址是192.168.2.2/24,網關是192.168.2.1;
實驗過程:
 switch
        en
        vlan database                建立VLAN
        vlan 2 name 2
        vlan 3 name 3
        vlan 4 name 4
        apply
        exit
        config t
        int f0/26                    將端口映射到VLAN
        switchport access vlan 2
        exit
        int f0/27
        switchport access vlan 2
        exit
        int fa0/12
        switchport access vlan 2
        exit
        int fa0/11
        switchport access vlan 3  
        no switchport access vlan 3 將端口e0/11從VLAN3中刪除
        ^z
        vlan
        vlan database                刪除VLAN3、VLAN4
        no vlan 3
        no vlan 4
 
router
       en
       config t
       int fa0/0
       ip address 192.168.1.1 255.255.255.0
       no shut
       exit
       int fa0/1
       ip address 192.168.2.1 255.255.255.0
       no shut
這時接入VLAN1的配置正確的計算機與接入VLAN2的配置正確的計算機可以正常通信,但多浪費路由器的一個接口和交換機的一個接口,方法不可行
將連接路由器端口Fa0/1與交換機的線斷開,形成單臂路由
 
switch
       config t
       int E0/2
       switchport mode trunk                  在端口上配置中繼
       switchport trunk encapsulation isl    ISL進行封裝
 
router
      config t
      int fa0/0
      shut
      no shut
      exit
      int fa0/0.1
      encapsulation isl 1         將子接口fa0/0設置爲trunk,用ISL封裝,劃分到VLAN1   
      ip address 192.168.1.1 255.255.255.0(子接口封裝後才能進行IP地址的配置)
      no shut
      exit
      int fa0/0.2
      encapsulation isl 2
      ip address 192.168.2.1 255.255.255.0
      no shut
 
                                                           
 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章