Networking and Firewalls


IPv4 Addressing

IPv4 (Internet Protocol version 4) is a numerical label assigned to devices connected to a network for identification and communication. It uses a 32-bit address, written in dotted decimal notation (e.g., 192.168.1.1).

IP Address Classes:

Class Starting IP Ending IP Default Subnet Mask Purpose
A 1.0.0.0 126.255.255.255 255.0.0.0 Large Networks
B 128.0.0.0 191.255.255.255 255.255.0.0 Medium Networks
C 192.0.0.0 223.255.255.255 255.255.255.0 Small Networks
D 224.0.0.0 239.255.255.255 - Multicasting
E 240.0.0.0 255.255.255.255 - Research & Reserved

Netmask & Subnet Mask

Gateway

A gateway is a device (typically a router or firewall) that connects different networks, allowing communication between them. In an industry setting, a gateway can be a router or the IP of a firewall.

CIDR (Classless Inter-Domain Routing) Range

CIDR notation is a method for allocating IP addresses and routing.

Network ID & Broadcast ID

Example Calculation:

Firewall & Windows Defender Firewall

A firewall is a security system that monitors and controls incoming/outgoing traffic based on security rules.

Network Devices: Switch

A network switch connects devices within a LAN (Local Area Network) and directs data packets only to the intended device.

Linux Networking & Package Management Commands

Command Description
sudo Execute command as root
apt search apache2 Search for Apache package
sudo -s Open a root shell
whoami Display current user
sudo whoami Check if sudo grants root access
sudo apt update Update package lists
sudo apt install apache2 Install Apache web server
systemctl status apache2 Check Apache status
sudo systemctl start apache2 Start Apache service
apt purge <package> Completely remove a package
apt remove <package> Remove a package but keep config files
sudo apt install members Install the 'members' package
members sudo List users in the sudo group
sudo systemctl enable apache2 Enable Apache to start at boot

APT (Advanced Package Tool)

APT is the package manager for Debian-based Linux distributions like Ubuntu, used to install, update, and remove software.

Debian-Based Linux

Debian-based Linux distributions are operating systems built on the Debian Linux framework. They use the APT package manager and follow Debian’s software repository structure. Examples include:

Communication in the Same Network

Devices within the same subnet can communicate without a router. If they are in different subnets, they need a gateway.

Linux Commands Explained

1. sudo apt update


2. sudo apt install apache2


3. systemctl status apache2


4. sudo systemctl start apache2


5. apt search apache2


6. sudo -s


7. whoami


8. sudo whoami


9. rm filename

Note:

Difference Between enable and start

systemctl start apache2 Starts the Apache2 service immediately but does not enable it on boot.
systemctl enable apache2 Ensures Apache2 starts automatically on every system boot.
systemctl enable --now apache2 Enables and starts Apache2 immediately.

*Homework:

---****---