2013年4月29日 星期一

Cisco無線AP與Controller的互聯方式

準備工作:
       進入到AP console,設定AP的IP address==>


In a new installation, when a LAP is unable to find a WLC using the discovery algorithms, you can statically configure the information necessary to join a controller via the console port and the AP’s CLI. Refer to Lightweight AP (LAP) Registration to a Wireless LAN Controller (WLC) for more information on the WLC discovery algorithms and the LAP registration process.
In order to manually configure static information on a LAP using the AP CLI interface, you can use these EXEC mode CLI commands:
AP#capwap ap ip address <IP address> <subnet mask>

AP#capwap ap ip default-gateway <IP-address>

AP#capwap ap controller ip address <IP-address>

AP#capwap ap hostname <name>
  (optional)


=======================================================================

最近常有機會在不同的環境將thin ap 加入controller裡面好讓controller控制,方法很多,到底環境要用什麼樣的方式來加呢?先了解ap如何與controller溝通,再依不同的環境選合適的方式。

Cisco 瘦AP加入Controller的順序依序如下:
1.區域廣播(Local IP Subnet Discovery):
原理:先用廣播的方式,找到環境內的Controller,也就是thin AP與Controller在同一個網段裡,這是最快也最簡單的方式。
方法:只要把AP插上電與網路即可。

2.空中廣播Over The Air Provisioning(OTAP):
原理:當從網路線上廣播找不到controller時,第二步透過空氣中的無線電廣播,找尋有沒有其它ap已經有controller的資訊,有的話就跟著去找到Controller
方法: 把AP放置在已加入controller的thin ap 附近。

3.Locally Stored Controller IP Address:
原理:如果從空氣中找不到其它AP的訊號,第三步就是找尋自已AP內是不是有設定過Controller的資訊?Controller 的IP地址,有的話即透過此IP地址去找Controller
方法:以console線接到ap,從CLI輸入下列指令
lwapp ap controller ip add x.x.x.x
上面指令即是告訴AP controller在哪裡,如果環境沒有dhcp先配方ip的話,需要先設定ip給thin ap,指令如下:
lwapp ap ip address x.x.x.x x.x.x.x

4. DHCP option 43:
原理:如果AP本身沒有設定Controller的IP資訊,接下來即找尋DHCP的option43資訊,是否有設定controller的位址,有的話即套用此IP位址與controller溝通
方法: 以cisco switch為例,設定dhcp 的option如下:
ip dhcp pool wireless
   network 192.168.1.x 255.255.255.0
   dns-server 192.168.1.x
   default-router 192.168.1.254
   option 43 hex f104.c0a8.a202
簡單說明option 43,option43是16進制的IP位址,所以在option43之前需指定hex(16進),而這16進的號碼是由Type + Length + Value 所組成。Type比較簡單,永遠是0xF1,只取F1為開頭。而Length就看有設定多少個IP位址,以IPv4來說,192.168.10.5是一個IP有四段,所以length為4,如果是兩個ip,比如192.168.10.5與192.168.10.6有兩個IP, length為8。最後Value就是把IP位址改成16進。
下面的例子是把192.168.10.5與192.168.10.20這兩個controller ip設定成option 43的格式:
option 43 hex f108c0a80a05c0a80a14

5. DNS Discovery:
原理:最後,DHCP沒設定option 43的話,就是看DNS有沒有指定Controller在哪?有的話即進行與controller的溝通。
方法: 即是在DNS上加入一比Recorder ,如下:
 CISCO-CAPWAP-CONTROLLER.localdomain  10.0.0.1
後面的localdomain為環境的網域名稱,上面紅色的部份是ap會找尋的固定名稱,需要一樣


當跑完上面五個流程都沒找到,就會從頭再來一次,直到找到controller為止,因為…thin AP沒辦法像FAT AP能夠勇敢、單獨的存在著。

