So sánh sự khác nhau giữa Switch Layer 3 và Router



Đồng ý là nhìn từ góc độ tính năng hoạt động hoặc từ mô hình tham chiếu OSI thì router và L3 switch (chỉ L3 thôi nha) tương tự nhau, vì chúng đều có thể hoạt động ở lớp Network và có thể chuyển các gói qua lại giữa các phân đoạn mạng khác nhau.

Tuy nhiên, về mặt xử lý thì hai loại thiết bị này có chỗ khác biệt. Hay nói cho đúng hơn, do router được chế ra để routing, còn L3 switch được chế ra trước hết là để switching nên kiến trúc phần cứng và cách thức hoạt động có chỗ không giống nhau.



Router và L3 switch, khi xử lý ở lớp 3, đều xử dụng chung một cơ chế đối sánh mẫu và cache các thông tin này. Chúng đều sử dụng các giao thức định tuyến và bảng định tuyến để xác định tuyến đường tối ưu.

Khác biệt cơ bản về mặt cơ chế hoạt động nội tại là L3 switch có khả năng tái lập các thông số xử lý của phần cứng tương ứng với các thông tin định tuyến đang cần sử dụng để có thể xử lý gói tin với tốc độ tối ưu. Các thông tin tiếp nhận từ giao thức định tuyến được L3 switch sử dụng để cập nhật các bảng cache lưu trữ trong phần cứng của nó, giúp việc xử lý các gói tin ở L3 sau đó được thực hiện 'gần như' cơ chế chuyển tiếp dựa trên MAC ở L2.

Nói túm lại, L3 switch dù có khả năng routing như router nhưng nó sử dụng phần cứng đã được tối ưu hóa (với chip ASIC) để chuyển tiếp dữ liệu với tốc độ cũng lẹ như L2 switch. Trong môi trường LAN thì thường L3 switch xử lý lẹ hơn router nhiều vì nó hoạt động trên phần cứng hỗ trợ mạnh cho switching.

Đổi lại, cũng do sử dụng phần cứng tối ưu hóa cho switching, L3 switch không dễ dàng tùy biến (kể cả thay đổi hệ điều hành) để xử lý được nhiều tác vụ xen kẽ trong quá trình xử lý định tuyến như router. Đây chính là lý do mà đa phần các L3 switch không hỗ trợ can thiệp vào nội dung gói IP để thực hiện các thay đổi cần thiết phải có như ví dụ với quá trình NAT/PAT.

P/S:

  • Tuy các router cao cấp hiện nay cũng bắt đầu sử dụng chip ASIC để xử lý định tuyến nhưng do môi trường mục tiêu khác nhau, hệ điều hành và cơ chế hoạt động cũng được thiết kế khác nhau tương ứng nên nếu chỉ xem xét về mặt hiệu năng chuyển tiếp gói tin thuần túy thì vẫn không thể so sánh với thiết bị L3 switch được.

  • Các thiết bị L4-L7 switch, khác với L3 switch, hỗ trợ nhiều tính năng can thiệp nội dung gói tin trong quá trình routing, switching. Các thiết kế phần cứng của các cụ này do vẫn cần tối ưu hóa cho tác vụ switching nên rất phức tạp, & theo đó - rất mắc tiền.

Để so sánh L2 và L3 switch, đầu tiên ta xem lại L2 switch.So sánh Layer 2 và Layer 3 switch
So sánh Layer 2 và Layer 3 switch
Layer 2 Switch
Trong các hệ thống mạng dùng shared Ethernet, thiết bị hub thường được dùng. Nhiều host sẽ được kết nối như là một miền broadcast và miền xung đột (collision). Nói cách khác, các thiết bị shared Ethernet hoạt động ở lớp 1.
Mỗi host lúc này phải chia sẽ băng thông sẵn có cho tất cả các host khác đang kết nối vào hub. Khi có một hoặc nhiều host cố gắng truyền ở một thời điểm, xung đột sẽ xảy ra; lúc này tất cả các host phải lui về và chờ một khoảng thời gian để truyền lại. Cơ chế này áp đặt kiểu hoạt động half-duplex cho các host, nghĩa là các host hoặc là truyền, hoặc là nhận ở một thời điểm. Thêm vào đó, khi một host gửi ra một frame, tất cả các host sẽ nghe frame đó.

