Fundamental of Computing Week 10: 16 October to 22 October (Linux Network and Process Management)
Linux Network and Process Management
What is a Process?
- In Linux, a process is a running program. It is a program instance that is being executed by the Linux kernel. Each process has its own unique process ID (PID) and resources like as memory and CPU time.
- Process ID(PID) is a unique identifier assigned to a process.
Process States
- A system process can be in one of the following states:
- Running: it is currently running the code.
- Ready: it is ready to run but is awaiting CPU time.
- sleeping: it is briefly paused while waiting for some event or procedure to occur.
- Stopped: it has been stopped by the user or the system.
- Zombie: the process has finished but there is still an entry in the process table.
Process Management
- The following commands can be used to manage the processes:
- ps: report the snapshot of current process.
- top: real time process monitor that displays the information about all running processes.
- kill: used to stop the process.
- systemctl: can be used if some services are installed in the system.
Network Configuration
- Names of all the network interfaces can be obtained by using the commands ifconfig, ip addr, or ip link.
- The command ip route allows to view the routing information for the network to which your device is connected.
- The configuration file can be found in the /etc/netplan/ folder. I will come with a YAML configuration file by default. It manages your network by default using the NetworkMnager.
- You can access configurations about specific network you are connected to from /etc/NetworkManaer/system-connections/<connection-name>.
- To access the list of all the network connection names, go inside the /etc/NetworkManager/system-connections/ folder.
- Other network configuration files are:
- /etc/host.conf: contains order in which hostnames are resolved.
- /etc/hosts: map ip address to hostname/domain name.
- /etc/hostname contains name of your system hostname which can be used to identify your system in the network.
- Some other files are /etc/hosts.deny and /etc/hosts.allow.
Network Commands
- Other network commands that can be included are:
- netstat: used to display various network statistics such as routing tables, interfaces, connections, and ports.
- Ping: check the reachability of the host connection.
- Traceroute: determines the path between the source and the destinations.
- nslookup: retrieve a mapping between an IP address and a domain name, and vice versa.
- ssh: shell-based remote login.
Firewall Configuration
Use ufw(uncomplicated firewall) which comes builtin.
We use the following commands for specific purposes:
- sudo ufw enable: in case status is inactive.
- sudo ufw reload: to reload firewall.
- sudo ufw deny out to <ip-address>: used to block a certain website (replave the ip-address with the actual ip address of website).
- sudo ufw delete deny out to <ip-address>: used to unblock the blocked website.
- sudo ufw disable: used to disable firewall.
- sudo firewall-cmd --get-zones: to view available zones on the system.
- sudo firewall-cmd --get-default-zone: to view the default zone.
- sudo firewall-cmd --get-active-zone: to view the active zones and their associated interfaces and sources.
Comments
Post a Comment