Configure IPv4 and IPv6 Addresses

Red Hat Enterprise LinuxBeginner
Practice Now

Introduction

In this challenge, you will practice configuring static IPv4 and IPv6 addresses on a Red Hat Enterprise Linux (RHEL) system. You will use the nmcli command-line tool to create and manage persistent network connection profiles. This is a fundamental skill for any system administrator and a key topic for the RHCSA certification exam.

Configure a Static IPv4 Address

Your first task is to create a new, persistent NetworkManager connection profile for the dummy0 interface with a static IPv4 configuration.

Tasks

  • Create a new NetworkManager connection profile named dummy0-static.
  • Configure the profile for the dummy0 interface.
  • Assign the static IPv4 address 192.168.100.10/24.
  • Set the gateway to 192.168.100.1.
  • Ensure the connection profile is set to activate automatically on system startup.
  • Activate the new connection profile.

Requirements

  • You must use the nmcli command-line tool.
  • The new connection profile must be named exactly dummy0-static.
  • The configuration must be persistent across reboots.

Hints

To create a NetworkManager connection profile using nmcli, you'll need to use the nmcli connection add command with the following key parameters:

  • type: Specify the connection type (for dummy interfaces, use dummy)
  • con-name: The name of the connection profile
  • ifname: The interface name
  • autoconnect: Set to yes for automatic activation on boot
  • ip4: IPv4 address with CIDR notation
  • gw4: IPv4 gateway address

The basic syntax is:

sudo nmcli connection add type [TYPE] con-name [NAME] ifname [INTERFACE] autoconnect [yes/no] ip4 [ADDRESS/CIDR] gw4 [GATEWAY]

After creating the connection, you may need to activate it using:

sudo nmcli connection up [CONNECTION_NAME]

Example

After you have successfully activated the new connection, the output of ip addr show dummy0 should include the static IPv4 address.

3: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether 12:34:56:78:9a:bc brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.10/24 brd 192.168.100.255 scope global noprefixroute dummy0-static
       valid_lft forever preferred_lft forever
    ...

Additionally, you can verify the connection profile is active with nmcli con show --active.

NAME           UUID                                  TYPE      DEVICE
dummy0-static  550e8400-e29b-41d4-a716-446655440000  ethernet  dummy0
...

Add a Static IPv6 Address

Now, you will modify the existing dummy0-static connection profile to add a static IPv6 address and gateway.

Tasks

  • Modify the dummy0-static connection profile.
  • Add the static IPv6 address 2001:db8:cafe::10/64.
  • Set the IPv6 gateway to 2001:db8:cafe::1.
  • Apply the changes to the active connection.

Requirements

  • You must use the nmcli command-line tool to modify the existing connection.
  • The changes must be applied to the dummy0-static profile.

Hints

To modify an existing NetworkManager connection, use the nmcli connection modify command:

  • Use ipv6.method manual to enable manual IPv6 configuration
  • Use ipv6.addresses to set the IPv6 address
  • Use ipv6.gateway to set the IPv6 gateway

The basic syntax is:

sudo nmcli connection modify [CONNECTION_NAME] ipv6.method manual ipv6.addresses [ADDRESS/PREFIX] ipv6.gateway [GATEWAY]

After modifying the connection profile, you must reactivate it for changes to take effect:

sudo nmcli connection up [CONNECTION_NAME]

Example

After applying the changes, the output of ip addr show dummy0 should now include both the IPv4 and IPv6 addresses.

3: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether 12:34:56:78:9a:bc brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.10/24 brd 192.168.100.255 scope global noprefixroute dummy0-static
       valid_lft forever preferred_lft forever
    inet6 2001:db8:cafe::10/64 scope global noprefixroute
       valid_lft forever preferred_lft forever
    ...

You can verify the IPv6 configuration is applied by checking the connection details:

$ nmcli con show dummy0-static | grep ipv6
ipv6.method:                            manual
ipv6.addresses:                         2001:db8:cafe::10/64
ipv6.gateway:                           2001:db8:cafe::1
...

Summary

In this challenge, you have learned how to manage network configurations on a modern RHEL system. You successfully used the nmcli utility to create a persistent static IPv4 connection and then modified it to add a static IPv6 configuration. These are essential skills for managing servers and are frequently tested in the RHCSA exam.

✨ Check Solution and Practice✨ Check Solution and Practice