顯示具有 Cisco 標籤的文章。 顯示所有文章
顯示具有 Cisco 標籤的文章。 顯示所有文章

2013年2月20日 星期三

NAT的種類與特性

假設內部位址(Private IP)為N,外部位址(Public IP)為M,NAT的種類分為:

1.Dynamic NAT
   # N個Private IP嘗試從M個Public IP中挑出一個轉址,如果N>M有可能會導致有IP無法轉
      址,另一個缺點是會浪費Public IP,這種情況建議改用PAT
   # NAT timeout可以藉由timeout xlate來改變。
   # 無法提供反向存取,遠端Host無法藉由存取Public IP來存取Private IP,
      但在位址轉換期間,遠端Host有機會嘗試藉由存取Public IP來存取Private IP(前提是
      Security policy有allow),有心攻擊者仍有機會藉由工具達成入侵的目的。


2.PAT
   # M=1,N個Private IP嘗試從1個Public IP中挑出一個轉址,由於只有一個Public IP,所以
      藉由轉換Port(Port Number > 1024)的方式來達到轉址的目的。
      這種方式在某些多媒體運用無法提供正常運作。
   # PAT timeout=30秒,無法改變。
   # 無法提供反向存取,遠端Host無法藉由存取Public IP來存取Private IP,
      但在位址轉換期間,遠端Host有機會嘗試藉由存取Public IP來存取Private IP(前提是
      Security policy有allow),有心攻擊者仍有機會藉由工具達成入侵的目的。

3.Static NAT
   # N=M,提供一對一的轉址
   # 提供反向存取,遠端Host可藉由存取Public IP來直接存取Private IP。
      (在Juniper Firewall上稱為MIP)
   # Static NAT和Dynamic NAT的不同

4.Static PAT
   #提供外部對內部的存取
   #M=1,藉由存取外部IP:port 來直接存取內部IP。 (在Juniper Firewall上稱為VIP)

2013年1月31日 星期四

Cisco Catalyst 2960系列交換器(LAN Base & LAN Lite) Q & A

標題:Cisco Catalyst 2960系列交換器(LAN Base & LAN Lite) Q & A

Q1: 請問2960可以透過IOS軟體升級或降級達到功能的新增或減少嗎?
A1: No2960 不支援軟體相互更新

Q2: 請問2960 LAN Base  LAN Lite 主要的差異在哪裡?
A2: 重點的主要差異如下:
 Gigabit Ethernet connectivity in 8, 24, and 48 port configurations

‧ RPS support and support for a wide range of SFP transceivers

‧ Enhanced security through Layer 2-4 access control lists (ACLs), DHCP Snooping, and more 
  extensive Network Admission Control  capabilities such as Web authentication and 802.1x
  enhancements

‧ Additional QoS capabilities: The LAN Base IOS supports policing, class and policy maps, 
  differentiated services code point (DSCP), AutoQoS, and configurable queue weights, buffers,  
  and thresholds

 Higher network-level availability with features such as Flex Links and Link State Tracking

 Increased number of VLANs (256) and other enhancements such as IPv6 Host, MLD 
  Snooping, LLDP-MED, RSPAN, MVR, DHCP Option 82, and IP SLA (responder)

Q3: 請問哪些是2960 LAN Base  LAN Lite相同功能?
A3: 相同點如下:
 Scalable and secure network management: Secure Shell (SSH), Secure Sockets Layer (SSL),  
  Secure Copy Protocol (SCP), and SNMPv3 crypto

 Network management tool support by CiscoWorks, Cisco Network Assistant, and Catalyst  
  Device Manager

 Baseline Network Admission Control and 802.1x MAC Auth Bypass and Protected Port

 Voice VLAN and voice-aware port security, BPDU Guard, and Root Guard

 Standard QoS with Class of Service (CoS) marking, Shaped Round Robin, Weighted Tail Drop,   
  and Strict Priority scheduling

 Link aggregation using Port Aggregation Protocol (PAgP) and 802.3ad LACP

 Complete Spanning Tree Protocol support via 802.1s, 802.1w, and PVST+

 VLAN Trunking Protocol (VTP), Cisco Discovery Protocol v2, and LLDP

 Multicast support in hardware with IGMP Snooping, Filtering, and Querier

 Troubleshooting and monitoring tools such as TDR, SPAN, and UDLD

