Configure your system to use a specific identity and ensure it can resolve its own name locally without relying on an external DNS server.
Configure the system permanent hostname to be node1.linuxlab.com.
Ensure that this hostname resolves to the IP address 192.168.4.100 locally.
The configuration must persist across system reboots.
Solution
Verify current hostname
hostname
Change hostname
hostnamectl hostname node1.linuxlab.com
Verify current hostname
hostname
Open file /etc/hosts
sudo vim /etc/hosts --> Esc --> I --> Enter
Add new line
192.168.4.100 node1.linuxlab.com linuxlab
Save and exit
Esc -->:wq --> Enter
Reboot
sudo reboot now
Verify alias
ping linuxlab
Cleanup
sudo vim /etc/hosts --> Esc --> I --> Enter --> Delete new line
hostnamectl hostname localhost.localdomain
Configure a static IPv4 network connection on your primary network interface. Do not use a graphical interface; utilize the command-line network management tools.
Modify or add a connection named static-profile for your primary Ethernet interface (assume interface name enp0s3).
Assign the IPv4 address 10.0.0.50 with a subnet mask of /24.
Set the default gateway to 10.0.0.1.
Ensure the connection IP assignment method is manual, activates automatically on boot, and is currently active.
Solution
View current devices
nmcli device status
Create new connection profile
sudo nmcli connection add con-name "static-profile" ifname enp0s3 type ethernet -- ipv4.addresses 10.0.0.50/24 ipv4.gateway 10.0.0.1 ipv4.method manual
Verify the profile exists
nmcli connection show
Activate profile
sudo nmcli connection up "static-profile"
Reboot
sudo reboot now
Validate the IP address
ip a show dev enp0s3
Validate the gateway
ip route show
[Cleanup] Switch back to your original connection
sudo nmcli connection up "enp0s3"
[Cleanup] Delete the profile
sudo nmcli connection delete static-profile
The production environment requires a temporary virtual network interface for testing traffic redirection. You must configure the interface and ensure traffic destined for a specific remote subnet is routed through it.
Create a persistent dummy network interface named backup0.
Assign the IPv4 network address 10.10.50.99/24 to this interface.
Configure a static route such that all traffic destined for the 192.168.100.0/24 network is explicitly routed via the gateway 10.10.50.1 using the backup0 interface.
Ensure the link status is operational (UP).
Solution
Create a virtual network adapter
sudo ip link add backup0 type dummy
Verify interface
ip link show dev backup0
Turn on interface
sudo ip link set backup0 up
Verify interface whether is active or not
ip link show dev backup0
Assign static IP
sudo ip address add 10.10.50.99/24 dev backup0
Configure gateway
sudo ip route add 192.168.100.0/24 via 10.10.50.1 dev backup0
Verify IP address
ip address show dev backup0
Verify Gateway
ip route show dev backup0
Cleanup
sudo ip link delete backup0
An audit reveals that unprivileged users have access to alter network settings. You need to verify the Network Manager system status and ensure standard security restrictions apply to new local accounts.
Ensure the NetworkManager service is currently running and enabled to start automatically at system boot.
Create a local user account named anil.
Ensure that when user anil logs in, they do not possess the Polkit permissions to modify network connections globally (nmcli general permissions should reflect standard unprivileged restrictions).
Solution
Enable network manager
systemctl enable --now NetworkManager
Check current state of network manager
systemctl status NetworkManager
Create new user
useradd anil
Assign new user password
passwd anil
Switch user
su - anil
Check the permission of network manager for new user
nmcli general permissions
Exit new user session
exit
Cleanup
userdel -r anil