Skip to main content

LFCS: Networking (25%)

This section covers systemLinux administrationnetworking, taskshostname relatedresolution, totime configuringsynchronization, theOpenSSH, kernel,packet managingfiltering, processes,routing, jobs, software, hardware recovery,bridges, and containers.load balancing.


1. Configure KernelIPv4/IPv6 ParametersNetworking & Hostname Resolution

Learn

  • TemporaryAssign IP addresses (runtime)static vs& persistent kernel parameters.dynamic).
  • Tools:Configure hostnames and DNS resolution.
Understand sysctl/etc/hosts, /etc/resolv.conf, and /etc/sysctl.confhostnamectl.

Commands

# ShowView allnetwork parametersinterfaces
sysctlip -aaddr show
ip link show

# Configure static IP (example)
sudo nmcli con mod eth0 ipv4.addresses 192.168.1.100/24
sudo nmcli con mod eth0 ipv4.gateway 192.168.1.1
sudo nmcli con mod eth0 ipv4.dns 8.8.8.8
sudo nmcli con mod eth0 ipv4.method manual
sudo nmcli con up eth0

# Set ahostname
runtimehostnamectl parameterset-hostname sudomyhost
sysctlhostnamectl net.ipv4.ip_forward=1status

# PersistDNS parametercheck
across reboots
echo "net.ipv4.ip_forward = 1" | sudo tee -acat /etc/sysctl.resolv.conf
sudoping sysctl -pgoogle.com

Exercises

  1. EnableAssign a static IP forwardingto temporarilyan interface and checkverify status.connectivity.
  2. MakeChange IPthe forwardinghostname permanent.and update /etc/hosts accordingly.

2. ManageTime Processes and ServicesSynchronization

Learn

  • Identify, monitor, and troubleshoot processes.
Systemd services management.

Commands

# Process management
ps aux | grep <name>
top
htop       # if installed
kill <PID>
kill -9 <PID>

# Systemd service management
systemctl status <service>
systemctl start <service>
systemctl stop <service>
systemctl enable <service>
systemctl disable <service>
systemctl restart <service>
systemctl reload <service>

