Cisco Switch Port Security

Aus xinux.net
Zur Navigation springen Zur Suche springen

Einstellen Port Fast

Der Befehl dient hier nur dazu das die Reaktionszeit von 30 Sekunden auf sofort umgesetzt wird. Sollte man nur an Switchendgeräten so einstellen.

  • switch-gelb(config)#spanning-tree portfast default

Einstecken in Port Fa1/0/5

  • switch-gelb#show mac address-table
...
10    001c.25a1.aee4    DYNAMIC     Fa1/0/5
...

Einstellen der Port Security

  • switch-gelb#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
  • switch-gelb(config)#interface Fa1/0/5
  • switch-gelb(config-if)#switchport port-security

Command rejected: FastEthernet1/0/5 is a dynamic port.

Port muss im Access oder Trunk Mode sein

  • switch-gelb(config-if)#switchport mode access
  • switch-gelb(config-if)#switchport port-security
  • switch-gelb(config-if)#end

Type wechselt von dynamic auf static

Von Portsecurity registriert

  • switch-gelb#show mac address-table
...
10    001c.25a1.aee4    STATIC      Fa1/0/5
...

Feste Mac Adresse vogeben

  • switch-gelb#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
  • switch-gelb(config)#interface Fa1/0/5
  • switch-gelb(config-if)#switchport port-security mac-address 0012.3456.789a
Total secure mac-addresses on interface FastEthernet1/0/5 has reached maximum limit.

Das liegt daran das man per default nur 1 Mac Adresse zu vergeben ist.

Wir wechseln zu einem anderen Port

  • switch-gelb#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

  • switch-gelb(config)#interface Fa1/0/4
  • switch-gelb(config-if)#switchport port-security
  • switch-gelb(config-if)#switchport port-security mac-address 0012.3456.8888

Eintrag in der Running Config

  • switch-gelb(config-if)#do show run int Fa1/0/4
Building configuration...

Current configuration : 139 bytes
!
interface FastEthernet1/0/4
 switchport access vlan 10
 switchport mode access
 switchport port-security mac-address
 switchport port-security mac-address 0012.3456.8888
end

Einstöpseln eines anderen Computers

  • switch-gelb(config-if)#do show mac address-table
...
0001.2e34.b06a    STATIC      Fa1/0/5
...

Der Zustand an diesem Port ist momentan ermöglich es das genau eine beliebige Mac Addresse über ihn kommuniziert. Es ist ist nicht möglich einen Home Office Switch anzuschliessen mit mehreren Geräten.

Sticky Mode setzen

Die erste Mac Adresse die kommt wird registiert.

  • switch-gelb(config-if)#switchport port-security mac-address sticky

Danach ping absetzen

  • switch-gelb(config-if)#do show run int Fa1/0/5
Building configuration...

Current configuration : 217 bytes
!
interface FastEthernet1/0/5
 switchport access vlan 10
 switchport mode access
 switchport port-security
 switchport port-security mac-address sticky
 switchport port-security mac-address sticky 0001.2e34.b06a
end

Umstecken und Pingen - Port gehte in Status err-disabled

  • switch-gelb#show interfaces FastEthernet1/0/5 status
Port      Name               Status       Vlan       Duplex  Speed Type
Fa1/0/5                      err-disabled 10           auto   auto 10/100BaseTX

Umstecken reaktivieren des Ports

  • switch-gelb#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
  • switch-gelb(config)#interface Fa1/0/5
  • switch-gelb(config-if)#shutdown
  • switch-gelb(config-if)#no shutdown
  • switch-gelb(config-if)#do show interfaces FastEthernet1/0/5 status
Port      Name               Status       Vlan       Duplex  Speed Type
Fa1/0/5                      connected    10         a-full  a-100 10/100BaseTX

Anzeigen der Port Security

  • switch-gelb#show port-security
Secure Port  MaxSecureAddr  CurrentAddr  SecurityViolation  Security Action
                (Count)       (Count)          (Count)
---------------------------------------------------------------------------
    Fa1/0/3              1            0                  0         Shutdown
    Fa1/0/5              1            1                  0         Shutdown
---------------------------------------------------------------------------
Total Addresses in System (excluding one mac per port)     : 0
Max Addresses limit in System (excluding one mac per port) : 6144

Anzeigen der Port Securitydes Interfaces

switch-gelb#show port-security int Fa1/0/5  
Port Security              : Enabled
Port Status                : Secure-up
Violation Mode             : Shutdown
Aging Time                 : 0 mins
Aging Type                 : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses      : 1
Total MAC Addresses        : 1
Configured MAC Addresses   : 0
Sticky MAC Addresses       : 1
Last Source Address:Vlan   : 001c.25a1.aee4:10
Security Violation Count   : 0

Einstellen des Port Security violation auf restrict

  • switch-gelb#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
  • switch-gelb(config)#interface Fa1/0/5
  • switch-gelb(config-if)#switchport port-security violation restrict

Wieder Umstecken auf das unerlaubte Gerät

  • switch-gelb(config-if)#do show port-security int Fa1/0/5
Port Security              : Enabled
Port Status                : Secure-up
Violation Mode             : Restrict
Aging Time                 : 0 mins
Aging Type                 : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses      : 1
Total MAC Addresses        : 1
Configured MAC Addresses   : 0
Sticky MAC Addresses       : 1
Last Source Address:Vlan   : 001c.25a1.aee4:10
Security Violation Count   : 17

Anzeigen der Port Security aus Address sicht

  • switch-gelb#show port-security address
          Secure Mac Address Table
------------------------------------------------------------------------
Vlan    Mac Address       Type                     Ports   Remaining Age
                                                              (mins)    
----    -----------       ----                     -----   -------------
  10    0012.3456.8888    SecureConfigured         Fa1/0/4      -
  10    0001.2e34.b06a    SecureSticky             Fa1/0/5      -
------------------------------------------------------------------------
Total Addresses in System (excluding one mac per port)     : 0
Max Addresses limit in System (excluding one mac per port) : 6144

Links