Ở mức cơ bản nhất, một Ethernet switch sẽ tách các host kết nối vào nó theo những cách sau. Mỗi collision domain sẽ bị giới hạn lại. Trên từng switchport, mỗi collision domain bao gồm chính cổng của switch đó và bao gồm các thiết bị kết nối vào cổng switch. Thiết bị kết nối này có thể là một host hoặc có thể là một hub khác. Các host có thể hoạt động ở chế độ fullduplex bởi vì không có sự cạnh tranh trên đường truyền. Các host có thể truyền và nhận ở cùng một thời điểm.Băng thông không còn chia sẽ, thay vào đó, mỗi switchcổng cung cấp một phần băng thông dành riêng trên switch fabric từ cổng này đến cổng kia. Các kết nối này luôn biến động. Lỗi trong các frame sẽ không được truyền. Thay vào đó, các frame nhận đươc trên từng cổng sẽ được kiểm tra lỗi. Các frame tốt sẽ được tái tạo khi nó tiếp tục được chuyển đi. Cơ chế này còn gọi là store-and-forward.Bạn có thể giới hạn broadcast lưu lượng đến một mức cho trước. Switch có thể hỗ trợ các kiểu lọc thông minh.
Hoạt động của Multilayer switch
Các Catalyst switch, chẳng hạn như 3560, 4500 và 6500 có thể đẩy các frame dựa trên thông tin L3 và L4 chứa trong gói tin. Tiến trình này gọi là chuyển mạch đa tầng (multilayer switching – MLS). Một cách tự nhiên, tiến trình L2 switch cũng phải được thực hiện vì suy cho cùng, các giao thức lớp cao hơn vẫn phải chứa trong các Ethernet frame.
Các kiểu MLS
Có hai thế hệ MLS: route-caching (thế hệ đầu) và topology-based (thế hệ thứ 2). Hiện nay các dòng switch như 3560, 4500 và 6500 chỉ hỗ trợ thế hệ thứ hai của MLS.
Route-caching: Thế hệ đầu. Kiểu công nghệ này đòi hỏI về mặt phần cứng phảI trang bị thêm một route processor RP và một switch engine SE. RP phảI xử lý gói tin đầu tiên của một dòng các lưu lượng để tìm ra địa chỉ đích. SE sau đó sẽ lắng nghe cả gói tin đầu tiên và địa chỉ đích cần đích, sau đó tạo ra một đường đi tắt trong cache. SE sau đó sẽ đẩy các gói tin kế tiếp trong cùng một dòng lưu lượng dựa trên thông tin trong cache. Kiểu hoạt động MLS này còn được gọi là netflow LAN Switching, flow-based hoặc “route once, switch many”. Ngay cả khi ngày nay kiểu chuyển mạch này không được dùng trong các Catalyst switch, kỹ thuật này vẫn được dùng để tạo ra các thông tin về dòng lưu lượng và các thông tin thống kê.
Topology-based: Thế hệ thứ hai của MLS sử dụng các phần cứng chuyên dụng. Các thông tin định tuyến lớp 3 sẽ được xây dựng và đưa vào một cơ sở dữ liệu về toàn bộ sơ đồ mạng. Cơ sở dữ liệu này, bản chất sẽ được kèm theo một cơ chế tìm kiếm bằng phần cứng rất hiệu quả, sẽ được tham khảo sao cho các gói tin có thể được đẩy đi ở tốc độ rất cao. Khi có một so trùng dài nhất được tìm thấy (longest match), kết quả này sẽ được dùng. Khi cấu trúc mạng thay đổi, database chứa trong phần cứng này cũng sẽ được cập nhật động trong thời gian rất ngắn. Kiểu MLS này được gọi là Cisco Express Forwarding CEF. Một tiến trình định tuyến chạy trên phần cứng của switch sẽ download bảng định tuyến thông thường vào trong bảng FIB.
Setting up a large computer network can be a daunting task and one needs an in depth knowledge of the function of every networking device to build an efficient network. Two components which are quite similar in their working are routers and layer 3 switches.

