Fundamentals

Networking Basics

How computers talk to each other β€” IP addresses, DHCP, NAT, SSH tunnels, SCP file transfers, and VM networking. The concepts every engineer needs to understand.

7 sections

networking essentials

~30 min

estimated reading

Beginner

no prerequisites

What is a Network?

A network is two or more computers connected so they can talk to each other. Your home WiFi is a network β€” your phone, laptop, and TV are all connected to the same router and can communicate.

Every device on a network gets an IP address β€” a unique number that identifies it, like a house address on a street. Without it, devices wouldn't know where to send data.

🏘️
Think of it this way...

Think of a network like a neighborhood. Every house (device) has a unique street address (IP address). When you send a letter (data), you write the destination address on it. The postal service (network) delivers it to exactly the right house. Without addresses, letters would just get lost.

Every Packet Has a Destination

When you watch YouTube, your computer sends thousands of tiny packets of data. Each packet has a destination IP address (YouTube's server) and a source IP address (your device). The network routes each packet to the right destination β€” like a postal system for data.

🏠

Your Home Network

Your phone, laptop, and TV connected via WiFi router. Private, local, only visible inside your home.

🏒

Company Network

Hundreds of computers, servers, and printers connected in an office. Managed by IT professionals.

🌍

The Internet

The world's largest network β€” millions of computers all connected, talking to each other globally.

πŸ’‘

Key Takeaway

A network is computers connected together to share data. Every device gets a unique IP address β€” like a house address β€” so data knows where to go. Your home WiFi is a network. The internet is just a massive global network of networks.

Private vs Public IP Addresses

There are two types of IP addresses, and understanding the difference is fundamental. Private IPs are used inside your home network. Public IPs are your identity on the internet.

Private IP Address

A private IP address is used only inside your local network (like your home WiFi). Devices on the same network use private IPs to talk to each other.

Common private IP ranges

192.168.x.xMost home routers use this range
10.x.x.xCommon in companies and offices
172.16.x.xLess common, but also private
  • Assigned by your router automatically (using DHCP)
  • Only visible to devices on the same network
  • Cannot be reached from the internet
  • Changes when you connect to a different WiFi
Your Home Network (192.168.1.x)
                    Router (192.168.1.1)
                         β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚              β”‚              β”‚
     Mac (.1.6)    iPhone (.1.10)   TV (.1.150)

Every device gets a unique last number.
They can all talk to each other using these addresses.

Public IP Address

A public IP address is your identity on the internet. The entire world can reach you through it.

  • Assigned by your ISP (Internet Service Provider β€” like AT&T, Comcast, Verizon)
  • Only your router has a public IP β€” your individual devices do NOT
  • Shared by all devices in your house
  • Can change periodically (your ISP may reassign it)
🀯

Did You Know?

Search β€œwhat is my ip” on Google to see your public IP address β€” it's what every website and server sees when you connect to them. Your phone and laptop both appear to come from the same public IP when they're on your home WiFi.

Private vs Public IP

FeaturePrivate IPPublic IP
VisibilityOnly inside your local networkVisible to the entire internet
Assigned byYour router (DHCP)Your ISP
Who has oneEvery device on your networkOnly your router
Shared?No β€” each device is uniqueYes β€” shared by all home devices
Changes?When you switch WiFi networksPeriodically, ISP may reassign
Example192.168.1.674.83.52.19
πŸ’‘

Key Takeaway

Private IPs work inside your home (192.168.x.x) β€” every device has one. Public IPs work on the internet β€” only your router has one, shared by all your devices. Think of private IP as your room number and public IP as your house's street address.

Your Router & NAT

Your router is the bridge between your home network and the internet. It has two IP addresses β€” one for each side. And it uses a clever process called NAT to translate between them.

Router as Bridge
THE INTERNET              YOUR ROUTER              YOUR HOME NETWORK

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  Public side:   β”‚
 Google, YouTube ◄──►  74.83.52.19   │◄──►  Mac    192.168.1.6
 Netflix, etc.      β”‚                 β”‚      iPhone  192.168.1.10
                    β”‚  Private side:  β”‚      TV      192.168.1.150
                    β”‚  192.168.1.1    β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

What is NAT?

Your devices can't talk to the internet directly β€” they only have private IPs that the internet doesn't understand. The router acts as a translator between private and public addresses. This process is called NAT (Network Address Translation).

🏒
Think of it this way...

Imagine a big company with hundreds of employees. They all work from the same office building (public IP). When they send a letter, it goes out with the company's address β€” not their personal home address. The company's receptionist (NAT) knows which employee each reply is meant for and routes it to the right desk (private IP).

NAT Step-by-Step: Searching Google

Here's exactly what happens when you search β€œwhat is Linux” from your Mac:

1

Mac (192.168.1.6) sends request to Router (192.168.1.1): "Hey router, I want to reach Google"

2

Router swaps the source IP. Changes "From: 192.168.1.6" β†’ "From: 74.83.52.19". Sends the request to Google.

3

Google receives it, sends response back to 74.83.52.19. Google has NO idea 192.168.1.6 exists β€” it only sees the router.

4

Router receives the response, remembers "this was for the Mac". Forwards it to 192.168.1.6.

5

You see search results on your Mac. πŸŽ‰

🀯

Did You Know?

All devices in your house share the same public IP. When Google sees a request from your house, it always sees 74.83.52.19 β€” whether it came from your Mac, iPhone, or TV. Your router keeps track of which device asked for what and routes replies correctly.

Your IP Changes With Every WiFi Network

When you connect to a new WiFi network, the new router assigns your device a new private IP. Your old IP is released.

IP addresses by location
At Home:         Home router gives your Mac  β†’  192.168.1.6

At Coffee Shop:  Their router gives your Mac  β†’  10.0.0.47

At University:   Their router gives your Mac  β†’  172.16.5.112

At Friend's:     Their router gives your Mac  β†’  192.168.0.23

Your MAC address (hardware ID) stays the same β€” only the IP changes.
πŸ’‘

Key Takeaway

Your router has two faces β€” a private IP for your home network and a public IP for the internet. NAT is the translation process that lets all your home devices share one public IP. Your private IP changes every time you connect to a new WiFi, but your hardware ID (MAC address) never changes.

DHCP β€” Auto IP Assignment

DHCP stands for Dynamic Host Configuration Protocol. It's the system that automatically assigns IP addresses when devices connect to a network. Without it, you'd have to manually type in an IP address every time you connected to WiFi.

🏨
Think of it this way...

Think of DHCP like a hotel receptionist. When you check in (connect to WiFi), the receptionist (router) gives you a room key with a room number (IP address). That room number is yours for your stay. When you check out (disconnect), the room number is freed up for the next guest. No need to choose your own room β€” it's all handled automatically.

How DHCP Works

DHCP Handshake
Step 1: Your Mac connects to WiFi
        Mac: "Hey, I'm new here. Can I get an IP address?"

Step 2: Router responds
        Router: "Sure, you can use 192.168.1.6"

Step 3: Mac uses that IP until it disconnects
        When you leave, the router reclaims that IP for
        someone else

βœ… With DHCP

Connect to WiFi. IP is automatically assigned. Everything just works. You don't think about it.

❌ Without DHCP

You'd need to manually enter an IP address, subnet mask, gateway, and DNS server every single time you connected anywhere.

πŸ’‘

Key Takeaway

DHCP is the invisible system that automatically hands out IP addresses. Your router is a DHCP server β€” it manages a pool of IP addresses and assigns them to devices as they connect. This is why you never have to type in an IP address when joining WiFi.

VM Networking (UTM)

When you create a VM in UTM (or VirtualBox/VMware), it creates a tiny private network between your Mac and the VM β€” completely inside your machine. This is how you SSH into a VM even with no WiFi.

Inside Your Mac β€” UTM Private Network
INSIDE YOUR MAC
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                                    β”‚
β”‚   UTM Private Network (192.168.64.x)               β”‚
β”‚                                                    β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚   β”‚  Mac side    β”‚ ◄─────► β”‚  Ubuntu VM     β”‚      β”‚
β”‚   β”‚ 192.168.64.1 β”‚         β”‚ 192.168.64.4   β”‚      β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β”‚                                                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

This network exists only inside your Mac.
Works even with no WiFi. Never changes.

Your Mac Has Multiple IPs at Once

This surprises most people β€” your Mac can have several IP addresses simultaneously, each for a different network:

192.168.1.6← on home WiFi (changes per network)
192.168.64.1← on UTM VM network (always the same)
127.0.0.1← localhost (always, on every computer)
🏠
Think of it this way...

Think of your Mac as a building with multiple entrances. One entrance faces your home WiFi (192.168.1.6). Another entrance faces the internal VM corridor (192.168.64.1). And there's a special door that only your Mac itself can use β€” localhost (127.0.0.1). All the same building, multiple addresses.

Your Learning Setup vs Real Job

Your VM SetupReal Job
ServerUbuntu VM on your MacUbuntu in a data center or AWS
Server IP192.168.64.4 (UTM)10.0.1.54 (company VPC)
How you connectssh charith@192.168.64.4ssh charith@10.0.1.54
NetworkUTM private bridgeCompany VPN or private cloud
The commandsIdentical βœ…Identical βœ…
πŸ’‘

Key Takeaway

VM networking creates a mini private network entirely inside your computer. Your Mac and VM communicate through this internal network using IPs like 192.168.64.x. Everything you practice on your VM works exactly the same on real servers β€” the only difference is the IP address.

SSH & SCP β€” Remote Access

SSH (Secure Shell) lets you remotely control another computer by typing commands in your terminal. Everything is encrypted β€” nobody can eavesdrop. SCP (Secure Copy) uses the same SSH tunnel to transfer files.

Breaking Down the SSH Command

SSH into a remote machine
▢️

Click the Play button above to start!

Watch the commands execute step by step

SSH Command Breakdown

PartMeaning
sshThe command β€” "open a secure encrypted connection"
charithUsername on the remote machine
@"at" β€” connecting these two pieces
192.168.64.4IP address of the remote machine
What SSH actually does
Your Mac Terminal                          Ubuntu VM
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    encrypted tunnel   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ You type     β”‚ ══════════════════════► Commands run  β”‚
β”‚ commands     β”‚                        HERE           β”‚
β”‚ here         β”‚ ◄══════════════════════ Output sent   β”‚
β”‚              β”‚                        back           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

You type on your Mac, but everything runs on the VM.

SCP β€” Copying Files Over SSH

SCP uses the same SSH tunnel but sends files instead of commands:

Copy a folder to the remote VM
▢️

Click the Play button above to start!

Watch the commands execute step by step

SCP Command Breakdown

PartMeaning
scpSecure Copy command
-rRecursive β€” copy entire folder and everything inside
~/Desktop/Linux_Proj/Source: folder on your Mac
charith@192.168.64.4:Remote machine (same format as SSH)
~/projects/Destination: where to put it on the VM
⚠️

Warning

SSH is picky about file permissions on your private key files. If you get a β€œPermission denied” error, check that your ~/.ssh/ folder has permission 700 and your key files have permission 600. SSH refuses to work if these are wrong β€” it's a security feature.

πŸ’‘

Key Takeaway

SSH gives you an encrypted remote terminal into any machine. SCP copies files through that same encrypted tunnel. Together they let engineers manage servers, deploy code, and transfer files β€” all securely, from anywhere in the world.

Finding Your IP Address

Knowing how to find IP addresses is a core sysadmin skill. Different operating systems use different commands, and you'll use these constantly when working with servers and VMs.

On Linux (Ubuntu VM)

ip a β€” show all interfaces
▢️

Click the Play button above to start!

Watch the commands execute step by step

On macOS

ifconfig β€” show network interfaces
▢️

Click the Play button above to start!

Watch the commands execute step by step

🀯

Did You Know?

ip a works on Linux but NOT on macOS. ifconfig works on macOS and older Linux systems. On modern Linux, ip a is the preferred command. To find your public IP (what the internet sees), just search β€œwhat is my ip” on Google from any device.

Quick Reference

Finding IP addresses on different systems

SystemCommand / Method
Linux (Ubuntu)ip a β†’ look for 'inet' that is NOT 127.0.0.1
macOSifconfig | grep 'inet ' β†’ ignore 127.0.0.1 and inet6
iPhoneSettings β†’ WiFi β†’ tap (i) next to network β†’ IP Address
Your public IPSearch 'what is my ip' on Google from any device

Common IP Address Cheat Sheet

AddressWhat It Is
127.0.0.1Localhost β€” any computer referring to itself
192.168.1.1Typical home router address
192.168.1.xDevices on a typical home network
192.168.64.1Your Mac on the UTM VM network
192.168.64.4Your Ubuntu VM (verify with ip a on VM)
10.x.x.xPrivate IPs common in offices and cloud
0.0.0.0"All interfaces" or "any address" in server configs
πŸ’‘

Key Takeaway

Use ip a on Linux and ifconfig on macOS to find IP addresses. Always ignore 127.0.0.1 (that's localhost β€” the computer talking to itself). On Linux, look for the 'inet' line that isn't 127.0.0.1 β€” that's your real IP on the network.

Networking Basics Quiz

1 / 6

What is a private IP address?

Networking Flashcards

Click any card to flip and reveal the definition.

What is a network?

Two or more computers connected so they can talk to each other. Your home WiFi is a network β€” your phone, laptop, and TV are all connected to the same router.

What is a private IP address?

An IP address used only inside your local network (like 192.168.x.x). Assigned by your router via DHCP. Not reachable from the internet. Changes when you connect to a different WiFi.

What is a public IP address?

Your identity on the internet. Assigned by your ISP. Only your router has one β€” all your devices share it. The internet only ever sees your public IP, never your private ones.

What is DHCP?

Dynamic Host Configuration Protocol β€” the system that automatically assigns IP addresses when devices connect to a network. Your router does this automatically every time you connect to WiFi.

What is NAT?

Network Address Translation β€” your router translates between private IPs (your devices) and the single public IP (what the internet sees). It's the bridge between your home network and the internet.

What is localhost / 127.0.0.1?

A special IP address that means 'this computer itself'. Every computer has 127.0.0.1 pointing to itself. Used for testing apps locally without a real network.

What does `ssh user@ip` do?

Opens an encrypted remote connection to another computer. 'user' is the username on the remote machine, 'ip' is its IP address. Everything you type runs on the remote machine.

What does SCP do?

Secure Copy β€” copies files between computers using the SSH tunnel. Same security as SSH but transfers files instead of commands. Use -r flag to copy entire folders.

What does `ip a` do?

Shows all network interfaces and IP addresses on your Linux machine. Look for 'inet' followed by an IP that is NOT 127.0.0.1 to find your actual IP address.

What is a port?

Like an apartment number. The IP address is the building, the port is which door. SSH uses port 22, HTTP uses port 80, HTTPS uses port 443.