所以可以簡單的把Thin AP 加入Controller的方式概分為兩種環境:
1.同一個網段裡: 這是最簡單的,即上面介紹的第一種方式區域廣播,只需要確認ap有電、有網路線即可。
2.不同網段裡:跨網段可以從上面2~4方式選一種,以簡單方便為主。




2013年2月24日 星期日

關於VMWare ESX裡面的網路(轉載)

很不錯的一篇文章,轉載自 http://www.weithenn.org/cgi-bin/wiki.pl?VMware_Networking


vNetwork 介紹

vNetwork 支援二種 Virtual Switch 也就是 Standard Switches (VSS) 及 Distributed Switches (VDS),而 vNetwrok 提供三種網路服務存取型態 Virtual Machine Port Group、VMKernel Port、Service Console Port
  1. VSS、VDS: 用於 VM 與 VM 之間溝通或 VM 與實體 Switch 溝通之用
    1. vNetwork Standard Switches (VSS) 無法跨 Host 使用
    2. vNetwork Distributed Switches (VDS) 可以跨 Host 使用 (Enterprise Plus 版本才有支援此功能),且當 VM 透過 VMotion 機制移轉至其它台 Host 時原先在虛擬交換器針對 VM 所做的設定,仍然會自動套用到該 Host 上
虛擬網路 (vNetwork): vSwitch 支援下列三種連線類型
  1. Virtual Machine: VM,也就是給虛擬機器 VM 連接使用並搭配後續談到的 Port Group 使用
  2. VMKernel: vmknic,需要連接 iSCSI、NFS 等 IP Storage 及後續談到的進階功能 vMotion 時使用 (ESXi 稱為 Management Network)
  3. Service Console: vswif,安裝完 ESX Host 後與外界溝通的唯一管道用於 vSphere Client 連入時及後續談到的進階功能 HA (HA Heartbeat) 時使用 (只有 ESX Host 才有 Service Console 若是安裝 ESXi 則無)

vSwitch 介紹

  • vSwitch 提供 VM 與實體網路交換資訊的能力
  • vSwitch 可配合指定 多片 實體網路卡 (UpLink) 來達到頻寬的負載平衡 (Balances Traffic) 及容錯 (Failover) 也就是 NIC Teaming 功能
  • vSwitch 建立時預設會提供 56 Ports (最大值 4088 Ports) VM 及實體網卡 (UpLink) 存取使用, ESX / ESXi 顯示預設值為 24 Ports,若更改 vSwitch Ports 設定值則必須將 ESX / ESXi Host 重新啟動才會套用新的設定值
  • 建立 vSwitch 時若 不勾選任何 vmnic 則表示屆時連接此 vSwitch 的 VM  與實體網路卡 (UpLink) 介接也就是只能 VM 與 VM 之間互通,例如可使用於該 VM 是 NAT Client 環境下
  • vSwitch 上面沒有接任何 VM 但有連接實體網路卡 (Up Link) 時表示用於 VMkernel 之用通常使用於 VMotion 或 IP-SAN(iSCSI) 連接之用且不與 VM 共用實體網路頻寬
  • 每一台 Host 最多可以建立 248 台 vSwitch (VI3 則為 127 台)
  • 每一台 vSwitch 上面皆可切出多個 Port Group 出來,例如 VLAN、頻寬管理...等用途
  • 若要支援 Jumbo Frames 則請將 MTU 數值設定為 9000,而 ESXi 則只有及上運作的 VM 能進行設定 ESXi Host 本身無法進行設定。