What are Routers?

Routers are devices which control the transfer of intra-network and inter-network data traffic. These are intelligent microprocessor controlled devices which carry out the decision making involved in transferring data traffic to the right addresses on networks.

It connects multiple networks together and comes in various types, depending on the scale, complexity and number of networks that it handles. It works using a configuration table that has a list of network addresses in it. In networking terminology, it operates at layer 3 of the OSI model.

A router must inspect the data packets that come into a network and choose the most optimum path for transferring the data, according to the status of other packets on the network. Since it operates at the network layer, it uses the IP addresses of connected machines to send data packets to their right destinations. A wireless router used on networks, comes with a built in firewall and a wireless encryption mechanism, designed to restrict access to the network.

What are Layer 3 Switches?

These switches perform all the functions that are carried out by routers, which includes directing data packets to their right destinations. Network switches are normally confined to work on the layer 2 of the OSI model, connecting network segments together. A layer 3 switch is a cross between a router and switch. It is a switch working on level 3.

These switches possess the fast switching hardware of layer 2 switches, with the logical routing capabilities of a router. They inherit the best of both devices and were primarily created to carry out high speed data transfers over local area networks. They are a lot different from basic layer 2 network switches.

Main Differences

The prime difference between a router and this switch type, lies in the fact that the latter uses hardware in implementing the packet routing over the network. What the router achieves through software manipulations, the layer 3 router achieves through hardware level manipulations, which makes its operate faster. The switching hardware or forwarding architecture, which brings the high operation speeds of switches to layer 3 data transfers, is the prime difference between the two. Being designed to operate on wide area networks, routers come with WAN ports. Since layer 3 switches are operated on local area networks, they do not come with any WAN features whatsoever. The cost of these switches is a fraction of router cost. So, if you need a routing device for your corporate intranet, what you go for is this switch type. 

The layer 3 switch is basically a hybrid between a router and a switch, incorporating the software logic of the router and the hardware level switching capabilities of a switch, providing faster routing. What the router achieves through software level manipulations, this switch implements through dynamic changes in hardware.

Unlike a router, a layer 3 switch doesn't possess wide area network ports or any other WAN related features as it is designed to operate on local area networks. Lastly, they cost substantially lesser than routers while carrying out all of their functions on local area networks at higher speeds.

Discussion: Router vs. Layer 3 Switches


When a router receives a packet, it looks at the Layer 3 source and destination addresses to determine the path the packet should take. A standard switch relies on the MAC addresses to determine the source and destination of a packet, which is Layer 2 (Data) networking.

Generally speaking, a Layer-3 switch (routing switch) is primarily a switch (a Layer-2 device) that has been enhanced or taught some routing (Layer 3) capabilities. A router is a Layer-3 device that simply do routing only. In the case of a switching router, it is primarily a router that may use switching technology (high-speed ASICs) for speed and performance (as well as also supporting Layer-2 bridging functions).

The fundamental difference between a router and a Layer 3 switch is that Layer 3 switches have optimized hardware to pass data as fast as Layer 2 switches, yet they make decisions on how to transmit traffic at Layer 3, just like a router. Within the LAN environment, a Layer 3 switch is usually faster than a router because it is built on switching hardware. In fact, many of Cisco’s Layer 3 switches are actually routers that operate faster because they are built on “switching” hardware with customized chips inside the box.

Examples: Layer 2 switches, Layer-3 switches or routing switches and Routers

Layer-2 switchesCisco: Catalyst 2950, 2960 series

Layer-3 switches or routing switches
Cisco: 
Catalyst 3550, Cisco 3560, 3750, 4500, Cisco 6500 series

