星期三, 2月 15, 2012

Layer 4 switches 第四層網路交換器


Layer 4 switches

What Is Layer 4 Switching


http://www.google.com.tw/url?sa=t&rct=j&q=layer+4+switch&source=web&cd=6&ved=0CGIQFjAF&url=http%3A%2F%2Fwww.nanog.org%2Fmeetings%2Fnanog15%2Fpresentations%2Falteon.ppt&ei=tR87T-msKqXwmAWmx-G8Cw&usg=AFQjCNElDxyg3tBFGAz-dMAFGNbnFzm2Bw&sig2=V-PQY6xEFy587Ru27IbfNQ

Layer 4 Switching



Introduction

As networks have evolved and new technologies have emerged, multi-layer capable switches have become a popular alternative to the traditional hub, bridge or layer 2 switch. Layer 4 switching refers to an added feature and capability of Layer 3 switches. It enhances their ability to control and forward network traffic based on the information that can be derived from protocols that operate at Layer 4 of the OSI model. (For an overview of the OSI model, click here.)
Before discussing Layer 4 switches, Layer 2 and 3 capable switches should be mentioned. Traditional switches use hardware to forward network traffic at Layer 2, based on the physical MAC address of each network device. These operate very quickly and are an efficient means of handling network transmissions within LANs. Basically, it is like having a bridge, which learns, filters and forwards based on the MAC address, operate on every single port. In this way, they also reduce the amount of data that will be forwarded to the routers.
On the other hand, switches that operate at Layer 3 (similar to routers), actually calculate routes based on the logical address that is assigned by software to the data packet (such as IP addresses). Similar to routers, they have the ability to connect WANs and are more intelligent devices that can further segment network traffic to reduce congestion by calculating routes between various network links. Unlike traditional routers, which implement this technology through software and a general purpose processor that tends to have a slower data throughput, switches can perform these operations at full wire speeds. Because of increasingly advanced technology, especially in producing more advanced ICs, and especially ASICs (Application Specific Integrated Circuits), multi-layer switches are able to combine the speed and efficiency of Layer 2 switching with Layer 3 routing using a hardware implementation. This wirespeed routing technology uses hardware to perform the same functions of traditional routers, routing each packet individually, offering the advantage of being non-proprietary, and also providing the advantage of high speed communications and data throughput.
Layer 4, the Transport layer, which takes care of things like flow control and reliable and accurate delivery of the data to the next layer, uses protocols such as TCP and UDP. These protocols include the port number information in the header, which helps identify what application the packet is being used by or is intended for. This information can be very useful in handling network traffic because many well known applications use designated ports. For example, port 80 is generally used by HTTP, and ports 20 and 21 by FTP. (Click here to view a listing of the well known ports.) Because a Layer 4 switch can identify this information, together with the IP address that is identified on Layer 3, it not only knows where the data needs to go, but also what application will use it. The combination of a Layer 4 TCP or UDP port number and the Layer 3 address is called a socket.
This information can be used to enhance the features of a Layer 3 switch, which essentially performs packet routing at high speeds by means of hardware, by allowing it to filter network traffic and perform switching based on the application the data is intended for. So, a Layer 4 switch has the ability to not only examine the IP address, but also to control the traffic based on the port numbers located at Layer 4 of the OSI model.

Packet Filtering and Prioritization

This gives Layer 4 switches the ability to implement a variety of services that take advantage of this application specific information. For example, routers are often used as a network firewall, filtering packets and providing security features by either allowing or blocking certain connections. A Layer 4 switch can offer this same service, but implement it by means of hardware, thus offering the same service with a much higher speed of data throughput.
Layer 4 switches can also use this information to prioritize traffic flow. Because it can see both the port number and IP address of a data packet, it can give priority to data intended for mission critical applications. For example, data intended for the HTTP (port 80) application on a web server can be given higher priority than data intended for another application that may be running on that same server. This provides that application a higher class of service. This can be used to ensure QoS (Quality of Service), which basically refers to a guaranteed throughput level.

Load Balancing

