Internet Infrastructure
The internet is a global network of interconnected computer networks. It's not owned by any single entity — it's a cooperative system of networks.
Physical Infrastructure
Home Router → ISP Network → Internet Backbone → ISP Network → Destination Server
| | | | |
Fiber/Cable Regional Hub Fiber Optic Regional Hub Data Center
(City Level) (Cross-Country) (City Level) (Cloud Provider)
Key Components
- End Devices: Computers, phones, servers
- Routers: Direct traffic between networks
- Switches: Connect devices within a network
- Cables: Fiber optic, copper, wireless
- Internet Exchange Points (IXPs): Physical locations where networks interconnect
Internet Service Providers (ISPs)
- Tier 1: Global backbone networks (e.g., AT&T, Lumen)
- Tier 2: Regional providers that peer with Tier 1
- Tier 3: Local ISPs that buy from Tier 2
Network Protocols
| Protocol | Purpose |
|---|---|
| TCP/IP | Reliable data transmission |
| UDP | Fast, unreliable transmission |
| DNS | Name resolution |
| HTTP/HTTPS | Web communication |
| SMTP | Email transmission |
IP Addresses
An IP address (Internet Protocol address) is a unique numerical identifier assigned to each device on a network.
IPv4 Format
192.168.1.1
|___| |__| |__| |__|
192 168 1 1
- 32-bit address
- 4 octets (0-255 each)
- ~4.3 billion unique addresses
- Nearly exhausted
IPv6 Format
2001:0db8:85a3:0000:0000:8a2e:0370:7334
- 128-bit address
- 8 groups of 4 hexadecimal digits
- ~3.4 × 10^38 unique addresses
- Solves IPv4 exhaustion
Types of IP Addresses
| Type | Range | Purpose |
|---|---|---|
| Public | 1.0.0.0 - 223.255.255.255 | Internet-facing |
| Private | 10.0.0.0 - 10.255.255.255 172.16.0.0 - 172.31.255.255 192.168.0.0 - 192.168.255.255 |
Local networks |
| Loopback | 127.0.0.0 - 127.255.255.255 | Localhost |
| Dynamic | Changes over time | DHCP assigned |
| Static | Fixed | Manual configuration |
Subnetting Basics
IP: 192.168.1.100
Mask: 255.255.255.0 (/24)
Network portion: 192.168.1
Host portion: .100
This means devices 192.168.1.1-254 are on the same network
Packets and Routing
Packet switching is the method used to transmit data across the internet. Data is broken into small chunks called packets.
Why Packets?
- Reliability: If one packet fails, only that packet needs retransmission
- Efficiency: Multiple connections can share network resources
- Speed: Packets can take different routes to destination
Packet Structure
+------------------+------------------+------------------+
| IP Header | TCP/UDP Header | Payload |
| (Source/Dest) | (Port Info) | (Actual Data) |
+------------------+------------------+------------------+
Routing Process
Source (192.168.1.10)
|
v
Router A → Looks up destination in routing table
|
v
Router B → Forwards based on best path
|
v
Router C → Final hop to destination network
|
v
Destination (10.0.0.50)
Key Networking Concepts
- NAT (Network Address Translation): Translates private IPs to public IPs
- DHCP: Automatically assigns IP addresses
- Gateway: Router that connects local network to internet
- Latency: Time for data to travel from source to destination
- Bandwidth: Maximum data transfer rate
Common Ports
| Port | Service |
|---|---|
| 80 | HTTP |
| 443 | HTTPS |
| 22 | SSH |
| 21 | FTP |
| 53 | DNS |
Practice Problems
Create a reusable React component implementing Internet Basics. Include proper state management and accessibility.
Solution
// Production-ready component with:
// - Proper TypeScript types
// - Accessibility (ARIA)
// - Error boundaries
// - Loading states
// - Memoization where neededWrite unit and integration tests for Internet Basics using React Testing Library.
Solution
// Test coverage:
// 1. Rendering tests
// 2. Interaction tests
// 3. Edge case tests
// 4. Accessibility testsOptimize Internet Basics for performance. Consider memoization, code splitting, and bundle size.
Solution
// Optimization techniques:
// 1. React.memo / useMemo / useCallback
// 2. Code splitting with lazy()
// 3. Virtual scrolling for lists
// 4. Image lazy loading
// 5. Bundle analysisQuiz
1. How many bits are in an IPv4 address?
2. What is the purpose of NAT (Network Address Translation)?
3. Which port is used by HTTPS?
4. What does DHCP stand for?
Flashcards
Question
What is the difference between IPv4 and IPv6?
Click to reveal answer
Answer
IPv4 uses 32-bit addresses (~4.3 billion), IPv6 uses 128-bit addresses (~3.4×10^38). IPv6 solves address exhaustion.
Question
What is packet switching?
Click to reveal answer
Answer
A method of transmitting data by breaking it into small chunks (packets) that can take different routes to the destination.
Question
What is the difference between public and private IP addresses?
Click to reveal answer
Answer
Public IPs are routable on the internet. Private IPs are used within local networks and need NAT to access the internet.
Question
What is Internet Basics?
Click to reveal answer
Answer
Internet Basics is a key concept in frontend development.
Question
When to use Internet Basics?
Click to reveal answer
Answer
Use Internet Basics when building production systems that require reliability, scalability, and maintainability.
Revision Notes
Key Takeaways
- 1.The internet is a network of networks, not owned by any single entity
- 2.IP addresses uniquely identify devices on a network
- 3.Packet switching enables efficient, reliable data transmission
- 4.NAT allows multiple devices to share one public IP address
Interview Tips
- •Know the difference between IPv4 and IPv6 formats
- •Understand why packet switching is more reliable than circuit switching
- •Be able to explain the difference between public and private IP addresses
- •Know common port numbers (80, 443, 22, 53)
Cheat Sheet
Internet Basics Cheat Sheet
IP Address Types:
- IPv4: 32-bit (192.168.1.1)
- IPv6: 128-bit (2001:db8::1)
- Private: 10.x.x.x, 172.16-31.x.x, 192.168.x.x
Key Protocols:
- TCP/IP: Reliable transmission
- UDP: Fast, unreliable
- DHCP: Auto IP assignment
- DNS: Name resolution
Packet Switching:
- Data broken into packets
- Each packet routed independently
- Packets reassembled at destination