Juniper: EX series

Routers (with some bridging and/or security features) or switching routers
Cisco: 1800, 1900, 2600, 2800, 2900, 3700, 3800, 3900, 7200, 7600, ASR 1000 series
Juniper: MX series, J series, M series

Notes: The current Cisco Catalyst layer-3 switches are 3560, 3750, 4500 series, 4900 series, and 6500 series.

To understand better of switching router and routing switch differences, following is an illustration. In early Cisco switches (i.e. Catalyst 3500 switches), there are only basic Layer-2 capabilities such as bridging and switching. With newer models (i.e. Catalyst 3550 or 3560 switches), there are also some routing capabilities such as terminating multiple Layer-3 interfaces and running dynamic routing protocol. In router world, early Cisco routers (i.e. 1600 or 2500 model), there are only basic Layer-3 capabilities such as running dynamic routing protocol, terminating Serial ports, and running non-IP protocols such as IPX and SNA. With newer models (i.e. 1700, 1800, 2600 or 2800 models), there are also some Layer-2 capabilities such as bridging and switching. In addition there are some WIC (WAN Interface Cards) and NM (Network Modules) with Ethernet ports supporting bridging and switching in those newer router models even further such as WIC-4ESW Ethernet Switching card for 1700 series, HWIC-4ESW High-Density Ethernet Switching card for 1800 and 2800 series, and NM-16ESW Ethernet Switching module for 2600 and 2800 series.

As a broad category, routing switches use hardware to create shortcut paths through the middle of the network, by bypassing the traditional software-based router. However, unlike traditional routers that utilize general-purpose CPUs for both control-plane and data-plane functions, Layer-3 switches use high-speed application specific integrated circuits (ASICs) in the data plane. By removing CPUs from the data-plane forwarding path, wire-speed performance can be obtained. This results in a much faster version of the traditional router. In Cisco world, this routing switch ASIC technology implementation as example applies to Catalyst 6500 switch series. These kind of switches are typically blade or module based switch which you have to specify which “switch brain” (called Supervisor Engine in Cisco world) and which port modules you like the switch to have.

In the case of a switching router as primarily a router that uses switching technology (high-speed ASICs) for speed and performance (as well as also supporting Layer-2 bridging functions), there are Cisco 7600 series and Juniper MX series routers as examples. These kind of routers are typically blade or module-based router which you have to specify which “router brain” (also called Supervisor Engine in Cisco world) and which port modules you like the router to have.

Further, the Cisco 7600 series router Supervisor Engine modules are compatible with the Cisco Catalyst 6500 series switch due to identical architecture between the router and the switch. In other words, you could use the same Supervisor Engine model on either Cisco 7600 series router or Catalyst 6500 series switch.

Discussion: Router vs. Layer 3 Switches  —from Cisco learning home