Another service that can be made possible by a Layer 4 switch is load balancing. Load balancing can be implemented to more efficiently control the amount of information that a particular server, among a group of servers supporting the same application, may receive.
For example, a group of physical servers that are being used as a web server farm can all be grouped together into one virtual, or logical, server. The new virtual server, made up of these physical servers, would be assigned just one IP address. Traffic intended for these servers would be directed towards this IP address. A Layer 4 switch can then manage load balancing among the group that makes up the virtual server. The data can be balanced among the servers based on a number of factors. For instance, by keeping track of how many sessions each individual server is supporting, traffic can be forwarded to the server with the least number of sessions. Or, traffic can be distributed based on a percentage. The faster servers can be assigned a higher percentage, and the slower servers can be assigned a smaller percentage of the overall network traffic. These are just a couple of ways this load balancing can be implemented. But in any case, this provides a more efficient means of handling traffic on the network by avoiding overloading any one physical server.
The way that I was able to visualize how this works and make sense of this load balancing feature was by thinking about how traffic lights at a major intersection are programmed and timed. Since the major roadway handles the majority of the traffic, the traffic light for that path is set to have a larger portion of time to allow for the traffic to flow. Then, the side streets that pour into that road are given a smaller percentage of time, based on how much traffic they produce. Of course, this method of balancing the timing of the lights based on traffic needs makes more sense than giving each light an equal amount of time. And so to me, this is why it makes sense for a network to make use of load balancing as well.

Conclusion

Based on this research, Layer 4 switching technology greatly enhances the intelligence of the network. It allows the switch to make specific, intelligent decisions based on the information it derives from both Layers 3 and 4 so that it can handle this data in the most efficient way. One of the greatest benefits of a Layer 4 switch is that this intelligent decision making capability is implemented by means of high speed hardware, thus allowing todays high capacity networks to function very efficiently.
ComTest Technologies proudly represents a number of manufacturers offering multi-layer capapble switches. These include, but are not limited to, the following:
If you would like to contact one of ComTest's engineers to find out more about one of these products, click here.
To learn more about Layer 4 switching, visit these links:

第四層網路交換器之應用
        在區域網路發展上,從最早期的 Hub 到以 MAC 位址為基準的第二層網路交換器,再演進到以 IP/IPX 為基準的第三層網路交換器,目前最新的第四/七層網路交換器,以 TCP/UDP 埠號 ( Port Number)為基準。在應用上提供封包過濾 ( Packet Filitering )、 服務品質 (QoS)、 伺服器負載平衡 ( Server Load Balancing )及透通性快取 ( Transparent Caching )等功能。而針對目前企業網路日益重要,而企業中之網路伺服器更是重要,有如人之心臟一般,如何保持伺服器持續服務、永不停頓是資訊管理人員重要任務之一,單一伺服器無法避免在維修,硬體毀損時停止服務,造成企業人力,金錢等資源的損失。而以硬體方式的第四層網路交換器 ( Layer 4 Switch ),建構一伺服器負載平衡架構 ( Server Load Balancing ),將多部伺服器,連結成一高效能、永不停頓的企業心臟,是現今網路解決方案中重要的一環。
          頻寬也困擾管理人員的一個問題,在一個有限頻寬中,如何善用利用頻寬,第四層網路交換器搭配快取伺服器(Cache Server)提供透通性快取服務 (Transparent Caching Service),將專線發揮到最高的效率。將針對其伺服器負載平衡 ( Server Load Balancing )透通性快取 ( Transparent Caching ) 兩項功能加以探討。

Layer 4 Switching簡介
       在OSI Layer 4傳輸層(Transport Layer)之中有所謂的連接埠(Port),應用程式必需獨佔一個連接埠,當主機收到IP封包之後,就可以藉由連接埠編號,判斷此封包要送給那一個應用程式處理。Layer 4交換器通常內含高效能的ASIC晶片,能檢測分析封包至少前80位元組的資料,利用對傳輸層內的TCP或UDP埠號的辨識,就可以判斷封包內是包含那一種應用協定(HTTP,SNTP,FTP),然後將資料正確的送往更上層的應用軟體去做處理。 Layer 4交換器功能含蓋相當廣泛,本文將針對下列幾項應用詳細加以描述: QoS(Quality of Service) Cache Redirect Traffic Blocking
QoS(Quality of Service)
        傳統的區域網路並沒有服務品質的機制,因為當初的網路是以數據資料為主,沒有即時性的問題。所以對於不同型態的資料,網路端必須提供相對的服務品質,才能滿足各種應用的需求。簡單的說,IP的服務品質代表著封包流經網路的效能。在區域網路之中,所有網路設備如果都能得知並控制流經其上的訊流,就能對不同的應用程式提供不同的服務品質。例如,網路電話,視訊會議及ERP的資訊流是不允許有太長的延遲,而電子郵件,FTP或大量的檔案備份就可以容忍較差的服務品質。    Layer4交換器能夠調整服務品質使網路管理者能對不同形式的應用程式訊流給予不同傳輸優等級。我們常常對服務品質(QoS)及服務等級(CoS)產生混淆,在此利用航空公司做例子,進一步說明兩者的差異。通常航空公司都分有三種不同等級的艙等,如頭等艙,商務艙及經濟艙,這就是它們提供的服務等級(Class of Service)。而頭等艙,商務艙的乘客比經濟艙乘客得到更多的服務,如專屬的Check-in櫃台,貴賓休息室,優先登機及更豪華舒適的座椅等,這就是航空公司對不同的旅客所提出不同等級的服務品質(QoS)
 要完成服務品質的建置,必須要完成下列三件事
