วันอาทิตย์ที่ 24 เมษายน พ.ศ. 2554

Spanning-Tree บน C2960

หลายคนรู้จัก spanning-tree protocol อยู่แล้วแต่บางคนก็ยังไม่รู้ว่ามันคืออะไร พอดีมีโอกาสได้เล่น C2960 มาก็เลยเอามาลอง feature spanning-tree หน่อย
ขออธิบาย STP แบบง่ายๆนะครับ คือ protocol ที่ใช้ block ไม่ให้เกิด broadcast stomming ในระบบของเรา ซึ่งมันก็จะมีวิธีการ แต่ขอเอาไว้อธิบายคราวหน้า

ยังไม่แกะจากถุงเลย C2960




อีกมุมของ C2950

ต่อด้วย console


แล้วก็เสียบปลั๊ก show running ซะหน่อย

Switch#sh run
Building configuration...

Current configuration : 1208 bytes
!
version 12.2
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname Switch
!
!
no aaa new-model
system mtu routing 1500
ip subnet-zero
!
!
!
!
no file verify auto
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
interface FastEthernet0/1
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!        
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
 no ip address
 no ip route-cache
 shutdown
!
ip http server
!
control-plane
!
!
line con 0
line vty 5 15
!
end

Switch# 
จะเห็นว่า spanning-tree protocol เปิดใช้งานอยู่ ว่าแล้วก็ทดสอบกันดีกว่าจะถ้ามัน Block จะเป็นยังไง
จัดการเอา สาย UTP loopback เข้า port 1 และ port 2 ซะเลย


เสียบแล้ว port 1 สีเขียว port 2 สีส้ม ซึ่ง STP มันทำงานถูกต้อง อะอะ confirm ซะหน่อยด้วย command

Switch#sh spanning-tree

VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     xxxx.xxxx.xxxx
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     xxxx.xxxx.xxxx
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 15

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1            Desg FWD 19        128.1    P2p
Fa0/2            Back BLK 19        128.2    P2p
 Spanning-tree protocol == STP นะ

 ยังไม่จบครับต่อไปเราจะมาดูว่า ถ้า STP ไม่ทำงาน ที่เค้าว่าจะเกิด broadcast stomming มันเป็นอย่างไร ว่าแล้วก็จะการ set ip ให้ vlan ก่อนแล้ว จากนั้นก็ disable STP ซะเลย

Switch(config)#int vlan 1
Switch(config-if)#ip add
Switch(config-if)#ip address 192.168.1.1 255.255.255.0
Switch(config-if)#no shut
Switch(config-if)#end
Switch#sh pr
00:18:04: %SYS-5-CONFIG_I: Configured from console by consoleo cp
00:18:05: %LINK-3-UPDOWN: Interface Vlan1, changed state to up
00:18:06: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed st             
Switch#
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.         
Switch(config)#no spanning-tree vlan 1
Switch(config)#end
Switch#
00:15:19: %SYS-5-CONFIG_I: Configured from console by console


พอ disable stp ปุ๊บ port1 กับ 2 ก็อับเลย แต่ยังไม่ทันไร โอ้ ไฟกระพิบตลอดเลย พิมพ์ command เริ่มช้าขึ้น

ไฟกระพริบตลอด

ไหนดูซิว่ากิน cpu เท่าไหร่
Switch#sh pro cpu his
                                                             
    888888866666                                             
    8888888111114444444444444444444444444444444444444444444444
100                                                          
 90 *******                                                  
 80 *******                                                  
 70 *******                                                  
 60 ************                                             
 50 ************                                             
 40 ************                                             
 30 ************                                             
 20 ************                                             
 10 ************                                             
   0....5....1....1....2....2....3....3....4....4....5....5....
             0    5    0    5    0    5    0    5    0    5   
               CPU% per second (last 60 seconds)
                                                             
       18898   1   13                                        
    45419808544157522                                        
100                                                          
 90     *##*                                                 
 80     *##*                                                 
 70     *##*
เต็มๆครับ เกือบ 100%

command สุดท้าย ดูว่าที่ port1 กับ port2 นั้นได้ frame อะไรบ้าง

