network/

directory
v0.0.0-...-f53f79a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2019 License: MIT

README

Overview of network layers

network_layers

physical layer

Physical layer refers to basic networking hardware transmissions. It defines how to transfer raw bits over a physical link connecting network nodes. For example, a ethernet hub works on a physical layer. It coordinates multiple network objects and makes them act as a single network segment and share the bandwidth of a network.

network_hub

Ethernet hub works by repeating bits received from one of its ports to all other ports, which means each incoming bit gets replicated to all other interfaces. But this can generate unnecessary traffic and waste bandwidth. This is where network switch comes in.

Data link layer transfers data between adjacent network nodes. Ethernet is an example of data link layer. It is a networking technology for LAN. Ethernet is used to communicate between this local area networks (LAN). Data link layer uses MAC addresss to transfer data between two nodes in a network, using ARP. Switch and bridge work on data link layer. Unlike less advanced network hubs, a network switch forwards data only to one or multiple devices that need to receive it, rather than replicating data to every single port.

network_switch

But what if we want to send packets across different networks? This is where router comes in.

network layer

Network layer defines routing and packet forwarding, to transfer data between hosts. Router on network layer fowards data packets between computer networks. A network switch in data link layer connects data lines from one single network, while a router connects data lines from different networks. Router is a networking device that transfer data packets between computer networks. In most cases, you have your own router at home to connect to Internet through your own ISP.

network_router

Router also does:

NAT remaps one IP address space into another by modifying network address information. It helps conserve IPv4 addresses by abstracting the entire IP address space with private network IP addresses.

nat

DHCP dynamically distributes network configurations, such as IP addresses. It usually reserves a range of IP addresses, and each DHCP client requests an IP address from DHCP server during network initialization. It uses a lease concept with limited time period, so that DHCP server can reclaim, reallocate, and renew IP addresses.

dhcp

transport layer

Transport layer provides end-to-end or host-to-host communication. Let's compare two most popular transport protocols: Transmission Control Protocol (TCP) and User Datagram Protocol (UDP).

TCP UDP
header 20 bytes 8 bytes
connection need connection(3 way) no need
data corruption retry no retry
in order ordered no order
congestion control Yes No

TCP provides reliable, ordered, and error-checked delivery of a stream of octets between applications running on hosts communicating over an IP network. TCP is the protocol that major Internet applications such as the World Wide Web, email, remote administration and file transfer rely on. Applications that do not require reliable data stream service may use the User Datagram Protocol (UDP), which provides a connectionless datagram service that emphasizes reduced latency over reliability.

Transmission Control Protocol by Wikipedia

So, TCP is good for static contents, where you need to transfer relatively large chunck data at punctual intervals. For example, you would use TCP to download a file that won't change for the next 5 minutes (static). UDP is for real-time and continuous stream of data, when you do not want to wait to check its packet consistency. You might lose your data but get performance and responsiveness. VOIP uses UDP and TCP is more universal these days. Some network devices do not support UDP. Many video streamings are served via TCP if the data are stored statically. Online live streaming would use UDP.

session layer

Session layer stores states between two connections.

presentation layer

Presentation layer converts between different formats of data, such as encoding, encryption, or decryption.

application layer

Application layer refers to shared protocols and interface methods between hosts, such as HTTP, SSH, SMTP (which will be covered separately).

Refs

Directories

Path Synopsis
tcp

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL