Configure IPv4 and IPv6 addresses

8. Manage Basic Networking

πŸ“˜Red Hat Certified System Administrator (RHCSA – EX200)


1. Understanding IP Addresses

IPv4

  • IPv4 addresses are 32-bit numbers, usually written in dotted-decimal format, e.g., 192.168.1.10.
  • They consist of:
    • Network part – identifies the network.
    • Host part – identifies the device on that network.
  • Subnet mask (e.g., 255.255.255.0) tells which part is network and which is host.

IPv6

  • IPv6 addresses are 128-bit numbers, written in hexadecimal with colons, e.g., 2001:db8::1.
  • Provides a huge number of addresses for modern networks.
  • Prefix (like /64) defines the network portion.
  • IPv6 can be link-local (for local network only) or global (for internet communication).

2. Types of Network Configuration

RHCSA expects you to know two main ways to configure IP addresses:

  1. Temporary (runtime) configuration – changes last only until reboot.
  2. Permanent configuration – changes survive reboots.

3. Temporary Configuration (Runtime)

Temporary configuration is done using the ip command or nmcli (NetworkManager CLI).

Check current IP addresses

ip addr show
  • Shows all network interfaces and their IPs.
  • ip a is the shorter version.

Assign an IPv4 address temporarily

sudo ip addr add 192.168.1.10/24 dev enp0s3
sudo ip link set enp0s3 up
  • /24 = subnet mask 255.255.255.0
  • dev enp0s3 = the interface name (use ip a to check).

Assign an IPv6 address temporarily

sudo ip -6 addr add 2001:db8::10/64 dev enp0s3
sudo ip link set enp0s3 up

Remove an IP address

sudo ip addr del 192.168.1.10/24 dev enp0s3

Note: These changes will not survive a reboot. After a restart, the system will revert to permanent settings.


4. Permanent Configuration

Permanent IP configuration is done by editing NetworkManager configuration files or using nmcli.

a) Using nmcli

Check existing connections:

nmcli connection show

Modify or add a connection:

nmcli connection modify "System enp0s3" ipv4.addresses 192.168.1.10/24
nmcli connection modify "System enp0s3" ipv4.gateway 192.168.1.1
nmcli connection modify "System enp0s3" ipv4.dns 8.8.8.8
nmcli connection modify "System enp0s3" ipv4.method manual
nmcli connection up "System enp0s3"

For IPv6:

nmcli connection modify "System enp0s3" ipv6.addresses 2001:db8::10/64
nmcli connection modify "System enp0s3" ipv6.gateway 2001:db8::1
nmcli connection modify "System enp0s3" ipv6.method manual
nmcli connection up "System enp0s3"

b) Using configuration files

  • Files are located in: /etc/NetworkManager/system-connections/
  • Open the connection file with a text editor, e.g., sudo vi /etc/NetworkManager/system-connections/System\ enp0s3.nmconnection
  • Look for [ipv4] or [ipv6] section and set:
[ipv4]
method=manual
addresses=192.168.1.10/24
gateway=192.168.1.1
dns=8.8.8.8;
  • After editing:
sudo nmcli connection reload
sudo nmcli connection up "System enp0s3"

This is permanent and survives reboots.


5. DHCP vs Static IP

  • DHCP (Dynamic Host Configuration Protocol): IP is automatically assigned by a DHCP server.
  • Static IP: IP is manually assigned and does not change.
  • RHCSA may require you to set both DHCP and static IPs for exam tasks.

Example of DHCP:

nmcli connection modify "System enp0s3" ipv4.method auto
nmcli connection up "System enp0s3"

6. Verifying Network Configuration

After configuration, always verify:

  • Check IP address:
ip addr show
  • Check connectivity:
ping 8.8.8.8       # IPv4
ping6 2001:4860:4860::8888 # IPv6
  • Check default gateway:
ip route show
  • Check DNS:
cat /etc/resolv.conf

7. Quick RHCSA Exam Tips

  1. Know the difference between runtime vs permanent configuration.
  2. Practice nmcli commands; they are required in the exam.
  3. Always verify your IP and connectivity after configuration.
  4. Be comfortable with both IPv4 and IPv6 syntax.
  5. Be ready to configure static IPs, DHCP IPs, and gateway/DNS.

βœ… Summary Table for Quick Review

ActionIPv4 CommandIPv6 Command
Temporary add IPip addr add 192.168.1.10/24 dev enp0s3ip -6 addr add 2001:db8::10/64 dev enp0s3
Bring interface upip link set enp0s3 upSame
Permanent (manual)nmcli connection modify "System enp0s3" ipv4.method manual ...nmcli connection modify "System enp0s3" ipv6.method manual ...
DHCPnmcli connection modify "System enp0s3" ipv4.method autonmcli connection modify "System enp0s3" ipv6.method auto
Verify IPip addr showSame
Test connectivityping 8.8.8.8ping6 2001:4860:4860::8888

This covers everything needed to configure IPv4 and IPv6 addresses for RHCSA in a way you can both understand and use in the exam.

Buy Me a Coffee