Lecture 1

March 12, 2025

Ip, Dns, domains, Vpn, protocols, http

Networking and Web Fundamentals

IP (Internet Protocol)

Internet Protocol (IP) is the fundamental addressing system that makes the internet work. Think of it as the postal system for the digital world. Just as your house has a unique address that allows mail to find you, every device connected to the internet has a unique IP address that allows data to find it.

What is an IP Address?

An IP address is a unique numerical label assigned to each device connected to a computer network. The most common type you’ll encounter is IPv4, which looks like this: 192.168.1.1

These addresses consist of four numbers separated by periods, with each number ranging from 0 to 255. This gives us approximately 4.3 billion possible addresses.

Why IPs Are Useful

IP addresses serve several crucial functions:

  1. Unique Identification: Every device needs a unique identifier on a network. Without this, data wouldn’t know where to go or where it came from.

  2. Routing: IP addresses enable routers to direct traffic across the internet. When you send data, routers look at the destination IP address and determine the best path for your data to travel.

  3. Location Information: IP addresses can provide geographic information about where a device is located (though not always precisely).

  4. Network Organization: IP addresses help organize networks into subnets, allowing administrators to manage large networks efficiently.

  5. Access Control: Systems can use IP addresses to allow or block specific connections, forming the basis of many security systems.

How IPs Are Used

IP addresses are used in numerous ways across networks and the internet:

  1. Web Browsing: When you visit a website, your computer initiates a connection to the server’s IP address.

  2. Remote Services: Services like SSH, FTP, and email all rely on IP addresses to connect to remote systems.

  3. Network Troubleshooting: Tools like ping and traceroute use IP addresses to test connectivity and diagnose network problems.

  4. Security Policies: Firewalls and access control lists use IP addresses to determine which traffic should be allowed or blocked.

  5. Content Delivery: Content Delivery Networks (CDNs) use IP addresses to direct users to the closest server, reducing load times.

  6. Geolocation Services: Many online services use IP addresses to provide location-relevant content, from weather forecasts to local news.

Public vs. Private IP Addresses

  • Public IP Address: Assigned by your Internet Service Provider (ISP) and visible to the entire internet. This is how your home network appears to the outside world.
  • Private IP Address: Used within your local network and not visible to the internet. Common private IP ranges include:
    • 192.168.0.0 - 192.168.255.255
    • 10.0.0.0 - 10.255.255.255
    • 172.16.0.0 - 172.31.255.255

Your router performs Network Address Translation (NAT) to map private IP addresses to your public IP, allowing multiple devices in your home to share one public IP address.

Static vs. Dynamic IP Addresses

  • Static IP: Remains the same over time. Useful for servers that need to be found at the same address consistently.
  • Dynamic IP: Changes periodically. Most home internet connections use dynamic IPs that are reassigned by your ISP.

DNS (Domain Name System)

While computers and networks work with IP addresses, humans prefer names that are easier to remember. The Domain Name System (DNS) acts as a translator between human-friendly domain names and computer-friendly IP addresses.

How DNS Works

When you type a website address like “google.com” into your browser, your computer doesn’t initially know which IP address to connect to. Here’s the step-by-step process:

  1. Your computer checks its local cache to see if it already knows the IP address for google.com
  2. If not, it asks your configured DNS server (usually provided by your ISP)
  3. If your ISP’s DNS server doesn’t know, it starts a chain of queries:
    • It asks a root DNS server (there are 13 sets of these worldwide)
    • The root server directs it to the Top-Level Domain (TLD) servers for “.com”
    • The .com TLD server directs it to Google’s authoritative DNS servers
    • Google’s DNS servers provide the actual IP address
  4. Your ISP’s DNS server returns this IP address to your computer and also caches it for future use
  5. Your computer connects to the IP address and loads the website

This entire process typically happens in milliseconds!

What Is a DNS Record?

