The difference between the computer network, routers and switches

 

First of all, I share the experience above Baidu explain:

  • A difference
    • The router can automatically assign IP and dial-up virtual local area network
    • Only the switch for distributing the data network
  • Difference between the two
    • The router at the network layer, the IP address according to the address, the router can handle "TCP / IP" protocol, not switch
  • Three differences
    • Switch at the data link layer, the MAC address addressing
  • The difference between four
    • An IP router can be given to multiple hosts using the same IP outside
    • The switch can connect to many hosts, different external IP
  • The difference between five
    • Router can provide firewall, switches do not provide this functionality
  • The difference between six
    • Switch is made to expand the LAN access point, allowing more computers into a local area network connected
    • Routers are used to make the gateway, which is used to connect different networks

Forwarding principle switch

Will automatically create a port address table after the switch powers on, it is also called a MAC address table records the MAC address of the machine and which port each device is connected, it will have automatic learning, if not a start address, each time after switch information, it will read and record device port MAC addresses to send information over, if the next time there are other equipment to send information to the device, directly served with.

The most common situation, forwarding principle is this: Ethernet switch receives a frame of data, which they will have learned to switch over to port address table, if there is a port address table are forwarded directly to the corresponding port. If the table does not exist, to the rest of each port (in addition to sending information over the port) sends a broadcast the same information.

  • Switches A and B, now if a data sent from the host 01 to the host 03, the setting is provided, the switch A and the address B are blank.
  • So first, the data sent from the host to the switch A 01, A switch after receipt of the data, to identify the MAC address of the host 01 is (assumed to be 01 because each unique device addresses are in hexadecimal), the port number is 1.
  • A switch find your MAC address table, found no (if there is direct forwarding), A switch to all other ports broadcasts.
  • Switch B after receiving the data message, identifying and learning the source address and port number over.
  • Switch B to view the table, not found, to record two broadcast packet transmission ports except port 3.
  • The last case, the host 02 will receive data once, not their own, discarding data; a host receives data 03, happens to be their own, receive data; host 04 also received once discarded.

 

The router works

for example:

  • A master ready to send data to the host B.
  • A together with the IP address B data together in packets transmitted to the router R1.
  • After router R1 receives a packet, the data read start address to the IP B, and then sent to the calculation of the optimal path based on the path table B.
  • For example path: R1-> R2-> R5-> B; and the data packet sent to the router R2.
  • Router 2 Router 1 is repeated work and forwards the data packet to the router 5.
  • 5 taken same router destination address, the destination address found in the network on its own, then the data packet directly to Host B.
  • Host A Host B receives the information, a complete communication came to an end.

 

As a note-taking moment, a reference to some information:

https://jingyan.baidu.com/article/7908e85cda65e1af481ad2c4.html

Micro-channel public number: first monitoring

 

Guess you like

Origin www.cnblogs.com/adongyo/p/11617427.html