Updated: 10 October 2026 · Applies to: AlmaLinux 10.2 (NetworkManager 1.56, iproute 6.17, net-tools 2.10) and Rocky Linux 9.8 (NetworkManager 1.54); RHEL 9 and 10 according to Red Hat

To change the IP address on RHEL, AlmaLinux or Rocky Linux permanently, edit the NetworkManager connection with nmcli and reactivate it:

nmcli connection show
nmcli connection modify "System eth0" ipv4.method manual ipv4.addresses 192.0.2.20/24 ipv4.gateway 192.0.2.1 ipv4.dns "1.1.1.1 8.8.8.8"
nmcli connection up "System eth0"

Replace System eth0 with the connection name from the first command, and the documentation addresses (192.0.2.x) with your own. For a temporary change that is gone after a reboot, use ip addr add 192.0.2.20/24 dev eth0. ip link set cannot set an IP address, and ifconfig still works but is the old way.

Before you change it on a server: changing the address you are connected through ends your SSH session, and a typo can lock you out. Keep a console open: on a Ucartz VPS, the VNC console in the client area (Services > My Services > your VPS); on a dedicated server, the IPMI KVM console. The IP addresses of a Ucartz server are assigned to it, so change settings only to use the addresses, netmask and gateway shown in your client area, for example to add extra IPs you ordered.

1. Change the IP address with nmcli (permanent)

  1. Find the connection name and the device:
    nmcli connection show
    ip -br addr
    The connection name can be, for example, System eth0, eth0 or Wired connection 1; the device may be eth0, ens3 or similar.
  2. Set the new address, prefix, gateway and DNS servers with nmcli connection modify (short: nmcli con mod), as above. Always include the prefix: in our test, ipv4.addresses 192.0.2.10 without /24 was saved as 192.0.2.10/32.
  3. Apply it. modify only changes the saved profile; the running address stays the same until you reactivate:
    $ nmcli connection modify "System eth0" ipv4.addresses 192.0.2.20/24
    $ ip -br addr show eth0
    eth0@if766       UP             192.0.2.10/24
    $ nmcli connection up "System eth0"
    Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
    $ ip -br addr show eth0
    eth0@if766       UP             192.0.2.20/24
  4. Check the saved settings:
    $ nmcli -f ipv4.method,ipv4.addresses,ipv4.gateway,ipv4.dns connection show "System eth0"
    ipv4.method:                            manual
    ipv4.addresses:                         192.0.2.20/24
    ipv4.gateway:                           192.0.2.1
    ipv4.dns:                               1.1.1.1

Other common changes:

  • Add a second IP: nmcli con mod "System eth0" +ipv4.addresses 192.0.2.21/24, remove it again with -ipv4.addresses, then nmcli con up. More on this in adding IPv4 addresses on AlmaLinux or Rocky Linux with nmcli.
  • Back to DHCP: nmcli con mod "System eth0" ipv4.method auto ipv4.addresses "" ipv4.gateway "". Switching to manual without an address fails with method 'manual' requires at least an address or a route.

2. Where the settings are stored (ifcfg files are gone)

NetworkManager saves each profile as a keyfile in /etc/NetworkManager/system-connections/, readable by root only:

$ cat "/etc/NetworkManager/system-connections/System eth0.nmconnection"
[connection]
id=System eth0
uuid=c81b3778-d373-4edf-8580-ef41850a36e7
type=ethernet
interface-name=eth0
...
[ipv4]
address1=192.0.2.20/24
dns=1.1.1.1;
gateway=192.0.2.1
method=manual

(output shortened) If you edit a keyfile by hand, run nmcli connection reload and then nmcli connection up. The old /etc/sysconfig/network-scripts/ifcfg-eth0 files from CentOS and RHEL 7 and 8 are on their way out: Rocky Linux 9 still reads them (the ifcfg-rh plugin is installed), but according to Red Hat, RHEL 10 removed support for the ifcfg format, and our AlmaLinux 10 container had neither the plugin nor the folder. Convert old profiles on version 9 before upgrading with nmcli connection migrate.

3. Change the IP address with nmtui (menus)

  1. Run nmtui (package NetworkManager-tui) and choose Edit a connection.
  2. Select the connection and choose Edit....
  3. Set IPv4 CONFIGURATION to Manual and press Show.
  4. Change the address under Addresses (with the prefix, for example 192.0.2.20/24), then Gateway and DNS servers. Press OK and Back.
  5. Choose Activate a connection, select the connection, choose Deactivate and then Activate, and Quit.

4. Change the IP address temporarily with ip

$ ip addr add 192.0.2.10/24 dev eth0
$ ip -br addr show eth0
eth0@if761       UP             203.0.113.5/24 192.0.2.10/24
$ ip addr del 192.0.2.10/24 dev eth0

(the existing address is replaced with a placeholder) ip addr add adds an address next to the existing one; to swap the old address for a new one, add the new one and delete the old one. Adding an address that is already there fails with Error: ipv4: Address already assigned.; ip addr replace does not complain. These changes last until a reboot or until NetworkManager reactivates the connection. For a full list of options, see the ip command cheat sheet.

Be careful with ip link set eth0 down on a remote server: in our test, taking the interface down and up again also removed the default route, so the server could no longer reach other networks until it was added back with ip route replace default via 192.0.2.1.

5. ip link set and IP addresses

ip link changes the network interface itself, not its IP addresses. Both attempts below fail:

$ ip link set dev eth0 192.0.2.10
Error: either "dev" is duplicate, or "192.0.2.10" is garbage.
$ ip link set eth0 address 192.0.2.10
Invalid address length 4 - must be 6 bytes

The address of ip link is the MAC address (6 bytes). What ip link set is for:

  • ip link set eth0 up or down: enable or disable the interface.
  • ip link set dev eth0 address 02:00:00:00:00:10: change the MAC address.
  • ip link set dev eth0 mtu 1400: change the MTU.

For the IP address, use ip addr (section 4).

6. Change the IP address with ifconfig

ifconfig comes from the net-tools package, which is still available on AlmaLinux and Rocky Linux 9 and 10 (dnf install net-tools) but is not installed on minimal systems. If the command is missing, see ifconfig command not found.

ifconfig eth0 192.0.2.20 netmask 255.255.255.0 up     # replaces the main address
ifconfig eth0:1 192.0.2.21 netmask 255.255.255.0 up   # adds a second address as eth0:1

Both are temporary, like ip addr. In our test, the first command removed the old main address, and the default route still pointed to the old gateway: ifconfig does not set gateways, so follow it with ip route replace default via 192.0.2.1 (or the older route add default gw 192.0.2.1). The eth0:1 address shows up in ip addr with that label, and ifconfig eth0:1 down removed it again.

ifconfig also shows only one IPv4 address per interface: with two addresses on eth0, ifconfig eth0 listed just one of them. Use ip addr to see them all. How the two tools compare: ifconfig vs ip.

Debian and Ubuntu

The ip and ifconfig commands above work the same way. For a permanent address, Ubuntu servers use Netplan (static IP on Ubuntu with Netplan) and Debian 13 servers usually use /etc/network/interfaces (static IP on Debian 13 with ifupdown). Desktops on either use NetworkManager, so the nmcli steps apply.

Official documentation: Red Hat: Configuring an Ethernet connection.

Ucartz services for this topic

Was this answer helpful? 0 Users Found This Useful (0 Votes)