A DNS record is simply an entry in a DNS database that maps a domain name (or part of a domain name) to some value. The most common type of record maps a domain name directly to an IP address, but records can also point to other domain names, specify mail servers, or contain other types of information.

Think of DNS records as the individual entries in a phone book. Each record has a specific purpose and tells the internet how to handle requests for that domain.

Domains

A domain name is your identity on the internet. It’s what users type into their browsers to find your website.

Domain Structure

Let’s break down “blog.example.com”:

  • Root Domain: The internet itself (represented by a dot that’s usually invisible at the end)
  • Top-Level Domain (TLD): .com
  • Second-Level Domain: example
  • Subdomain: blog

The combination “example.com” is what you purchase from a domain registrar.

Domain Registration Process

  1. Check if your desired domain name is available through a domain registrar (like GoDaddy, Namecheap, or Google Domains)
  2. Purchase the domain for a period (usually 1-10 years)
  3. The registrar adds your information to the WHOIS database (unless you’ve purchased privacy protection)
  4. You configure the DNS settings to point to your hosting service

TLDs (Top-Level Domains)

There are several types of TLDs:

  • Generic TLDs (gTLDs): .com, .org, .net, .gov, .edu
  • Country Code TLDs (ccTLDs): .uk (United Kingdom), .jp (Japan), .ca (Canada)
  • New gTLDs: .app, .blog, .shop, .tech

Each TLD has its own rules, costs, and restrictions. Some are open to anyone, while others (like .edu or .gov) are restricted to specific types of organizations.

Domain vs. Hosting

It’s important to understand that a domain name is separate from web hosting:

  • Your domain is your address on the internet
  • Your hosting is the actual space where your website files are stored

You can purchase them from the same company or from different providers. The DNS settings of your domain are configured to point to your hosting server.

VPN (Virtual Private Network)

A VPN creates a secure, encrypted tunnel between your device and a server operated by the VPN service. This has several important implications for privacy and security.

How VPNs Work

  1. You install a VPN client on your device and connect to a VPN server
  2. The VPN creates an encrypted tunnel for all your internet traffic
  3. Your data travels through this encrypted tunnel to the VPN server
  4. The VPN server sends your traffic to its final destination
  5. Responses return to the VPN server and then back to you through the encrypted tunnel

Key VPN Benefits

  • Privacy: Your ISP can’t see what websites you’re visiting, only that you’re connected to a VPN
  • Security: Your data is encrypted, protecting it on unsecured networks (like public Wi-Fi)
  • Location Masking: Your traffic appears to come from the VPN server’s location, not your actual location
  • Access Control: Some VPNs allow you to bypass regional restrictions on content

Protocol

In networking, a protocol is a set of rules that govern how data is exchanged between devices. Think of protocols as languages that devices use to communicate with each other.

Key Internet Protocols

  • TCP (Transmission Control Protocol): TCP is responsible for delivering data reliably between applications. It ensures data packets arrive in the correct order and without errors. If a packet is lost during transmission, TCP requests a retransmission. This makes TCP ideal for situations where accuracy is more important than speed, like browsing websites, sending emails, or transferring files.

  • HTTP/HTTPS (Hypertext Transfer Protocol): These protocols are specifically designed for web browsing. HTTP defines how messages are formatted and transmitted across the web, and what actions web servers and browsers should take in response to various commands. HTTPS is the secure version of HTTP, which encrypts the data being transmitted to protect it from eavesdroppers and attackers.

HTTP (Hypertext Transfer Protocol)

HTTP is the foundation of data communication on the World Wide Web. It’s the protocol that allows your browser to request web pages from servers and receive their responses.

What HTTP Is Used For

