2010年3月15日 星期一

使用Static route 配置 L3 Switch



1-1、配置 IP address、switchport、access or Trunk 
     Router 需配置 Default route 指向 fa0/0

L3-- 1.啟用 ip routing
            Switch(config)# ip routing
Tip: Check the show running-configuration. Verify whether ip routing is enabled.
2.建立Vlan  20  30
            Switch(config)# vlan 20
            Switch(config-if)# name  IT
            ......
Tip: You can use VLAN Trunking Protocol (VTP) to propagate these VLANs to other switches.
3.設定各vlan default Gateway
            Switch(config)# interface Vlan 20
            Switch(config-if)# ip address 192.168.2.254 255.255.255.0
            Switch(config-if)# no shutdown
             .....
4.跟router連接的端口,需更改為 no switchport  並設定IP address
           Switch(config)# interface FastEthernet 0/1
           Switch(config-if)# no switchport 
           Switch(config-if)# ip address 192.168.1.1 255.255.255.0
           Switch(config-if)# no shutdown
5.這裡我們使用 static route 來加強封包傳送的概念 因為目前L3switch 所知道的IP 只有192.168.1.0/24 192.168.2.0/24   192.168.3.0/24    192.168.100.0/24 這些網段。所以我們須將 vlan 40 網段 設定到 routing table。
           Switch(config)# ip route 192.168.4.0 255.255.255.0  192.168.100.2  
   诶? 那這樣還會有一個問題。假如今天要去的 IP address 不是這些呢?
   如果routing table 比對不到,就會將這個封包丟棄。所以,我們還需要在設定一個
   Default route 將這些封包 指向 邊界路由器。
           Switch(config)# ip address 0.0.0.0  0.0.0.0  192.168.1.2
             OK! 大功告成!
     

等等... 別忘了! 我們還有 另一台 L3 Switch呢!  那他的設定 基本上也是一樣的! 只要記得把Default route 指向 192.168.100.1 。

註!我相信各位設定完畢後,在試著ping 200.1.1.1 這台電腦時,一定會發現ping 不通。
      封包確實有過去,只是回不來。
      因為 router 的 routing table 並沒有 底下 Vlan的網段,所以會將封包丟向 fa0/0。
      所以,在這個實驗裡,如果想要ping到 200.1.1.1這台電腦,就需要更改Default route
      聰明的你知道怎更改了吧!!  

     Router(config)# ip address 0.0.0.0  0.0.0.0  192.168.1.1

1 則留言: