You must have basic knowledge of network

Network equipment

Ethernet

Ethernet is the center of gravity of the entire Ethernet card. So NIC Ethernet transmission is mainly direct data transfer to the card. IEEE802.3; CSMA / CD (Collision Detection Carrier Sense Multiple Access)

  • Listener medium where : A host before sending the data packet, the need to listen to the network medium, to confirm that no one after use, the data frame can be issued.
  • Multipoint transmission : A host sends data copy will be the hub, and then sent to all the hosts connected to this hub. Choose to accept only the target host, the other hosts give up
  • Conflict detection : If another host B also happens at the same time transmitting a data frame, the A and B data collision (a car accident), then the data is destroyed, then the respective A and B will wait a random time, and then again by a first step transmitting data frames

Hub Hub

  • Belonging to the first layer of the OSI hub physical layer device
  • A hub is a shared medium network device, a single time, a host can only be used
  • All hub ports in a collision domain

Ethernet bridges and switches (second floor)

  • The difference between the switch and the hub, can be recorded for each port connected to the PC with its MAC address
  • Dividing the collision domain network, so that network conflicts is limited to the minimum range
  • Switches can be isolated collision domains, broadcast domains can not be isolated
  • Extended network bandwidth

router

  • Gateway / router function is responsible for data packets between different networks transmitting (IP Forwarding)
  • Implement routing relies on the router's routing table to complete
  • Separate broadcast domains
  • The same network segment machine, if you delete a route record, can not Ping Tung

VLAN

  • = = The VLAN logical network broadcast domain (Subnet)
  • IEEE 802.1Q frame structure

  • VLAN ID, 12bit, indicates the number of the data frame the VLAN. VLAN ID ranges from 0 to
    4095. Since the value 0 Reserved 4095 and the protocol, the valid range for the VLAN ID is 1 to 4094

TCP / IP protocol stack

Transmission Control Protocol / Internet Protocol, defined four.

TCP port number

  • Transport layer port numbers, determining the application layer protocols (0-65535)
  • 0-1023: System port or privileged port (available only administrator), well-known, permanently assigned to a fixed
    system application use, 22 / tcp (ssh), 80 / tcp (http), 443 / tcp (https)
  • 1024-49151: registered user port or ports, but not critical, assigned to the register for a program to be
    used to use, 1433 / tcp (SqlServer), 1521 / tcp (oracle), 3306 / tcp (mysql), 11211 / tcp / udp
    (memcached)
  • 49152-65535: dynamic or private port interface, the client program using the random port
    define its scope: / proc / sys / net / ipv4 / ip_local_port_range

Advantages and disadvantages of the agreement tcp and udp protocols of the contrast?

  1. TCP connection-oriented; the UDP is connectionless, i.e. without establishing a connection before sending data.

  2. TCP provides reliable service. In other words, the data transfer connection of TCP, error-free, not lost, not repeat, and arrive out of order; UDP best effort, that does not guarantee reliable delivery.

  3. UDP has better real-time, high work efficiency than TCP, suitable for high-speed transmission and real-time communications have a higher or broadcast communications.

  4. Each TCP connection can only point to point; UDP support one to one, one to many, and many-to-many interactive communication.

  5. TCP more demanding on system resources, UDP less demanding on system resources.

UDP its simple, fast transport advantages, instead of TCP in more and more scenes.
(1) to a lifting speed stability UDP provides a reliable network protection, packet loss rate is low, if the application layer retransmission, the transmission reliability can be ensured.
(2) In order to achieve reliable TCP communications network, it uses a complex congestion control algorithm, the tedious process of handshake, Since TCP protocol stack built-in system is extremely difficult to improve it.

Tcp brief three or four times holding the watch and swing your watch during the process and various client and server-side state

Three-way handshake

  • The client sends a SYN packet to the server, the client enters SYN_SEND state.

  • The server receives a packet sent by the client returns ACK + SYN packet, the server enters a state SYN_RECV.

  • The client receives the packet returned by the server then sends back an ACK packet, the client enters ESTABLISHED state, the server receives a packet has entered the ESTABLISHED state.

    Four waving

  • The client sends a FIN packet to ask whether the server can be turned off, the client enters FIN_WAIT_1 state.

  • The server receives a packet sent by the client and returns an ACK packet, the server enters CLOSE_WAIT state.

  • When the server is ready to disconnect, sends FIN packets to the client, the server enters LAST_ACK state.

  • After the client returns the packet sent by the server side receives the ACK packet, the client enters the TIME_WAIT state, the server received the packet enters the CLOSED state.

Guess you like

Origin blog.51cto.com/14322522/2406473