HTTP was designed specifically for the World Wide Web and serves several key purposes:

  1. Retrieving Web Content: Its primary purpose is to fetch HTML documents (web pages) that can then be displayed in your browser.

  2. Transferring Different Media Types: Beyond just text and HTML, HTTP can transfer images, videos, audio files, PDFs, and virtually any type of digital content.

  3. API Communication: Modern web applications use HTTP to communicate between the front-end (what you see in the browser) and back-end services. This is typically done through RESTful APIs or GraphQL endpoints that exchange data in formats like JSON or XML.

  4. Form Submissions: When you fill out a form on a website, HTTP is used to send that data to the server for processing.

  5. Authentication: HTTP provides mechanisms for verifying the identity of users through methods like cookies, HTTP authentication, and OAuth tokens.

  6. State Management: Through cookies and other mechanisms, HTTP can help maintain state across multiple requests (remembering who you are as you browse different pages).

  7. Content Negotiation: HTTP allows clients and servers to agree on what format data should be delivered in, based on what the client supports.

Request-Response Model

HTTP follows a client-server model where:

  1. The client (usually a web browser) sends a request to a server
  2. The server processes the request and sends back a response

This is a stateless protocol, meaning each request-response pair is independent and the server doesn’t maintain any information about past requests (though technologies like cookies help work around this limitation).

HTTP Requests

An HTTP request consists of:

  • Request Line: Contains the method, URL, and HTTP version
  • Headers: Additional information about the request
  • Body: Optional data sent to the server (used with POST, PUT methods)

Example HTTP request:

GET /index.html HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0
Accept: text/html

HTTP Methods

HTTP defines several methods (or verbs) that indicate the desired action to be performed:

  • GET: Retrieve data from a specified resource
  • POST: Submit data to be processed to a specified resource
  • PUT: Update a specified resource with new data
  • DELETE: Delete a specified resource
  • HEAD: Same as GET but returns only headers, no body
  • OPTIONS: Returns the HTTP methods that the server supports
  • PATCH: Apply partial modifications to a resource

HTTP Responses

An HTTP response consists of:

  • Status Line: Contains the HTTP version, status code, and status text
  • Headers: Additional information about the response
  • Body: The actual content being returned (like HTML, JSON, images)

Example HTTP response:

HTTP/1.1 200 OK
Date: Mon, 23 May 2022 22:38:34 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 138

<!DOCTYPE html>
<html>
<head>
  <title>Example Page</title>
</head>
<body>
  <h1>Hello, World!</h1>
</body>
</html>

HTTP Status Codes

Status codes indicate the result of the HTTP request:

  • 1xx (Informational): Request received, continuing process
  • 2xx (Successful): Request successfully received, understood, and accepted
    • 200 OK: Standard success response
    • 201 Created: Resource created successfully
    • 204 No Content: Request succeeded but no content returned
  • 3xx (Redirection): Further action needed to complete the request
    • 301 Moved Permanently: Resource has moved permanently
    • 302 Found: Resource temporarily moved
    • 304 Not Modified: Resource hasn’t changed since last request
  • 4xx (Client Error): Request contains bad syntax or cannot be fulfilled
    • 400 Bad Request: Server couldn’t understand the request
    • 401 Unauthorized: Authentication required
    • 403 Forbidden: Server understood but refuses to authorize
    • 404 Not Found: Resource not found
    • 429 Too Many Requests: Rate limit exceeded
  • 5xx (Server Error): Server failed to fulfill a valid request
    • 500 Internal Server Error: Generic server error
    • 502 Bad Gateway: Invalid response from upstream server
    • 503 Service Unavailable: Server temporarily unavailable
    • 504 Gateway Timeout: Gateway timeout

HTTP vs. HTTPS

HTTPS (HTTP Secure) is the encrypted version of HTTP. It uses SSL/TLS protocols to encrypt communications, providing:

  • Privacy: Data cannot be read by third parties
  • Integrity: Data cannot be modified in transit
  • Authentication: Confirms you’re communicating with the intended website

When you see a padlock icon in your browser’s address bar, it indicates the connection is secure using HTTPS.

< Look at other lectures