Configure IPv4 and IPv6 networking and hostname resolution

Ptah is a RHEL Sysadmin at Google:

  • His RHEL Server: Google_RHEL_Server_626
  • His username: ptah.jones@google.com
  • His professional standard: highly competent RHEL Sysasmins NEVER run Linux commands as the root user unless absolutely necessary.
  • His objective: Configure IPv4 and IPv6 networking and hostname resolution

Ptah is studying for his RHEL Exam. Please generate and explain examples and commands that will help him to master his objective.

Certainly! To help Ptah master his objective of configuring IPv4 and IPv6 networking and hostname resolution on his RHEL Server (Google_RHEL_Server_626) while adhering to best practices, I'll provide examples and commands that follow the principle of not running commands as the root user unless necessary.

  1. Configure IPv4 Networking:

    • Example: Assigning a static IP address to an interface (e.g., eth0):
      sudo nmcli connection modify eth0 ipv4.addresses 192.168.1.100/24 sudo nmcli connection modify eth0 ipv4.gateway 192.168.1.1 sudo nmcli connection modify eth0 ipv4.dns 8.8.8.8 sudo nmcli connection up eth0
      Explanation:
      • The first command modifies the IP address and subnet mask for the eth0 interface to 192.168.1.100/24.
      • The second command sets the default gateway to 192.168.1.1.
      • The third command sets the DNS server to 8.8.8.8 (Google Public DNS).
      • The fourth command brings up the eth0 connection.
  2. Configure IPv6 Networking:

    • Example: Assigning a static IPv6 address to an interface (e.g., eth0):
      sudo nmcli connection modify eth0 ipv6.addresses "2001:db8:0:1::100/64" sudo nmcli connection modify eth0 ipv6.gateway "2001:db8:0:1::1" sudo nmcli connection modify eth0 ipv6.dns "2001:4860:4860::8888" sudo nmcli connection up eth0
      Explanation:
      • The first command modifies the IPv6 address and prefix length for the eth0 interface to 2001:db8:0:1::100/64.
      • The second command sets the IPv6 gateway to 2001:db8:0:1::1.
      • The third command sets the IPv6 DNS server to 2001:4860:4860::8888 (Google Public DNS).
      • The fourth command brings up the eth0 connection.
  3. Configure Hostname Resolution:

    • Example: Modifying the hostname and updating the hosts file:
      sudo hostnamectl set-hostname google-rhel-server-626
      sudo sed -i 's/^127.0.0.1.*/127.0.0.1 localhost google-rhel-server-626/' /etc/hosts
      Explanation:
      • The first command sets the hostname to "google-rhel-server-626" using the hostnamectl command.
      • The second command modifies the hosts file (/etc/hosts) to include the updated hostname and ensures that "localhost" and the new hostname point to the loopback address (127.0.0.1).

These examples provide commands to configure IPv4 and IPv6 networking, as well as hostname resolution, on Ptah's RHEL Server (Google_RHEL_Server_626) while following the best practice of not running commands as the root user unless necessary. By understanding and practicing these commands, Ptah can effectively configure networking settings and hostname resolution for his RHEL Exam.

You should also read:

Configure a caching DNS server

Segun is a RHEL Sysadmin at Red Hat. He administers RHEL_Server_047, and his username is segun.okuns. His supervisor wants Segun to demonstrate how…