Exercises

    Find the PID of a running process and stop it gracefully. Enable and start a service on boot.

    3. Manage Scheduled Jobs

    Learn

      Cron jobs: user (crontab) andSync system (/etc/cron*). At jobs for one-time scheduling.

      Commands

      # List user cron jobs
      crontab -l
      
      # Edit user cron jobs
      crontab -e
      
      # At job example
      echo "touch /tmp/testfile" | at now + 1 minute
      atq       # list scheduled at jobs
      atrm <job_number>
      

      Exercises

        Schedule a job to run a script every day at 3am. Schedule a one-time task using atchrony.

        4. Software Management

        Learn

          Install, update, validate packages using native package manager. Repositories and dependency management.

          Commands

          # Debian/Ubuntu
          sudo apt update
          sudo apt install <package>
          dpkg -l | grep <package>
          
          # RHEL/CentOS
          sudo yum install <package>
          rpm -qa | grep <package>
          

          Exercises

            Install curl and verify it is installed. Remove a package and confirm removal.

            5. Recover from Hardware, OS, or Filesystem Failures

            Learn

              Boot into rescue/recovery mode. Use Live CD/USB for repair. Basic filesystem check: fsck.

              Commands

              sudo fsck /dev/sdX1
              sudo mount /dev/sdX1 /mnt
              

              Exercises

                Simulate a corrupted filesystem on a test partition and repair it. Boot into rescue mode and inspect disk partitions.

                6. Virtual Machines (libvirt)

                Learn

                  Install and manage VMs using libvirt and virsh.

                  Commands

                  virsh list --all
                  virsh start <vm>
                  virsh shutdown <vm>
                  virsh destroy <vm>   # force shutdown
                  virsh console <vm>
                  

                  Exercises

                    Create a VM using virt-installntpd. Start, stop,Check and connectupdate totime the VM via console.

                    7. Containers (Docker / Podman)

                    Learn

                      Create, start, stop, and manage containers. Understand container networking and volumes.

                      Commands

                      # Run container
                      docker run -it --name mycontainer ubuntu bash
                      
                      # List running containers
                      docker ps
                      
                      # Stop and remove container
                      docker stop mycontainer
                      docker rm mycontainer
                      
                      # List images
                      docker images
                      

                      Exercises

                        Create an Ubuntu container and install curl inside it. Commit container changes to a new image. Remove the container and image.

                        8. SELinux (Mandatory Access Control)

                        Learn

                          Enforce, permissive, and disabled modes. Troubleshoot SELinux denials.zone.

                          Commands

                          # Check current modetime
                          sestatustimedatectl
                          
                          # ChangeSet modetime temporarilyzone
                          timedatectl set-timezone Europe/Paris
                          
                          # Sync time using chrony
                          sudo setenforcesystemctl 0start #chronyd
                          permissivechronyc sudotracking
                          setenforcechronyc 1   # enforcing
                          
                          # Check SELinux logs
                          ausearch -m avcsources
                          

                          Exercises

                          1. SwitchConfigure SELinuxNTP tosynchronization permissivewith modea andpublic verify.server.
                          2. TriggerVerify antime SELinuxsync denial (e.g., wrong file context) and check logs.status.

                          Exam3. TipsMonitor & Troubleshoot Networking

                          Learn

                          • PracticeUse all commands without root shortcuts (sudo)tools to simulatecheck examconnectivity conditions.and troubleshoot issues.

                          Commands

                          ping <host>
                          traceroute <host>
                          ss -tulnp  # check listening ports
                          netstat -rn  # routing table
                          curl -I http://example.com
                          

                          Exercises

                            Ping a remote host and check for packet loss. UnderstandCheck runtimewhich vsservice persistentis changeslistening (kernel,on SELinux,port services)80.

                            4. OpenSSH Configuration

                            Learn

                              Configure SSH server and client. Manage keys and permissions.

                              Commands

                              # Start and enable SSH server
                              sudo systemctl start sshd
                              sudo systemctl enable sshd
                              
                              # Connect to remote server
                              ssh user@remote_host
                              
                              # Generate keys
                              ssh-keygen -t rsa -b 4096
                              ssh-copy-id user@remote_host
                              

                              Exercises

                                Configure SSH to listen on a non-default port. Set up key-based authentication.

                                5. Packet Filtering, Port Redirection, NAT

                                Learn

                                  Configure firewall using iptables or firewalld. UsePerform lab VMs to experiment with containers, VMs,NAT and cronport jobs.forwarding.

                                  Commands

                                  # Check firewall status
                                  sudo firewall-cmd --state
                                  
                                  # Allow port 22
                                  sudo firewall-cmd --add-port=22/tcp --permanent
                                  sudo firewall-cmd --reload
                                  
                                  # Example NAT rule
                                  sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
                                  

                                  Exercises

                                    Open a specific port on the firewall. Configure port forwarding for SSH.

                                    6. Static Routing

                                    Learn

                                      Add static routes for traffic control.

                                      Commands

                                      # Add a static route
                                      sudo ip route add 192.168.2.0/24 via 192.168.1.1 dev eth0
                                      
                                      # Show routes
                                      ip route show
                                      

                                      Exercises

                                        Add a static route to reach a remote network. Verify connectivity via the static route.

                                        7. Bridge & Bonding Devices

                                        Learn

                                          Network bridging (e.g., for VMs). Bonding for link aggregation.

                                          Commands

                                          # Create bridge
                                          sudo nmcli con add type bridge con-name br0 ifname br0
                                          sudo nmcli con add type bridge-slave con-name eth0-br0 ifname eth0 master br0
                                          
                                          # Bonding example
                                          sudo nmcli con add type bond con-name bond0 ifname bond0 mode active-backup
                                          sudo nmcli con add type bond-slave con-name eth1-bond0 ifname eth1 master bond0
                                          

                                          Exercises

                                            Create a network bridge and attach an interface. Configure a bonded interface with two NICs.

                                            8. Reverse Proxies & Load Balancers

                                            Learn

                                              Basics of reverse proxy (e.g., Nginx) and load balancing.

                                              Commands

                                              # Nginx reverse proxy example
                                              sudo nano /etc/nginx/conf.d/reverse.conf
                                              # server { listen 80; location / { proxy_pass http://backend:8080; } }
                                              sudo systemctl reload nginx
                                              

                                              Exercises

                                                Configure Nginx to proxy requests to a backend server. Set up basic round-robin load balancing using Nginx.