了解上述 vSwitch 特性後我們可知您可將不同功能用途例如 iSCSI、VMotion、VM、Service Console 都放在同一個 vSwitch 上也可放在不同的 vSwitch 上,至於何種方式比較好則必須視實際環境、流量負載、傳輸效能而定因為二種方式各有其優缺點。
舉例來說若一台 Host 上有三張實體網路卡,若將 iSCSI、VMotion、VM、Service Console 都放在同一個 vSwitch 上或不同 vSwitch 上大致可想得到的優缺點為
  • 同一個 vSwitch: 由於多張實體網路卡指定給同一個 vSwitch 後將具有頻寬的負載平衡 (Balances Traffic) 及容錯 (Failover) 功能,因此好處當實體網路發生問題時因為容錯功能發揮將使得連線不致中斷,但缺點就是所有的服務都在同一個 vSwitch 上亂竄互相影響 (雖然可透過 Port Group 設定進行微調)。
  • 不同一個 vSwitch: 好處當然就是相關服務及傳輸都互相隔離,如此一來傳輸效能及品質都將保持一定的水準,但相對來說若實體網路發生問題時服務也將因此中斷。



Port Group

Port Binding 模式

  • Static Binding: 表示對應一個 VM 就佔用一個 Port
  • Dynamic Binding: 表示該 VM Power ON 時才佔用一個 Port 若 VM Power Off 則釋放 Port 出來
  • Ephemeral - no Binding: 表示沒有 Port Binding 功能

限制流入/流出流量

Distributed Switches (VDS) 支援網路流量 流入 Inbound / 流出 Outbound 的限制,而 Standard Switches (VSS) 僅支援 網路流量 流出 Outbound 的限制
  • Ingress: 即 Traffic Inbound (流入)
  • Dgress: 即 Traffic Outbound (流出)

Security

  • Promiscuous Mode: 是否啟用網卡混亂模式,也就是開啟網卡監聽功能
  • MAC Address Changes: 是否允許 VM 能更改 MAC Address
  • Forged Transmits: 是否啟用阻擋 VM 所送出的封句 (通常配合 Application 進行設定)

VLANs

VLAN 在虛擬環境下有三種不同的方式:
  • VST (Virtual Switch Tagging): 虛擬 vSwitch 進行 tagged 及 untagged,由虛擬 vSwitch 來定義 VLAN 而實體 Switch 不作任何 VLAN 設定 (也就是實體網卡 Uplink Port 必須接至實體 Switch 的 Trunk Port),由於 vSwitch 的 VLAN 是由 VMkernel 來執行 tagged 及 untagged 的動作因此對於 Host 效能有一定程度影響。
  • VGT (Vitual Guest Tagging): VM (Guest OS) 進行 tagged 及 untagged,由 VM 本身自行設定 VLAN 通常很少使用此方式。
  • EST (External Switch Tag): 實體 Switch 進行 tagged 及 untagged,由實體 Switch 設定 VLAN 而 VM 及 vSwitch 不作任何 VLAN 設定,也就是 VM 從哪個 Uplink Port 至實體 Switch 即屬於該 VLAN。
  • PVLAN (Private VLAN): 也就是 VLAN 中又有 VLAN,有如下三種模式 (VDS 才支援,VSS 未支援此功能)
    • Promiscuous: VM E 及 VM F 可互通,同時也可跟 VM ABCD 互通
    • Isolated: VM C 及 VM D 不會通,跟 VM AB 不通,但跟 VM EF 可互通
    • Community: VM A 及 VM B 可互通,跟 VM CD 不通,但跟 VM EF 會通
Community (PVLAN 17)Isolated (PVLAN 155)Promiscuous (PVLAN 5)
VM AVM BVM CVM DVM EVM F
vDS
Primary PVLAN 5

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

2013年1月4日 星期五

Spanning Tree Link Type and lt's applications...

分成兩種Type: P2p and Shared

P2p link type指的是port為full duplex,通常在STP的過程中會比較快收斂;
而Shared指的是half duplex( 也可設定spanning-tree link-type shared   ),在STP過程中收斂較慢。

Loop Guard使用原則:

1. Loop Guard用在跟其他鄰近Switch連接的port (non-edge port)上