分類(Classification):先將所有封包一一辨識分類,是ERP的訊流 或只是一般的網頁查詢。
標記(Marking):將分類之後的每一個封包貼上標籤,這樣所有的網 路裝置就認得每個不同的封包。
優先順序(Prioritisation):將每一個封包設定不同的優先等級, 確保分別受到不同等級的對待。例如 公司高階主管們開會用的視訊會議就不容許被伺服器備份所影響。
        當然我們也要配合線速(Wire Speed)的交換處理能力,縱使我們增加了服務品質(QoS)的控制信息在傳遞的封包之中。例如我們就應該選用有特殊的ASIC硬體晶片來專門處理服務品質的工作。另外,在佇列(Queuing)處理操作機制上,能具有Class-Based的功能,依據服務品質的需求,將佇列區分成不同種類的處理頻寬,並能依需求作動態的調整。
        我們採用具有QoS的Layer4交換器,它允許依照UDP/TCP埠號,Ethertype(IP or IPX),實體埠或來源的IP位址去辨識訊流封包。在整個醫學院校區裡,學生資料的存取,病歷及X光資料及醫學研究單位都位於相同的區域網路中。如果我們在位於網路邊緣的交換器(Edge Switch)加上服務品質的機制,如此我們就可以避免網路資源被濫用,確保關鍵性的應用存取得到良好的效能。我們可以擬定不同輪廓的服務品質規範,分別佈建在校園網路內。例如,可以依照UDP埠號將Internet Radio,線上遊戲或MP3的封包阻絕(Block),將此法則放入連接學生電腦的Layer4交換器內。如此一來,校內的多媒體網際教學,研究教授要下載X光片做研究就不會被其他不重要的程式佔據頻寬。當然我們可以將一般的HTTP訊流及重要的醫學研究應用程式分類分流,並將其分別標記為IEEE802.1p或DiffServ DSCP,讓教學研究的資訊流付予較高的優先傳送等級,如果您有較舊的網路設備只能標記IEEE802.1p,Layer4交換器也可以將其對應到DiffServ DSCP,如此服務品質標記封包就可以越過不同網段達到點對點的服務品質保證。
 
Layer4 交換器訊流重新導引機制(Redirect)
        網頁快取伺服器(Web Cache Server)由於能有效的增進網頁下載速度,減緩企業對外專線頻寬昇級的需求,已漸漸的獲得企業MIS管理者的青睞。然而快取伺服器應該放置在何處?何種組態最能合乎經濟與效能兼顧的原則?一般說來,我們總希望在佈建任何網路產品時,最好不要影響公司正常的運作,不要改變使用者的使用常態。快速透通(Transparent)的建置方式,運用在網頁快取伺服器上有下列幾種方式, 1. 將快取伺服器連接在路由器旁,透過Web Cache Control Protocol(WCCP)來導引HTTP的資訊流。 2. 藉由防火牆導引HTTP的資訊流。 3. 將快取伺服器連上負載平衡器(Server Load Balancer),讓負載平衡器指引交通並指派給適用的快取伺服器。 4. 將快取伺服器連上Layer4交換器。我們很清楚的知道如果利用路由器或是防火牆來協助判斷導引所有使用者的要求,此方法無疑會增加其效能的承載量。負載平衡器雖然是不錯的方法,但是必須追加預算,而且較適合大型企業擁有多台伺服器運轉。如果我們利用Layer4交換器能夠攔截HTTP交通的特性,搭配網頁快取器,使用者瀏覽器不需要重新設定,快速且有效率的完成建置。
       另外Layer4交換器每幾秒就會傳送狀態檢查封包GET命令給快取伺服器,要求回應特定的URL網頁內容,如果未回應,Layer4交換器就會視同故障,並將所有使用者的要求導正回對外的鏈路,防止快取伺服器的故障造成服務中斷。
        Layer4交換器多樣的功能,讓我們能建置一個高效益的區域網網路環境。它提供線速(Wire Speed)無阻塞(Non-Blocking)的傳輸速度;利用分類型服務(DiffServ)讓我們能控制關鍵性應用程式流,提供有品質的資訊服務給使用者;阻絕不被允許的應用資料流在網路內流竄;搭配網頁伺服器,快速建置,解決使用者對網頁瀏覽速度過慢的埋怨。


