DEV Community

Cover image for Basics of Networking...
Dipanshu Torawane for Kubernetes Community Days Chennai

Posted on • Updated on

Basics of Networking...

Basic Networking Terms

LAN(Local Area Network)

Collection of devices connected together in one physical location. Each device has a unique IP(Internet Protocol) address. Devices communicate via these IP addresses.

LAN.png

IP(Internet Protocol)

It's a 32-bit value.

  • 1 bit: 1 or 0.

  • 00000000: 0

  • 11111111: 255

    ip-addressing.jpg

For example, 172.16.0.0

IP addresses can range from 0.0.0.0 to 255.255.255.255

IP address range

ip range.png

Switch

It sits within the LAN and facilitates the connection between all the devices within the LAN.

Switch.png

Gateway is the IP address of the router.

Gateway.jpg

Router

It sits between LAN and outside networks (WAN: Wide Area Network).

It connects devices on LAN and WAN and allows networked devices to access the Internet.

Router.jpg

A subnet is the logical subdivision of an IP network.

Subnet.png

How to know whether the other device is inside or outside the LAN?

  • It knows because of the IP address of the target device.

  • Devices in the LAN belong to the same IP address range.

Subnetting is the process of dividing a network into two or more networks.

CIDR(Classless Inter-Domain Routing) block

It is a subnet mask that dictates how many bits are fixed.

  • 255.255.0.0 => means that 16 bits are fixed

  • 255.255.255.0 => means that 24 bits are fixed

CIDR block.jpg

Any device needs 3 pieces of data for communication:

  • IP address

  • Subnet

  • Gateway

NAT(Network Address Translation)

It's the IP address range chosen by an administrator.

Each device gets a unique IP from that range.

How to make sure that IP addresses don't overlap?

  • IP addresses within LAN are not visible to the outside network or internet.

  • Your laptop's private IP address is replaced by the router.

NAT.png

Benefits of NAT

  • Security and Protection of devices within LAN.

  • Reuse IP addresses.

There are a limited no. of IPv4 addresses available - 4,294,967,296 public addresses.

Firewall

A system that prevents unauthorized access from entering a private network.

Using Firewall Rules you can define, which requests are allowed.

Firewall.png

What are these firewall rules?

  • It defines which IP address in your network is accessible and which IP address can access your server.

    • For example, you can allow any device to access your server.
  • It allows the device's IP address at the port to be accessed.

  • This is also called Port Forwarding.

Firewall Rule.png

What is a Port?

Port => every device has a set of ports.

You can allow specific ports(doors).

You can allow specific ports(doors) AND specific IP addresses (guests).

Different Applications listen to specific ports.

Ports.jfif

Standard Ports for many applications

  • Port 80 => Web Servers

  • Port 3306 => MySQL DB

  • Port 5432 => PostgreSQL DB

For every application, you need a port!

Each port is unique on a device.

DNS or Domain Name Service

It translates domain names to IP addresses.

what-is-dns.png

Why do we use names instead of IP addresses?

  • Humans are better at remembering words & names instead of numbers.

For example, www.facebook.com is converted to 69.63.176.13 (Mapping IP addresses to names).

How does DNS manage all these IP addresses?

  • Domain Names have a hierarchical structure.

Root Domains (there are 13 root domains named from a to m)

Top Level Domain

TopLevelDomainNames.jpg

There are also geographical domains that were added later.

domains.gif

Who manages these names?

Who can keeps the track of the availability of names?

This is all regulated by a dedicated organization called Internet Corporation for Assigned Names & Numbers*(ICANN)*.

ICANN.png

This organization manages the TLD development and architecture of the internet domain space and authorizes Domain Name Registrars, which register and assign domain names.

Each domain name can have a subdomain name with an IP address range of the domain name.

How does the DNS Resolution work?

rc24-how-dns-works.webp

DNS entries are cached for efficiency.

Networking Commands

  • ifconfig => shows all network details.

  • netstat => shows an active connection on your machine.

  • ps -aux => shows currently running applications on which port they are listening, computer resources they are consuming, etc.

  • nslookup => you can get the IP address of any domain name.

  • ping => checks whether a service/application is accessible.

These are used to troubleshoot your network.

  • And of course, there are parameters for all those commands.

Top comments (0)