Switch#sh int fastEthernet 0/1 controller
FastEthernet0/1 is up, line protocol is up (connected)
  Hardware is Fast Ethernet, address is xxxx.xxxx.xxxx (bia xxxx.xxxx.xxxx)
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
     reliability 255/255, txload 109/255, rxload 109/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 100Mb/s, media type is 10/100BaseTX
  input flow-control is off, output flow-control is unsupported
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:00, output 00:00:00, output hang never
  Last clearing of "show interface" counters 00:05:24
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 43107000 bits/sec, 84180 packets/sec
  5 minute output rate 43107000 bits/sec, 84180 packets/sec
     30631435 packets input, 1960413720 bytes, 0 no buffer
     Received 30631403 broadcasts (0 multicasts)
     0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     0 watchdog, 27 multicast, 0 pause input
     0 input packets with dribble condition detected
     30772911 packets output, 1969468120 bytes, 0 underruns
     0 output errors, 0 collisions, 0 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier, 0 PAUSE output
     0 output buffer failures, 0 output buffers swapped out

     Transmit FastEthernet0/1                 Receive
   3675332078 Bytes                       3675321838 Bytes                   
           93 Unicast frames                      93 Unicast frames          
          241 Multicast frames                    82 Multicast frames        
     57426628 Broadcast frames              57426627 Broadcast frames        
            0 Too old frames                    5952 Unicast bytes           
            0 Deferred frames                  10828 Multicast bytes         
            0 MTU exceeded frames         3675304192 Broadcast bytes         
            0 1 collision frames                   0 Alignment errors        
            0 2 collision frames                   0 FCS errors              
            0 3 collision frames                   0 Oversize frames         
            0 4 collision frames                   0 Undersize frames        
            0 5 collision frames                   0 Collision fragments     
            0 6 collision frames      
            0 7 collision frames            57426785 Minimum size frames     
            0 8 collision frames                   0 65 to 127 byte frames   
            0 9 collision frames                   0 128 to 255 byte frames  
            0 10 collision frames                 18 256 to 511 byte frames  
            0 11 collision frames                  0 512 to 1023 byte frames 
            0 12 collision frames                  0 1024 to 1518 byte frames
            0 13 collision frames                  0 Overrun frames          
            0 14 collision frames                  0 Pause frames            
            0 15 collision frames     
            0 Excessive collisions                 0 Symbol error frames     
            0 Late collisions                      0 Invalid frames, too large
            0 VLAN discard frames                  0 Valid frames, too large 
            0 Excess defer frames                  0 Invalid frames, too small
     57426914 64 byte frames                       0 Valid frames, too small 
           31 127 byte frames         
            0 255 byte frames                      0 Too old frames          
           18 511 byte frames                      0 Valid oversize frames   
            0 1023 byte frames                     0 System FCS error frames 
            0 1518 byte frames                     0 RxPortFifoFull drop frame
            0 Too large frames        
            0 Good (1 coll) frames    
            0 Good (>1 coll) frames   

Switch#sh int fastEthernet 0/2 controller
FastEthernet0/2 is up, line protocol is up (connected)
  Hardware is Fast Ethernet, address is xxxx.xxxx.xxxx (bia xxxx.xxxx.xxxx)
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
     reliability 255/255, txload 112/255, rxload 112/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 100Mb/s, media type is 10/100BaseTX
  input flow-control is off, output flow-control is unsupported
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:12, output 00:00:00, output hang never
  Last clearing of "show interface" counters 00:05:37
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 44542000 bits/sec, 86981 packets/sec
  5 minute output rate 44542000 bits/sec, 86981 packets/sec
     32329170 packets input, 2069068760 bytes, 0 no buffer
     Received 32329136 broadcasts (0 multicasts)
     0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     0 watchdog, 27 multicast, 0 pause input
     0 input packets with dribble condition detected
     32470493 packets output, 2078113368 bytes, 0 underruns
     0 output errors, 0 collisions, 0 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier, 0 PAUSE output
     0 output buffer failures, 0 output buffers swapped out

     Transmit FastEthernet0/2                 Receive
   3781367662 Bytes                       3781377710 Bytes                   
           95 Unicast frames                      95 Unicast frames          
           82 Multicast frames                   241 Multicast frames        
     59083591 Broadcast frames              59083589 Broadcast frames        
            0 Too old frames                    6080 Unicast bytes           
            0 Deferred frames                  21004 Multicast bytes         
            0 MTU exceeded frames         3781349760 Broadcast bytes         
            0 1 collision frames                   0 Alignment errors        
            0 2 collision frames                   0 FCS errors              
            0 3 collision frames                   0 Oversize frames         
            0 4 collision frames                   0 Undersize frames        
            0 5 collision frames                   0 Collision fragments     
            0 6 collision frames      
            0 7 collision frames            59083908 Minimum size frames     
            0 8 collision frames                   0 65 to 127 byte frames   
            0 9 collision frames                   0 128 to 255 byte frames  
            0 10 collision frames                 18 256 to 511 byte frames  
            0 11 collision frames                  0 512 to 1023 byte frames 
            0 12 collision frames                  0 1024 to 1518 byte frames
            0 13 collision frames                  0 Overrun frames          
            0 14 collision frames                  0 Pause frames            
            0 15 collision frames     
            0 Excessive collisions                 0 Symbol error frames     
            0 Late collisions                      0 Invalid frames, too large
            0 VLAN discard frames                  0 Valid frames, too large 
            0 Excess defer frames                  0 Invalid frames, too small
     59083720 64 byte frames                       0 Valid frames, too small 
           31 127 byte frames         
            0 255 byte frames                      0 Too old frames          
           18 511 byte frames                      0 Valid oversize frames   
            0 1023 byte frames                     0 System FCS error frames 
            0 1518 byte frames                     0 RxPortFifoFull drop frame
            0 Too large frames        
            0 Good (1 coll) frames    
            0 Good (>1 coll) frames   
Switch#
 Broadcast frame ทั้งนั้นเลย ถ้าเราใช้งานจริงถ้าเกิด broadcast stomming มาละก็ switch เราแทบไม่ได้ส่ง ข้อมูล จริงเลยส่งแต่ Broadcast frame

ไม่มีความคิดเห็น:

แสดงความคิดเห็น