2012年8月28日 星期二

Switch上的基本防護功能-Port Security

Cisco Switch上的Port Security功能不是甚麼稀奇的功能,但很少人知道他的用法與細項設定,在此就來談談他的運用。
首先來談談他的運用,包含:

1.防止非單位的終端設備在未授權的情況下任意接入單位網路中。

2.防止單位授權的終端設備但卻接入非該終端設備被授權可以接入的區域(交換器)中

3.非授權的電腦任意建立Virtual Machine (一台VM就會有一組mac address)

一般在設定port security的方式會有以下幾種方式:

方式一:
(config)#interface gigabitethernet 9/10
(config-if)#switchport port-security
(config-if)#switchport port-security maximum 1
(config-if)#switchport port-security 0bdc.1f69.f598
(config-if)#switchport violation shutdown

方式二:

(config)#interface gigabitethernet 9/10
(config-if)#switchport port-security
(config-if)#switchport port-security maximum 1
(config-if)#switchport port-security sticky
(config-if)#switchport violation shutdown

其中,
   >  switchport port-security這個指令就是啟用介面上的port security功能

   >  switchport port-security maximum 1這個指令在指定這一個interface上最多可以有幾個
       mac-address上來,如果大於這一個值就是violation了。

   >  而接下來就是定義mac-address,有以下幾種:

 
         >> Static :  顧名思義就是直接手動設定特定的mac-address,但是設定完之後不會出現
                          在running-config中。如果要讓static mac-address出現在running-config中,需
                          要使用switchport port-security mac-address sticky xxxx.xxxx.xxxx

         >> Dynamic : 這是系統預設使用的方式。只要設備還沒有達到maximum上限
                              而且網路介面尚未學習到該mac-address,該mac-address就會被學習進
                              來,但學習到的mac-address是會被age掉的。

         >> Sticky :  使用這種方式的行為跟dynamic一樣,但不同的是,這種方式會將學習到的
                           mac-address寫入NVRAM中,這樣一來,就算設備重開機,mac-address還
                           是一樣存在,不須重新學習。
                           而sticky學習到的mac-address是不會被age掉。

                           Sticky跟dynamic這兩種功能是互不相容的,如果啟用sticky,dynamic就會
                           被自動關閉,sticky關掉後,dynamic還是會繼續運作。

                           而透過switchport port-security mac-address sticky指令可以將dynamic learning
                            mac-address轉成sticky learning mac-address存到running-config中

                           sticky mac-address雖然可以存在NVRAM中,但是可以手動清除:
                           #clear port-security sticky [interface fax/y]

   > Aging time : Aging time的參數包含:

                        Static: 對於static mac-address啟用aging time
 
                        Time: 設定aging timeout時間

                        Type: 設定aging time類型,有absolute及inactive兩種。absolute是絕對時間,
                                  只要mac-address經過這一段時間就會從mac-address table中消失掉;
                                  inactive是相對時間,只要該mac-address經過這一段時間沒有任何
                                  traffic,就會從mac-address table中清除掉。

   > Violation : 有幾種處理方式==>

                      Protect: 會將secured mac-address以外的mac-address丟棄掉,除此之外幾乎不做
                                   任何動作

                      Restrict: 除了不把interface shutdown之外,會發出snmp trap、violation counting
                                   其他做的事情跟Protect一樣。

                      Shutdown: interface會呈現err-disabled狀態。可以使用以下方式在經過某一段時
                                       間後恢復==>

                                        Cat4507 (config)#errdisable recovery cause psecure-violation
                                        Cat4507 (config)#errdisable recovery interval 30








2012年8月23日 星期四

