Day 5
Agenda
- Day 5
- Agenda
- Networking Concepts and TCP/IP Protocol Suite
- Introduction to Networking Concepts
- Understanding LAN, WAN, and Internet
- Overview of the OSI Model
- Activities: Network Diagram Creation, OSI Model Mapping
- TCP/IP Protocol Suite
- IP Addressing and Subnetting Basics
- Common Protocols: HTTP, FTP, SMTP
- Activities: Subnet Calculations, Protocol Identification, Wireshark Demonstration
- Network Devices and Troubleshooting
- Servers: Linux Web Server Setup
- Setting Up a Linux Server Environment
- Server vs. Desktop Environments
- Installing Server Packages
- Configuring SSH for Remote Access
- Activities: Server Setup and Configuration
- Servers: Linux Web Server Configuration
- Installing and Configuring a Web Server
- Managing Services on Linux
- Activities: Web Page Creation and Firewall Configuration
- Course Wrap-Up and Q\&A
- Practical Exercises and Final Q\&A
- Additional Resources
- Key Takeaways
Networking Concepts and TCP/IP Protocol Suite
Introduction to Networking Concepts
Understanding LAN, WAN, and Internet
Networking is the practice of connecting computers and other devices to share resources and communicate. Understanding basic networking concepts is essential for IT professionals.
Local Area Network (LAN):
- Definition: A network that covers a small geographic area, such as a home, office, or building.
- Characteristics:
- High data transfer rates.
- Owned and managed by a single organization or individual.
- Uses Ethernet or Wi-Fi technologies.
- Use Cases: Connecting computers, printers, and other devices within a single location.
Wide Area Network (WAN):
- Definition: A network that covers a broad area, connecting multiple LANs across cities, countries, or even continents.
- Characteristics:
- Lower data transfer rates compared to LANs due to longer distances.
- Uses technologies like leased lines, satellite links, or the internet.
- Use Cases: Connecting branch offices of a corporation, internet service providers (ISPs).
Internet:
- Definition: A global system of interconnected computer networks that use the TCP/IP protocol suite to communicate.
- Characteristics:
- Largest WAN in existence.
- Publicly accessible and decentralized.
- Enables services like the World Wide Web, email, and file transfer.
- Use Cases: Accessing websites, sending emails, streaming media.
Overview of the OSI Model
The Open Systems Interconnection (OSI) Model is a conceptual framework used to understand and implement standard protocols in seven layers. It helps standardize networking protocols to allow communication between different systems.
The Seven Layers of the OSI Model:
-
Physical Layer (Layer 1):
-
Function: Transmits raw bit streams over a physical medium.
-
Components: Cables, connectors, hubs, and other hardware.
-
Data Link Layer (Layer 2):
-
Function: Provides node-to-node data transfer and handles error correction from the physical layer.
-
Components: Switches, bridges, MAC addresses.
-
Network Layer (Layer 3):
-
Function: Determines how data is sent to the receiving device, including routing through different networks.
-
Components: Routers, IP addresses.
-
Transport Layer (Layer 4):
-
Function: Provides reliable data transfer services to the upper layers.
-
Components: TCP and UDP protocols, port numbers.
-
Session Layer (Layer 5):
-
Function: Manages sessions between applications.
-
Components: Session establishment, maintenance, and termination.
-
Presentation Layer (Layer 6):
-
Function: Translates data between the application layer and the network format, including encryption and compression.
-
Components: Data representation formats, encryption protocols.
-
Application Layer (Layer 7):
- Function: Provides services directly to user applications.
- Components: HTTP, FTP, SMTP, DNS protocols.
Importance of the OSI Model:
- Standardization: Provides a universal set of standards for different systems to communicate.
- Troubleshooting: Helps isolate network issues to specific layers.
- Educational Tool: Simplifies complex networking concepts.
Activities: Network Diagram Creation, OSI Model Mapping
45-60 minutes
-
Network Diagram Creation (20 minutes):
-
Objective: Visualize LAN, WAN, and internet connections.
-
Instructions:
- Draw a diagram of a home network (LAN) connecting to the internet (WAN).
- Include devices like routers, switches, and computers.
- Show how the LAN connects to the ISP's network and then to the internet.
-
OSI Model Mapping (20 minutes):
-
Objective: Relate real-world protocols and devices to OSI layers.
-
Instructions:
- Create a table listing each OSI layer.
- For each layer, list examples of protocols and devices.
- Discuss how data flows through the layers during communication.
-
Group Discussion (15 minutes):
- Objective: Reinforce understanding of networking concepts.
- Instructions:
- Discuss scenarios where understanding the OSI model helps troubleshoot network issues.
- Share experiences of network problems and identify which OSI layer was involved.
TCP/IP Protocol Suite
IP Addressing and Subnetting Basics
IP Addressing:
- Definition: An IP (Internet Protocol) address is a unique numerical label assigned to each device connected to a network that uses the IP for communication.
- Versions:
- IPv4: 32-bit address divided into four octets (e.g., 192.168.1.1).
- IPv6: 128-bit address designed to overcome IPv4 exhaustion (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334).
IPv4 Address Classes:
- Class A: 1.0.0.0 to 126.255.255.255 (Large networks)
- Class B: 128.0.0.0 to 191.255.255.255 (Medium networks)
- Class C: 192.0.0.0 to 223.255.255.255 (Small networks)
- Class D: 224.0.0.0 to 239.255.255.255 (Multicast)
- Class E: 240.0.0.0 to 254.255.255.254 (Experimental)
Private IP Addresses:
- Purpose: Used within private networks, not routable on the internet.
- Ranges:
- 10.0.0.0 to 10.255.255.255
- 172.16.0.0 to 172.31.255.255
- 192.168.0.0 to 192.168.255.255
Subnetting Basics:
- Subnet Mask: Determines which portion of the IP address is the network part and which is the host part.
- Common Subnet Masks:
- 255.0.0.0 (/8): Class A default
- 255.255.0.0 (/16): Class B default
- 255.255.255.0 (/24): Class C default
CIDR Notation:
- Classless Inter-Domain Routing: Denotes the subnet mask with a suffix (e.g., /24).
- Example: 192.168.1.0/24
Benefits of Subnetting:
- Reduces network congestion.
- Improves security by isolating network segments.
- Efficient IP address utilization.
Common Protocols: HTTP, FTP, SMTP
Hypertext Transfer Protocol (HTTP):
- Port: 80 (HTTP), 443 (HTTPS)
- Purpose: Used for transferring web pages on the internet.
- HTTPS: Secure version of HTTP using SSL/TLS encryption.
File Transfer Protocol (FTP):
- Port: 20 (Data), 21 (Control)
- Purpose: Transfers files between client and server.
- Security Considerations: Transmits data in plaintext; SFTP or FTPS are secure alternatives.
Simple Mail Transfer Protocol (SMTP):
- Port: 25, 587 (submission), 465 (SMTPS)
- Purpose: Sends emails from client to server and between servers.
- Related Protocols:
- POP3 (Post Office Protocol 3): Retrieves emails from server to client.
- IMAP (Internet Message Access Protocol): Manages emails directly on the server.
Activities: Subnet Calculations, Protocol Identification, Wireshark Demonstration
45-60 minutes
-
Calculate Subnets (20 minutes):
-
Objective: Practice subnetting.
-
Instructions:
- Given an IP address and subnet mask (e.g., 192.168.1.0/24), calculate:
- Number of possible hosts.
- Network address.
- Broadcast address.
- Use subnetting calculators to verify answers.
-
Protocol Identification (15 minutes):
-
Objective: Recognize protocols and their uses.
-
Instructions:
- Match protocols (HTTP, FTP, SMTP) with their descriptions.
- Discuss real-world applications of each protocol.
-
Wireshark Demonstration (20 minutes):
- Objective: Observe network traffic.
- Instructions:
- Use Wireshark (network protocol analyzer) to capture and analyze packets.
- Filter traffic to view HTTP or ICMP packets.
- Note: Ensure compliance with privacy policies; only capture traffic on your own network.
Network Devices and Troubleshooting
Network Devices
Routers, Switches, and Hubs
Routers:
- Function: Connects multiple networks and routes network traffic between them.
- Features:
- Determines the best path for data packets.
- Connects LANs to WANs (e.g., home network to the internet).
- Provides network address translation (NAT) and firewall capabilities.
Switches:
- Function: Connects devices within a single network (LAN) and forwards data to the correct destination.
- Features:
- Operates at Layer 2 (Data Link) of the OSI model.
- Uses MAC addresses to forward data.
- Supports full-duplex communication, reducing collisions.
Hubs:
- Function: Connects multiple Ethernet devices, making them act as a single network segment.
- Features:
- Operates at Layer 1 (Physical) of the OSI model.
- Broadcasts incoming data to all ports, leading to network congestion.
- Considered obsolete and replaced by switches.
Comparison:
-
Efficiency:
-
Router: Routes traffic intelligently between networks.
- Switch: Directs data to specific devices within a network.
-
Hub: Sends data to all devices, inefficient.
-
Use Cases:
- Router: Internet connectivity, inter-network communication.
- Switch: Expanding LANs, connecting multiple devices efficiently.
- Hub: Legacy networks; not recommended for modern setups.
Activities: Device Identification, Network Design Exercise
30 minutes
-
Device Identification (15 minutes):
-
Objective: Recognize network devices and their roles.
-
Instructions:
- Examine physical network devices or images.
- Identify whether each is a router, switch, or hub.
- Discuss the functions and features of each device.
-
Network Design Exercise (15 minutes):
- Objective: Apply knowledge of network devices.
- Instructions:
- Design a simple network diagram connecting multiple computers, printers, and internet access.
- Choose appropriate devices (routers and switches) and justify the selection.
Network Troubleshooting
Using ping, tracert, and Other Tools
ping:
- Purpose: Tests connectivity between two network devices by sending ICMP Echo Request messages.
- Usage:
ping [destination]- Example:
ping google.com - Interpreting Results:
- Replies: Indicates successful connectivity.
- Packet Loss: May suggest network issues.
- Latency (ms): Round-trip time; high values may indicate delays.
tracert (Windows) / traceroute (Linux):
- Purpose: Traces the path packets take from source to destination, showing each hop along the way.
- Usage:
- Windows:
tracert [destination] - Linux:
traceroute [destination] - Example:
tracert google.com - Interpreting Results:
- Lists each hop with IP address and response times.
- Identifies where delays or failures occur.
Other Tools:
ipconfig(Windows) /ifconfigorip(Linux):- Purpose: Displays network configuration details.
- Usage:
- Windows:
ipconfig /all - Linux:
ifconfigorip addr
- Windows:
nslookup:- Purpose: Queries DNS to obtain domain name or IP address mapping.
- Usage:
nslookup [domain] netstat:- Purpose: Displays network connections, routing tables, and interface statistics.
- Usage:
netstat -a
Activities: Connectivity Tests, Trace Routes, Network Configuration
30-45 minutes
-
Connectivity Tests (15 minutes):
-
Objective: Use
pingto test network connections. -
Instructions:
- Ping local devices (e.g., your router at 192.168.1.1).
- Ping external websites (e.g.,
ping google.com). - Observe response times and packet loss.
-
Trace Routes (15 minutes):
-
Objective: Trace the path to a remote server.
-
Instructions:
- Use
tracertortracerouteto a website. - Analyze the number of hops and identify any delays.
- Discuss how this information can help troubleshoot network issues.
- Use
-
Network Configuration (15 minutes):
- Objective: View and understand network settings.
- Instructions:
- Use
ipconfigorifconfigto display IP addresses, subnet masks, and gateways. - Identify your IP address and default gateway.
- Discuss the significance of each piece of information.
- Use
Servers: Linux Web Server Setup
Setting Up a Linux Server Environment
Server vs. Desktop Environments
Server Environment:
- Purpose: Provides services to other computers over a network.
- Characteristics:
- Minimal graphical user interface (GUI) or command-line only.
- Optimized for performance, security, and stability.
- Runs server applications (e.g., web server, database server).
- Common Distributions: Ubuntu Server, CentOS, Debian.
Desktop Environment:
- Purpose: Designed for end-users to perform daily tasks.
- Characteristics:
- Full GUI with desktop, icons, and windows.
- Comes with pre-installed applications for productivity and media.
- Common Distributions: Ubuntu Desktop, Linux Mint, Fedora.
Differences:
- Resource Usage: Servers minimize resource consumption to allocate more to services.
- Interface: Servers often lack a GUI to reduce overhead.
Installing Server Packages
Prerequisites:
- A Linux system (preferably a server distribution).
- Administrative (root or sudo) privileges.
- Internet connectivity for package installation.
Updating the System:
sudo apt update
sudo apt upgrade
Installing Common Server Packages:
OpenSSH Server
- Purpose: Allows remote login via SSH.
- Installation:
sudo apt install openssh-server
Web Servers
- Apache:
sudo apt install apache2
- Nginx:
sudo apt install nginx
Database Servers
- MySQL/MariaDB:
sudo apt install mysql-server
- PostgreSQL:
sudo apt install postgresql
Additional Tools
- FTP Server (vsftpd):
sudo apt install vsftpd
- PHP:
sudo apt install php libapache2-mod-php
Configuring SSH for Remote Access
SSH (Secure Shell)
- Purpose: Provides secure encrypted communication between two untrusted hosts.
- Default Port: 22
Checking SSH Service Status
sudo systemctl status ssh
Starting and Enabling SSH Service
sudo systemctl start ssh
sudo systemctl enable ssh
Configuring SSH Settings
- Configuration File:
/etc/ssh/sshd_config - Common Settings:
- Change Default Port:
- Uncomment and modify
Port 22to a different port (e.g.,Port 2222).
- Uncomment and modify
- Disable Root Login:
- Change
PermitRootLogin yestoPermitRootLogin no.
- Change
- Allow Specific Users:
- Add
AllowUsers usernameto restrict access.
- Add
Restarting SSH Service After Configuration Changes
sudo systemctl restart ssh
Connecting to the Server via SSH
- Syntax:
ssh username@server_ip_address
- Example:
ssh alice@192.168.1.100
Activities: Server Setup and Configuration
45-60 minutes
- Install OpenSSH Server (15 minutes):
- Objective: Enable remote access to your server.
- Instructions:
- Install OpenSSH Server.
- Start and enable the SSH service.
- Verify that you can connect to the server from another machine.
- Configure SSH Settings (15 minutes):
- Objective: Secure the SSH service.
- Instructions:
- Edit
sshd_configto disable root login. - Change the default SSH port.
- Restart the SSH service.
- Test the new configuration.
- Edit
- Install Additional Server Packages (15 minutes):
- Objective: Set up services for future use.
- Instructions:
- Install Apache or Nginx web server.
- Verify the installation by accessing the default web page.
- Update and Secure the System (15 minutes):
- Objective: Ensure the server is up-to-date and secure.
- Instructions:
- Run system updates.
- Set up a regular update schedule or automate updates.
- Install and configure
ufwfirewall to allow necessary ports.
Servers: Linux Web Server Configuration
Installing and Configuring a Web Server
Install either Apache or Nginx as the web server to serve web pages and applications. Both are popular choices with different configurations.
Apache Installation
sudo apt install apache2
Nginx Installation
sudo apt install nginx
Testing the Web Server
- Open a web browser and navigate to
http://server_ip_address. - You should see the default Apache or Nginx welcome page.
Serving Static Web Pages
- Web Root Directory:
- Apache:
/var/www/html - Nginx:
/var/www/htmlor/usr/share/nginx/html
Creating a Simple HTML Page
sudo nano /var/www/html/index.html
- Add the following content:
sample index.html (right click and save as index.html)
<!DOCTYPE html>
<html>
<head>
<title>Welcome to My Web Server</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is a test page.</p>
</body>
</html>
-
Save and Exit:
-
Press
Ctrl + X, thenY, andEnter. -
Testing the Page:
- Refresh the web browser to see the new content.
Managing Services on Linux
Starting, Stopping, and Enabling Services
-
Systemctl Commands:
-
Start a Service:
sudo systemctl start service_name
- Stop a Service:
sudo systemctl stop service_name
- Restart a Service:
sudo systemctl restart service_name
- Enable a Service at Boot:
sudo systemctl enable service_name
- Disable a Service at Boot:
sudo systemctl disable service_name
- Check Service Status:
sudo systemctl status service_name
Examples
- Apache:
sudo systemctl restart apache2
- Nginx:
sudo systemctl restart nginx
Activities: Web Page Creation and Firewall Configuration
45-60 minutes
Create a Custom Web Page
20 minutes
- Objective: Serve your own content.
- Instructions:
- Create an
index.htmlfile in the web root directory. - Add custom HTML content.
- Access the page via a web browser.
Manage Web Server Service
15 minutes
- Objective: Control the web server service.
- Instructions:
- Stop the web server service and observe the result in the browser.
- Start the service again.
- Enable the service to start on boot.
Configure Firewall for Web Traffic
15 minutes
- Objective: Allow HTTP and HTTPS traffic.
- Instructions:
- Use
ufwto allow ports 80 (HTTP) and 443 (HTTPS):
sudo ufw allow 80
sudo ufw allow 443
- Verify the firewall status:
sudo ufw status
Course Wrap-Up and Q&A
Security Considerations for Web Servers
Firewall Configuration
Importance: Protects the server from unauthorized access and attacks.
Using UFW (Uncomplicated Firewall)
- Enable UFW:
sudo ufw enable
- Allow SSH (if changed from default port):
sudo ufw allow 2222/tcp
- Allow HTTP and HTTPS:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
-
Deny All Other Incoming Traffic:
-
UFW by default denies all incoming connections not explicitly allowed.
-
Check UFW Status:
sudo ufw status verbose
Securing Web Server Files
File Permissions
- Ensure web content files are owned by the appropriate user and group.
- Set correct permissions to prevent unauthorized access.
Disable Directory Listing
- Apache: Modify
/etc/apache2/apache2.confor site-specific configuration.
<Directory /var/www/html>
Options -Indexes
</Directory>
- Nginx: In the server block, add:
autoindex off;
Keep Software Updated
- Regularly update the server and applications to patch vulnerabilities.
Use SSL/TLS Certificates
- Implement HTTPS to encrypt data in transit.
- Use Let's Encrypt for free SSL certificates.
Monitor Logs
- Regularly check server logs for suspicious activity.
- Logs are typically located in
/var/log/apache2/or/var/log/nginx/.
Reviewing Key Concepts
-
Networking Fundamentals:
-
Understanding of LAN, WAN, OSI model.
-
Familiarity with IP addressing and common protocols.
-
Network Devices and Troubleshooting:
-
Roles of routers, switches, and hubs.
-
Using tools like
pingandtracertfor troubleshooting. -
Linux Server Management:
-
Difference between server and desktop environments.
- Installing and configuring server packages.
-
Managing services with
systemctl. -
Web Server Setup:
-
Installing Apache or Nginx.
- Serving static web pages.
- Ensuring security best practices.
Discussing Next Steps for Continued Learning
-
Further Topics to Explore:
-
Advanced Networking:
- Subnetting in-depth, VLANs, VPNs.
- Server Administration:
- Database management, load balancing, containerization (Docker).
- Scripting and Automation:
- Advanced shell scripting, Python programming.
-
Security:
- Penetration testing, ethical hacking, security certifications.
-
Certifications to Consider:
-
CompTIA Network+
- CompTIA Security+
- Linux Professional Institute Certification (LPIC)
-
Certified Ethical Hacker (CEH)
-
Resources for Continued Learning:
-
Online Courses:
- Coursera, edX, Udemy.
-
Books:
- The Linux Command Line by William Shotts.
- Networking All-in-One For Dummies by Doug Lowe.
-
Community Involvement:
-
Join forums like Stack Overflow, Reddit's r/learnprogramming.
- Participate in open-source projects on GitHub.
Practical Exercises and Final Q&A
Hands-On Activities
60 minutes
Complete Web Server Setup
30 minutes
- Finalize the configuration of your web server.
- Ensure that your server is secure and accessible.
Network Troubleshooting Scenario
15 minutes
- Given a simulated network issue, use tools to diagnose and resolve the problem.
Security Audit
15 minutes
- Review your server's security settings.
- Implement any additional measures as needed.
Closing Questions
- Any questions about any of the topics covered today?
TODO: Provide clarifications and additional examples as needed.
Additional Resources
Articles
Networking Concepts Articles
- How Networks Work: https://computer.howstuffworks.com/computer-networking-channel.htm (A more casual and accessible explanation with helpful visuals.)
- Understanding the OSI Model: https://www.imperva.com/learn/application-security/osi-model/ (A detailed guide with a focus on security implications.)
- OSI Model Explained: https://www.cloudflare.com/learning/ddos/glossary/open-systems-interconnection-model-osi/ (Concise explanation with a networking focus.)
- What is an IP Address?: https://www.kaspersky.com/resource-center/definitions/what-is-an-ip-address (Easy-to-understand explanation of IP addresses.)
- IP Subnetting: https://www.cisco.com/c/en/us/support/docs/ip/routing-information-protocol-rip/13788-3.html (Cisco's guide to subnetting, a bit technical but thorough.)
- HTTP Basics: https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview (Mozilla's comprehensive guide to HTTP.)
Network Devices Articles
- Basic Network Troubleshooting: https://www.redhat.com/en/blog/beginners-guide-network-troubleshooting-linux (Focuses on Linux command-line tools.)
- Ping Command: https://www.ionos.com/digitalguide/server/tools/ping-command/ (Explanation and examples of using
ping.)
Linux Web Server Articles
- How to Install Nginx on Ubuntu: https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04 (Detailed tutorial for Nginx installation on Ubuntu.)
- Systemd Essentials: https://www.digitalocean.com/community/tutorials/systemd-essentials-working-with-services-units-and-the-journal (Comprehensive guide to managing services with
systemd.)
Online Courses
Networking Fundamentals
- Cisco Networking Academy: Networking Basics - This course provides a solid foundation in networking concepts, including the OSI model, TCP/IP, network devices, and basic troubleshooting. It's a great starting point for beginners.
- Coursera: The Bits and Bytes of Computer Networking by Google - This course delves deeper into networking protocols, network security, and performance optimization.
- edX: Computer Networking - Offers a variety of courses ranging from introductory to advanced levels, covering topics like network design, wireless networking, and cloud networking.
Linux Server Administration
- Linux Academy (now A Cloud Guru): Linux Essentials [invalid URL removed] - This course covers the basics of Linux, including the command line, file system, and user management. It's a prerequisite for more advanced server administration courses.
- Udemy: Complete Linux Training Course to Get Your Dream IT Job - A comprehensive course covering a wide range of Linux administration topics, including server setup, configuration, security, and troubleshooting.
- edX: Introduction to Linux - Offered by the Linux Foundation, this course provides a solid foundation in Linux system administration.
Web Server Setup and Configuration
- DigitalOcean: How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 20.04 - A step-by-step guide to setting up a LAMP stack (Linux, Apache, MySQL, PHP) on Ubuntu, a popular web server configuration.
- OverTheWire: Bandit - A series of wargames that teach you about Linux security concepts in a fun and engaging way.
Tutorials and Documentation
- Networking Tutorials:
- Cisco Networking Academy
- Professor Messer's Network+ Course
- Linux Server Guides:
- Ubuntu Server Guide
- DigitalOcean Tutorials
- Web Server Documentation:
- Apache HTTP Server Documentation
- Nginx Documentation
- Security Resources:
- OWASP Top Ten Security Risks
- National Institute of Standards and Technology (NIST) Security Framework
Key Takeaways
- Networking is Fundamental:
- Understanding how devices communicate is crucial in IT.
- Mastery of networking concepts aids in troubleshooting and system design.
- Servers Power the Internet:
- Linux servers are widely used due to their stability and flexibility.
- Configuring servers requires attention to security and performance.
- Security is Essential:
- Implementing security measures protects systems from threats.
- Regular updates and monitoring are vital for maintaining security.
- Continuous Learning:
- The IT field is ever-evolving; ongoing education is necessary.
- Engaging with communities and pursuing certifications can enhance career prospects.