Q: As we all know that Layer 3 switch can perform the routing tasks if routing is enabled. But I`ve some questions regarding this:

1. What is the main difference between this two?

2. What is the choosing criteria between this two i.e. when should I use which one? What’s about the cost effects?

3. Why router is needed if there is existence of Layer 3 Switch?

Re1: L3 switches do not have WAN interfaces.

You can connect Ethernet circuits to a switch so you only need a router if you want to connect traditional circuits such as E1 E1 SDH or old technology such as X21 V35 or async circuits. As far as I know Call Manager Express does not run on a switch but does on a router. Switches support Wi-Fi controller, Firewall so are quite powerful. So you need to understand the business requirement before deciding router or switch. Also routers can include switch modules.

Re2: If it routes, it’s a router.

L3-switch is a marketing term.  It’s a router with only Ethernet interfaces and lots of them.  It also has a switching function to it. Which makes it both a router and a switch? The differences will vary based on model.  It depends…  Cost varies as well, everywhere from inexpensive to very expensive! And truly there isn’t a “need”. You need an L3 device of some sort to exit your subnet. How you design that, or what specific piece you use is entirely up to you.

Re3: Traditionally, Routers were devices that connected the LAN to the WAN and switches were just LAN devices and you may add a layer 3 switch to the lan if you had some vlans and didn’t want to use a router.

However, as technology changes, the tradition of the WAN and LAN are fading.  My “WAN” links are actually 1 gig single mode fiber circuits that terminate to an ethernet fiber interface on a Layer 3 switch, a 6500, 4500, 3750 or even a 3560.  Now some will say that I have a MAN with those kinds of links.  It seems that as Scott said, Cisco Marketing is still stuck on calling a router a device that terminates a traditional WAN link,  I do agree that if the device routes, it is a router…. to some degree.

One thing I did notice regarding routers and layer 3 switches, and I will admit that router model and IOS version may play very heavily into this, and that is Routers seem to support more traffic monitoring features, such as netflow and nbar where as Layer 3 switches don’t seem to have that kind of support…. until you get to the 6500.



Re4: Technically, the differences are:

1- L3 Switch do switching at layer 3 by preserving the source and destination mac and preserving the TTL value of the IP header of the 1st routed packet, so the first packet is routed using normal routing lookup, but after that all packet are switched.

2- router do normal routing lookup, but by introducing fast switching and CEF, packets are also now switched on a router.

3- Switches doesnt support some QoS features.

4- Switches doesnt support NAT.

5- The forwarding on switches is done on ASIC (Application Specific Integrated Circuits) which is done in hardware rather than a software.

6- Forwarding on routers are done in a software.

7- router supports different WAN technologies (modules) unlike switches.

Re5: I was just thinking about this.  I didn’t learn about Layer 3 switches until the bcmsn.  I know in CCNA they were still really pushing the router vs switch concept.  Talk about throwing a monkey wrench into things when you throw in the concept of Layer 3 switch.

So to review:

1. A pure router will do just that, typically no switch ports, in today’s cisco world I don’t even know if they make one of these, wouldn’t that be something like an ASA with 1 or (2) 100 mb or gig ports with a serial port or similiar?

2.  A switch will just allow connections to edge devices, a true layer 2 switch like a 2960, Int vlan’s is what allows management of the switch at layer 3.  No routing between vlans, this is where router on a stick comes into play.

3.  A layer 3 switch integrates both abilities, but it depends on the model on how integrated and featurific it is.  Will it support netflow?  Will it route between vlans?  If you do a show ip route what will be displayed?  How does it implement vlans, is it traditional vlan.dat file or will it do the switching way with show vlan? — The simplest true layer 3 switch will support all switching features, but have the ability to do routed ports and route between the vlans.  I have had a Integrated services router like a 1760 or 3725 or similiar where they had a small switch module, say 4-24 (100).



The definition of a layer 3 switch also may include the ability for a port to be either a routed port or a switched port, the commands switch port vs no switch port followed by having to assign it an ip address.



This is another point that also took some getting used to.  In a port that can be either layer 2 or layer 3, or strictly layer 3 or layer 2.    Example, a router can only do layer 3, so to do inter vlan routing  while connecting to another switch via  trunk port you have to give it sub interfaces to a physical switch port, give each one its own ip address and tag it with the encapsulation dot1q #.  Router on a stick, vs. switchport mode trunk command with layer 3 interfaces via the “int vlan 1″ with an ip address assignment.



While I understand the ccna approach to teaching fundamentals and where thing started, it no doubts confuses someone especially when a question asks about the differences between a hub/switch/router.  In today’s world, hubs don’t really exist, and in a large company odds are you’re going to be using a layer 3 switch.

Re6: Not sure that is accurate. I think most layer 3 switches can handle BGP, but to what extent? Full tables? Probably not. Dishing out money for 2 Cisco 2821′s or Cisco 2921′s is going to be way cheaper than purchasing another Cisco 6500 for our network….not to mention our Catalyst 6500 already does a lot of work…and now I am going to throw BGP at it….AH it would just shut off and give me the middle line card!

Post a Comment

Mới hơn Cũ hơn