How to automatically backup Cisco IOS devices configuration file to a TFTP Server...

We can easily backup our Cisco IOS devices configuration files to a TFTP server whenever we issue the "write memory" command. Now how the make it? Follow the steps below:

#
#config term
(config)#archive
(config-archive)#path tftp://172.16.7.100/switch1-
(config-archive)#write-memory
(config)#exit
#write memory

then you will see the configuration file with file name such as "switch1-Aug-23-15-23-17-0",that is
the prefix you defined previously plus the date and time.

Of course, you can also check the startup-config and find that the configuration is also written into the NVRAM.

2012年7月25日 星期三

EtherChannel

      要將兩台Switch之間的連線使用多條線路形成一個trunk通常需要兩台互聯的interface要設定成固定的trunk port (channel-group x mode on, x=ID),如果所處的兩台switch環境是在異地,如果沒有事先設定好,或是兩台switch已經安裝好但需更改架構,除非兩頭都有網管人員同時設定,如果只有一個網管人員時必須爭取時間,先設定完一頭,再趕忙跑到另一頭,以縮短斷線時間。

      但如果使用動態的EtherChannel就可以解決這個問題。目前Cisco Switch上的支援兩種動態的EtherChannel協定,包含Cisco自己的PAgP及標準的802.3ad LACP,如果使用PAgP的話有支援幾種模式,每個模式之間可以形成trunk的搭配方式如下:






如果使用Static Trunking的方式,PAgP與LACP的設定方式如下:

This example shows how to configure an EtherChannel. It assigns two ports as static-access ports in VLAN 10 to channel 5 with the PAgP mode desirable:
Switch# configure terminal Switch(config)# interface range gigabitethernet0/1 -2 Switch(config-if-range)# switchport mode accessSwitch(config-if-range)# switchport access vlan 10
Switch(config-if-range)# channel-group 5 mode desirable
Switch(config-if-range)# end 

This example shows how to configure an EtherChannel. It assigns two ports as static-access ports in VLAN 10 to channel 5 with the LACP mode active
Switch# configure terminal 
Switch(config)# interface range gigabitethernet0/1 -2 
Switch(config-if-range)# switchport mode access
Switch(config-if-range)# switchport access vlan 10
Switch(config-if-range)# channel-group 5 mode active
Switch(config-if-range)# end 

Summary:

EtherChannel Modes 

Mode Description

on

Mode that forces the LAN port to channel unconditionally. In the on mode, a usable EtherChannel exists only when a LAN port group in the on mode is connected to another LAN port group in the on mode. Because ports configured in the on mode do not negotiate, there is no negotiation traffic between the ports.


auto

PAgP mode that places a LAN port into a passive negotiating state in which the port responds to PAgP packets it receives but does not initiate PAgP negotiation.


desirable

PAgP mode that places a LAN port into an active negotiating state in which the port initiates negotiations with other LAN ports by sending PAgP packets.


passive

LACP mode that places a port into a passive negotiating state in which the port responds to LACP packets it receives but does not initiate LACP negotiation.


active

LACP mode that places a port into an active negotiating state in which the port initiates negotiations with other ports by sending LACP packets.

LAN ports can form an EtherChannel when they are in different PAgP modes if the modes are compatible. For example:

YA LAN port in desirable mode can form an EtherChannel successfully with another LAN port that is in desirable mode.

YA LAN port in desirable mode can form an EtherChannel with another LAN port in auto mode.

NA LAN port in auto mode cannot form an EtherChannel with another LAN port that is also in auto mode because neither port initiates negotiation.





LAN ports can form an EtherChannel when they are in different LACP modes as long as the modes are compatible. For example:

YA LAN port in active mode can form an EtherChannel successfully with another LAN port that is in active mode.
YA LAN port in active mode can form an EtherChannel with another LAN port in passive mode.
NA LAN port in passive mode cannot form an EtherChannel with another LAN port that is also in passive mode, because neither port initiates negotiation.