2.不要在Portfast port上同時使用Loop Guard,反之亦然 (跟第一點的描述相同,就是接edge
   device的port上不要啟用loop guard);而因為dynamic vlan port(通常就是edge port)上需要該
   port為portfast,所以也不建議在dynamic vlan port上設定loop guard。

3.不要在link type是shared的port上使用loop guard

4.不要在同一個port上同時使用loop guard和root guard

5.建議在access switch的root port和alternate root port(目前是blocked port)上設定loop guard

Root guard是強行指定某個port為root port。


RSTP (802.1w)的運行過程中不使用到任何timer做參數,而是使用link type和edge port

2013年1月1日 星期二

802.11N MIMO的spatial stream

802.11N MIMO的spatial stream指的是802.11N所使用的天線中所形成的傳輸空間,這些空間分成transmit、receive、transmit and receive,每一台AP所能夠使用的傳輸空間不同,大致上可分為以下幾種:

1x1:1 - 1 transmitter, 1 receiver, can transmit or receive 1 spatial stream

1x2:1 - 1 transmitter, 2 receivers, can transmit 1 spatial stream, but receive 2 spatial streams

2x2:2 - 2 transmitters, 2 receivers, can transmit and receive 2 spatial streams

2x3:2 - 2 transmitters, 3 receivers, can transmit and receive 2 spatial streams

3x3:2 - 3 transmitters, 3 receivers, can transmit and receive 2 spatial streams

3x3:3 - 3 transmitters, 3 receivers, can transmit and receive 3 spatial streams

4x4:4 - 4 transmitters, 4 receivers, can transmit and receive 4 spatial streams

不同的傳輸空間所能夠提供的傳輸速度大概有300 Mbps (2x2:2), 450 Mbps (3x3:3), and 600 Mbps (4x4:4).

使用Spanning Tree做Layer2 Load Sharing 的運用

使用Spanning Tree最常做的運用就是用來做不同VLAN在不同trunk link上的流量負載分流。
以本案為例,Switch0 Fa0/1<-->Switch1 Fa0/1間 與 Switch0 Fa0/2<-->Switch1 Fa0/2間都是VLAN trunk,我們建立兩個VLAN(VLAN1、VLAN2),原本的Spanning Tree結果,VLAN1和VLAN2的Blocking port會在Switch0的Fa0/2上,我們在Switch0上使用spanning-tree vlan 2 root primary讓vlan2的Root bridge為Switch0,也讓vlan2的blocking port在switch1的fa0/2上。

現在我們希望讓vlan 2的blocking port改成switch1的Fa0/1(當然,也可以讓vlan 2的blocking port也是在switch0上,但為了公平起見,我們希望switch1也有blocking port),在switch上可以調整的設定有兩種:

1.調整port priority
2.調整port cost

以上兩種設定的值一定是調整upstream的switch,在本案例中要改變switch1上的spanning tree port的狀態就要調整switch0(switch0為switch1的upstream、switch1為switch0的upstream)。

設定的方式就是打開原本的blocking port(打開Switch1的Fa0/2)或是block原本相比較的
port(關閉Switch1的Fa0/1)

A.調整port priority

    option1:調整switch0的Fa0/1,讓其port priority的值大於預設值128

    option2:調整switch1的Fa0/2,讓其port priority的值小於預設值128


    option1: Switch0(config)#interface fa 0/1
                 Switch0(config-if)#spanning-tree vlan 2 port-priority 240

   
    option2:Switch1(config)#interface fa 0/2
                Switch1(config-if)#spanning-tree vlan 2 port-priority 0



B.調整port cost

    option1:調整switch0的Fa0/1,讓其port cost的值大於預設值19

    option2:調整switch1的Fa0/2,讓其port cost的值小於預設值19


    option1: Switch0(config)#interface fa 0/1
                 Switch0(config-if)#spanning-tree vlan 2 cost 21

   
    option2:Switch1(config)#interface fa 0/2
                Switch1(config-if)#spanning-tree vlan 2 cost 18