Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

Lab 8.1RHCSA 10, Chapter 8

Give server1 a fixed address, a name and a hosts entry

Level
Easy
25 min
Machines
server1, server2
Status
Not started

Goal

Set up the network of server1 by hand, the way the exam asks for it. At the end, every setting must still work after a reboot.

Before you start

  • You need two virtual machines with RHEL 10 (or CentOS Stream 10 / AlmaLinux 10): server1 and server2, on the same network.
  • In this lab the network is 192.168.122.0/24 with the gateway 192.168.122.1. Use the numbers of your own network if they are different.
  • Work on the console of server1, not over SSH: you change the address you are connected to.

Tasks

  1. Find the name of the network card and of its active connection profile on server1.
  2. Give the profile a fixed IPv4 address 192.168.122.10/24, the gateway 192.168.122.1 and the DNS server 192.168.122.1. Do not make a new profile.
  3. Add a second IPv4 address 192.168.122.110/24 to the same profile.
  4. Set the hostname of server1 to server1.example.com.
  5. Make sure that server1 can reach server2 by the names server2 and server2.example.com, also when no DNS server knows server2. (server2 has the address 192.168.122.20.)
  6. Make sure the profile starts by itself at boot. Reboot server1 and check everything again.

Check your work

Run these commands after the reboot. Every line must show the expected value.

nmcli -f NAME,DEVICE,STATE con show --active
ip -br -4 a show enp1s0
ip route show default
cat /etc/resolv.conf
hostnamectl --static
getent hosts server2
ping -c 2 server2

Hints

Show the hints
  • nmcli connection show lists the profiles. The DEVICE column shows the card.
  • ipv4.method manual is needed for a fixed address.
  • A + before ipv4.addresses adds an address instead of replacing it.
  • The hosts file is read before DNS. Put the full name first, then the short name.

Solution

Show the solution
  1. Find the card and the profile. Here both are called enp1s0; yours can be different.
    nmcli con show
  2. Set the fixed address, the gateway and DNS on the existing profile.
    nmcli con mod enp1s0 ipv4.method manual ipv4.addresses 192.168.122.10/24 ipv4.gateway 192.168.122.1 ipv4.dns 192.168.122.1
  3. Add the second address, then activate the profile.
    nmcli con mod enp1s0 +ipv4.addresses 192.168.122.110/24
    nmcli con up enp1s0
  4. Set the hostname.
    hostnamectl set-hostname server1.example.com
  5. Add server2 to the hosts file.
    echo "192.168.122.20  server2.example.com server2" >> /etc/hosts
  6. Turn on autoconnect, reboot, and run the checks again.
    nmcli con mod enp1s0 connection.autoconnect yes
    systemctl reboot

My notes

No notes yet.

Lessons for this lab

Commands in this lab