關於Cisco Switch上CDP-4-NATIVE_VLAN_MISMATCH問題...

類似:
00:02:29: %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on GigabitEthernet0/1 (10), with Switch GigabitEthernet0/8 (1)
的訊息在新裝機的環境上常常遇到,而會出現這個問題的來源是開了CDP,CDP的封包內容中有包含一些資訊:VTP management domain name、full/half duplex、native vlan等,如果兩台switch之間是跑trunk mode就不會出現這個問題(不需要特別設定switchport mode access的情況下),但如果我們有好習慣,在界接裝端設備的switch port介面下switchport mode access,就會出現CDP-4-native_vlan-mismatch,但CDP的內容又會因為IOS版本不同所包含的欄位也會不同,以上的內容在IOS 12.0(3)版以後才有支援,這以後的CDP稱為CDP v2,所以在這之前的舊版本是不會出現的。所以要停止 CDP-4-native_vlan-mismatch這個訊息出現的方法有以下幾種:


1.在switch上下no cdp advertise-v2,強制兩台switch的CDP跑version 1

2.不要特別去下switchport mode access這個指令,讓介面自己跑trunk
   (show interface gi x/y capabilities可以看到Operational Mode:trunk)

3.如果一定要下switchport mode access,那只好再明確的指定與uplink port相同的vlan上,
   例如:uplink port是接到core switch上的vlan 10,所以每一個port也要access到vlan 10

2012年6月18日 星期一

Cisco Switch自動安裝與設定


準備:
1. DHCP / TFTP Server (Cisco 6500 )
2. Switch config.
3. 架構圖如下.



一、TFTP 存放檔案
network-confg
C2960S1U-confg
C2960S2U-confg
C2960S3U-confg

例:network-confg 內容
ip host C2960S1U 172.16.2.205
ip host C2960S2U 172.16.2.206
ip host C2960S3U 172.16.2.207

二、DHCP Server (C6500) 設定:

ip dhcp pool C2960S1U
 host 172.16.2.205 mask 255.255.0.0
 hardware-address 02c7.f800.1234 ieee802
 default-router 172.16.2.254
 option 150 172.16.2.254
exit

tftp-server flash:network-confg
tftp-server flash:C2960S1U-confg
tftp-server flash:C2960S2U-confg
tftp-server flash:C2960S3U-confg

int vlan 1
no switchport
ip address 172.16.2.254 255.255.0.0
end

三、新C2960接上網路,開機後,即可自動完成設定

Cisco Dynamic ARP Inspection設定方式...

為了防治類似NetCut這種ARP欺騙攻擊或是Man-in-the-Middle攻擊,Cisco Switch在2960以後的Layer 2/3以上switch提供Dynamic ARP Inspection(簡稱DAI)功能,其原理就是將IP-MAC-Port的綁定先寫在Switch內,當switch port下接終端設備發出的網路資訊有違背這一個綁定表時,該port就會被shutdown,syslog也會吐出相關訊息。而這一個綁定表可以透過DHCP option 82的方式,由switch利用DHCP snooping探測DHCP相關資訊後的結果節錄這一張表,可透過tftp將這一張表存在tftp伺服器中,或是由網管人員透過設定的方式將這一張表建立起來,相關設定細節如下:

1.設定DHCP Snooping及DAI


ip dhcp snooping vlan 1-3
ip dhcp snooping database tftp://172.16.7.250/dai.list
ip dhcp snooping

ip arp inspection vlan 2-3
ip arp inspection validate src-mac dst-mac ip
ip arp inspection filter allow_arp vlan  2-3

2.設定Interface
例:g1/0/24  DHCP Server ,設定為 trust,表示不在這一個介面上做DAI
interface GigabitEthernet1/0/24
 ip arp inspection trust
 ip arp inspection limit rate 100
 ip dhcp snooping limit rate 100
 ip dhcp snooping trust

例:其它 port 串接不支援 DAI Switch  Client ,預設開啟DAI時所有的port都是untrust
interface GigabitEthernet1/0/1
 ip arp inspection limit rate 100
 ip dhcp snooping limit rate 100

