FOC - E02

Linux Network and Process Management 

In Linux, a process is an active program running under a unique Process ID (PID), having its own allocated resources. Processes can be in different states:

  1. Running: Actively executing code.
  2. Ready: Awaiting CPU time in a queue.
  3. Sleeping: Temporarily paused, waiting for an event or process.
  4. Stopped: Halted intentionally by user or system.
  5. Zombie: Completed but not yet cleaned up.

 

To manage processes:

  • Use "ps" to view a list of running processes.
  • "ps aux" for a detailed system-wide process list.
  • "ps aux | grep username" to filter by username.
  • View detailed process info with "/proc/PID/status."
  • "top" provides real-time process monitoring.
  • "kill" command stops a process (e.g., "kill <PID>").
  • For system services, use "systemctl" (e.g., "sudo systemctl status service_name," "start," or "stop" for service control).

 

 

Networking Configuration:

  • Linux offers commands such as "ifconfig," "ip addr," and "ip link" to access network interface details.
  • "ip route" is used to retrieve routing information for the current network.
  • Network configuration files, typically in YAML format, are located in the "/etc/netplan/" directory and frequently rely on NetworkManager for network management.
  • Important network-related configuration files include "/etc/hosts," which maps IP addresses to hostnames, and "/etc/hostname," which stores the system's hostname for network identification.

 

 

Network-Related Commands:

  • "netstat" serves as a comprehensive tool to display network information, encompassing routing tables, network interfaces, active connections, and open ports.
  • The "ping" command is employed to assess the reachability of a host and measure network latency.
  • "traceroute" is a useful command for tracing the path that network packets follow from source to destination.
  • "nslookup" aids in obtaining DNS information, facilitating domain name and IP address lookups.
  • "ssh" is utilized for secure remote access and command execution on remote systems.

Firewall Configuration (Using UFW):

  • Check the status of the Uncomplicated Firewall (UFW) with sudo ufw status. Enable it with sudo ufw enable if it's inactive.
  • To restrict access to a specific website, use sudo ufw deny out to <ip-address>.
  • After modifying firewall rules, it's advisable to refresh them with sudo ufw reload.
  • To remove a previously blocked website, utilize sudo ufw delete deny out to <ip-address>.
  • Temporarily deactivate the firewall with sudo ufw disable.
  • For more advanced firewall rules, you can employ commands like sudo ufw allow and sudo ufw deny, allowing you to define rules based on specific criteria, such as port numbers or application names, to enhance security.

 

Comments

Popular posts from this blog

FOC - DO3

FOC - A03

FOC - E01