Introduction to Networking 101 (TCP/IP/UDP/LAN/WAN/Hub Switch Router/3-way Handshake)

How do we get networks at home? What connects networks that allow us to exchange data and get the information we need from WAN to LAN? What is the process for the three-way handshake in TCP?

Photo by Taylor Vick on Unsplash

LAN / WAN

Router — the gateway allows LAN to talk to the outside network

LAN — Router — WAN — Router — LAN

  • A Router is a networking device that forwards data packets between different computer networks for security reasons
  • Computers communicate by sending packets
  • Protocols are sets of rules that determine how data is transmitted between different devices in the same network.
  • TCP ensures packets can get to their destination. Commonly used with IP (TCP/IP).
  • UDP doesn’t guarantee delivery. Commonly used for video calls.

LAN (local area network — home network)

  • IP (logical address)
  • Switch
  • Subnet (define your local area network range, check if it is within the network or not)
  • Gateway (IP address of the router)

WAN (wide area network)

  • Firewall
  • DMZ (demilitarized zone) — a subnetwork that contains and exposes a device to an untrusted network such as the internet. when the device sits in the DMZ, the device can talk to the device outside the firewall
  • PORT Forwarding — directs a communication request from one address and port number combination to another while the packets are traversing a network gateway, such as a router or firewall (you need to specify which port address that communication needs to happen)
  • NAT (network address translation) — a method of remapping an IP address while they are in transit across a traffic routing device.
Photo by Thomas Jensen on Unsplash

Hub / Switch / Router

Hubs, Switches, and Routers are used to connect networks.

Hub — connect all of your network devices together on an internal network. a device that has multiple ports that accepts Ethernet connections from network devices. Does not filter data. Data comes to one port then data is copied to all other ports. (security concerns and unnecessary concerns)

  • only detects that a device is physically connected to it

Switch — intelligent, learn the physical address of the device. Stored called MAC address, and then the switch will look at its table of MAC address and matching ports and deliver to the correct port. (preferred over the hub, reduce unnecessary traffic)

  • can detect specific devices that are connected to it
  • and keep a record of the MAC addresses of those devices

Hub and Switch are used to exchange data within a local area network. (in-home network or business) not used to exchange data outside their own network, like the internet.

In order to exchange data outside their own network, a device needs to be able to read IP addresses.

Router — routes or forwards data from one network to another based on their IP address. When a data packet is received from the router, the router inspects the data’s IP address and determines if the packet was meant for its own network or if it is meant for another network. (gateway of a network)

Photo by Rock Staar on Unsplash

Three-Way Handshake in TCP

https://www.geeksforgeeks.org/tcp-3-way-handshake-process/

The client wants to establish a connection with a server

  1. DNS
  2. IP Adress
  3. Set up TCP Handshake
  4. The client creates a source port, sends an SYN request to the server
  5. The server acknowledges back (bi-directional) with an SYN request + acknowledgment
  6. The client acknowledges the SYN request and we are good to go.

Step 1 (SYN)

The client sends a segment with SYN(Synchronize Sequence Number) which informs the server that the client is likely to start communication and with what sequence number it starts segments.

Step 2 (SYN + ACK)

The server responds to the client request with SYN-ACK signal bits set. Acknowledgment is going to be whatever your sequence was, plus 1. For example, if I send you 1000 bytes, you’ll send me acknowledgment 1001.

Step 3 (ACK)

The client acknowledges the response of the server, and both establish a reliable connection with which they will start the actual data transfer.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Hanwen Zhang

Full-Stack Software Engineer at a Healthcare Tech Company | Document My Coding Journey | Improve My Knowledge | Share Coding Concepts in a Simple Way