3.手動建立綁定表
手動建立 ARP Inspection list
   ip source binding 9876.ed6f .0012 vlan 1 172.16.7.111 interface g1/0/10

4.建立白名單以排除類似印表機、Server等固定設備
arp access-list allow_arp
  permit ip host 172.16.7.11 mac host 0123.5678.de69
  permit ip host 172.16.7.132mac host 0345.5e6f.0911


5.設定一些意外狀況
   DAI可能會因為特殊情況造成port err-disabled,所以設定將這個情況排除:
   errdisable recovery cause arp-inspection
   errdisable recovery interval 45

6.察看結果之相關指令
   查看指令:
   show ip dhcp snooping binding
   sh ip arp inspection interfaces
   sh ip arp inspection statistics
   sh ip arp inspection vlan 1 -3

7.測試結果
    例:netcut 試著去欺騙192.168.1.120  192.168.1.130,因為 Cisco DAI,所以失敗 !!!
    00:58:48: %SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Req) on Gi1/0/21, vlan 1.

                  ([7617.2d 2a .3969/192.168.1.120/0000.0000.0000/192.168.1.130/00:58:47 UTC Mon Mar 1 1993])
    00:58:48: %SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Req) on Gi1/0/21, vlan 1.
                  ([7617.2d 2a .3969/192.168.1.130/0000.0000.0000/192.168.1.120/00:58:47 UTC Mon Mar 1 1993])
    00:58:50: %SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Req) on Gi1/0/21, vlan 1.

   client 啟動 netcut 的同時,client switch port 即被 err-disable

    SW2(config-if)#

    01:14:54: %SW_DAI-4-PACKET_RATE_EXCEEDED: 16 packets received in 8 milliseconds on Gi1/0/18.
    01:14:54: %PM-4-ERR_DISABLE: arp-inspection error detected on Gi1/0/18, putting Gi1/0/18 in err-disable state
    01:14:55: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/18, changed state to down
    01:14:56: %LINK-3-UPDOWN: Interface GigabitEthernet1/0/18, changed state to down





2012年6月17日 星期日

關於Cisco IOS上DHCP server的設定...

很多人都知道Cisco IOS上可以設定DHCP Server,但可能不知道,給不同的host有不同的設定方式:

1.給一般終端設備
   ip dhcp excluded-address 10.10.10.0 10.10.10.50
   !
    ip dhcp pool Vlan1
      network 10.10.10 .0 255.255.255.0
      default-router 10.10.10.1
      dns-server 10.10.1.102 10.10.10.102
      netbios-name-server 10.10.1.103 10.10.10.103
      netbios-node-type h-node

 2.給特定一台終端設備
   ip dhcp pool Hammer
       host 10.10.10.100 mask 255.255.255.0
       hardware-address 02c7.f800.1234 ieee802
       client-name Hammer
       default-router 10.10.10.100 10.10.10.101
       domain-name lab.com
       dns-server 10.10.1.102 10.10.10.102
       netbios-name-server 10.10.1.103 10.10.10.103
       netbios-node-type h-node

3.給Cisco交換器
   ip dhcp pool Switch1
       host 10.10.10.200 mask 255.255.255.0
       hardware-address 06c8.f800.5678 ieee802
       client-name Switch1
       default-router 10.10.10.100 10.10.10.101

Cisco Remote command switch...

Cisco指令通常都會直接照著原廠的指令下,但遇到在troubleshoot問題時有些進階指令可以幫助我們,例如,可能會遇到開不了機的情況,導致畫面停留在rommon mode下,但是,show version的結果可能會是正常的:


C6513A #show verion      
Configuration register is 0x2102


以上結果只是Layer 3(Route Processor)的結果,如果我們下指令remote command switch show version

C6513A #remote command switch show verion      
Configuration register is 0x2142

我們就可以看到Layer 2 (Switch Processor)的結果,發現根本就是不對的