#P#第四層交換承諾更多?
既然第三層交換器功能以如此強大,而更新的第四層交換器又能做些什麼呢?相較於Layer 3 switch,Layer 4 switch是以伺服器之間上載或下載的應用為主,利用TCP/UDP的形式來傳送封包,並且能與RSVP相容,為用戶提供各種服務。此外,L4 switch還可支援許多特定應用與服務,如頻寬管理、優先次序處理以及策略性網路管理(policy-based network)。
先進的Layer 4 Switch則進一步使用傳輸層(Transport Layer)來負責端對端的通訊服務,例如連線的建立、流量控制與錯誤控制等。大致上來說,Layer 4 Switch能提供下列幾項服務:
封包過濾/網路安全:Layer 4 Switch使用專屬的硬體(ASIC)來作封包過濾的工作,擋掉某些符合預先定義好之過濾準則的封包,並可達到線速的封包過濾(Wire-Speed Packet Filtering)。
服務品質:TCP/UDP的Layer 4資訊亦可用來保障應用程式所需的服務品質,區分出到同一個Server的不同應用程式連結,使關鍵任務(Mission Critical) 的應用程式可得到優於其他應用程式的服務品質。
有些Layer 4 switches機種除了執行Layer 4 access control外,它們還可進一步修訂封包。然而,QoS (Quality of Service) 優先權排序需要更強大的硬體功能與更複雜的硬體設計。
在第一階段,交換器決定收到的封包是屬於IP封包或是其他類型的封包。非IP封包將被送到交換器的不同部位以進一步處理。而IP封包則會被送到Layer 4 處理引擎上來進行解讀。
下一步,Layer 4 processing engine將檢驗IP封包以決定其UDP或TCP傳輸埠號碼,然後將這號碼與交換器制定的UDP與TCP傳輸埠號碼清單對照。如果相吻合,便可放行。如果不吻合,它可能被送回到switch engine,也可能在Layer 4 packet processor中被指定較低的優先權。
如果封包被驗證需要優先權,交換器可能指定兩種不同的封包優先權。如果這部交換器是區域網路Ethernet switch,它可能再第二層為封包指定802.1p優先權,然後再往外送出。如果是接上了WAN介面的邊界交換器,或者是非乙太網路交換器,那麼它將可指定IP ToS(Type of Service)優先權。不論如何,在指定優先權後,封包將路由到交換引擎上然後送到正確的目的地上。
伺服器的負載平衡:Layer 4 Switch記錄每一個伺服器的流量,進而提供伺服器負載平衡(Server Load Balancing)的判斷準則,進行訊務流量控制與管理。Layer 4 switch可按照MAC address執行Layer 2 switching。但它也可以看得更深一層,以便將有相同MAC address的不同封包,依其UDP或TCP埠碼送到不同傳輸埠上。如此便可執行依不同服務定義的負載平衡功能。
利用這種方式,所有後端的伺服器務必要有相同的鏡映內容。如此一來,唯一會限制虛擬Web server的延展性的只有Layer 4 switch的傳輸埠的數量。同樣的,如果伺服器出現硬,硬體故障,Layer 4 switch便可停止傳送封包,讓Web與FTP主機服務也擁有備援功能。
Web load-balancing其實只是Layer 4 switching的可行應用之一。另外,有些Layer 4 switch也可監視伺服器負載與回應時間,並將接收到的要求(incoming requests)交換到負載最輕的伺服器上。
存取控制:在Web load-balancing之外,交換器廠商為了拓展企業用戶市場,便極力訴求企業應用的功能。例如,Layer 4 switching可以提供存取控制清單(access control lists;ACL)。
一部全功能的路由器,可以依照收到之封包的資訊制定出上百甚至上千的過濾封包或傳送封包規則。也就是說,你可以依照通訊協定、傳輸埠號碼、IP address、MAC address甚或目的地位址過濾封包。它並不完全受IP通訊協定所操控。
舉例而言,你可以由特定網路介面上過濾所有的IPX Service Advertising Protocol (SAP) 訊務,也可單純過濾所有的IPX訊務就好。過濾IPX SAP訊務是Layer 4 交換器的工作,而過濾網路上之IPX訊務則屬於Layer 3交換器的工作範圍。
對路由器而言,啟動多重ACL對路由器效能有戲劇性的影響。可是Layer 4 switches是以硬體方式處理所有的封包交換、路由,因此這項功能對其效能完全沒有影響。
對許多網路設備廠商而言,Layer 4 switching其實就是指依照Layer 4資訊過濾IP packets。然而,Layer 4 switch也可具備防火牆功能。
在這一類產品中,並非所有的Layer 4 switching都具備同樣的功能。有些可以提供Layer 2、Layer 3或Layer 4標頭過濾,但有些則只能支援Layer 3與Layer 4過濾。同樣的,許多不同機種,其ACL設定的難易度也有很大的不同。

#P#硬體加速處理
目前網路產品有一點很明顯的發展趨勢,就是在不同的網路層級之間使用不同的硬體。網際網路上的Switch/Router大多使用CPU以軟體的方式處理封包,而許多通訊協定也都是以CPU處理模式所設計,這導致了目前有些協定使用了不定長度的封包表頭,封包表頭的Checksum欄位也不固定。然而,這一切均消耗CPU不少的運算能力。Switch Router所要處理的Port Speed,已由1996年的622Mbps(OC-12)增加到1999年的2.4Gbps(OC-48),但CPU的處理速度卻僅提升不到三倍。
在需求的推動下,半導體業者開始往Layer 3至Layer 7發展,嘗試由硬體取代原本軟體所執行的功能,亦即所謂的Layer 3/4 Switch。
目前先進廠商均研發將傳統路由器及交換器功能作有效結合的第三及第四層交換技術及產品,其目的在於盡量減少Routing的發生或以硬體之速度(Wired Speed)來執行Routing之動作,如此便能加速封包的處理,增強資料接取之效能。而未來的趨勢將朝威力更強大的Layer 4 Switch方向演進,並交由專用的Network Processor處理。
然而一旦進入Layer 4以上,所要處理的事情開始變得複雜,首先要處理的封包表頭變長了,接著要處理封包的分類以滿足服務品質(OoS)與防火牆的需求,然後又要能回應不斷推陳出新的功能。純粹使用ASIC將難以達到使用者需求。
因此,可程式的網路處理器(Network Processor;NP)開始出現,而PC微處理器巨人英特爾 (Intel)、IBM以及數家IC設計公司(如Agere、C-Port、Sitera等)也競相宣佈生產可編程之Network Processor,進軍網路設備處理器的市場。IDC認為,NP的市場在中、高階市場,比如核心處理機、企業用高階路由器與電信級路由器等產品亟需Gigabit級,甚至Terabit級的處理速度,特別是服務業者,希望能藉由採用更高性能的處理器提昇其設備,以提供更多的服務項目及內容。IDC預估2001年底,NP的應用範圍也會從高階市場擴散至Workgroup這一類中低階的企業區域網路市場。
#F#■圖/就企業用戶而言,凱創SmartSwitch1500將ATM網路擴展到無須自身支援ATM介面的地點,而使座落於遠處的分公司也擁有傳遞多重資訊的服務能力,用戶簡化了網路的複雜性,因此降低了基於單一ATM網路上整合語音和資料等服務的成本。

#P#MPLS與MPOA的比較 
既然談到第三層交換,就不能不了解MPOA與MPLS。目前有關第三層交換器的標準,主要有IETF的MPLS(Multi-Protocal Label Switching)及ATM論壇(Forum)的MPOA(Multi-Protocal over ATM)。
MPOA標準簡單來說是先分析IP封包的資料量並判斷是否必須建立ATM路徑來傳送資料,假如需要使用ATM路徑來傳資料且這個路徑還沒有被建立,則MPOA會利用ATM的SVC建立方式建立一條ATM路徑給IP封包使用,在此過程中,MPOA使用NHRP通訊協定去做IP位址及ATM位址的對映,所以交換機必須管理ATM及IP兩種位址的資料庫,同時還必須使用兩種的繞徑組態(PIR/OSPF 及PNNI),這使得操作、管理和故障排除上都會變得非常複雜。
事實上,MPOA是以ATM Forum之LANE標準為基礎所制定的,所以它適用的範圍應該是在區域網路及校園網路,而非廣域網路。
MPLS則較為單純,由於它是由Cisco公司的Tag Switch為基礎所發展出來之標準,所以是以拓樸導向為基礎的交換機,當網路建立完成時,ATM連線也同時建立完成,不需要再去分析IP封包;同時它只管理IP一種位址,只使用RIP/OSPF或BGP來建立繞徑的決定,因此所建立起的網路也較穩固。

沒有留言: