> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Add a Second IP Address on Linux

> Add a second IP address on Linux: add it under addresses in Netplan on Ubuntu, use nmcli +ipv4.addresses on AlmaLinux/Rocky, or an iface stanza on Debian.

To add a second IP address on Linux, add it to the same network interface in your network configuration: as an extra line under `addresses` in Netplan (Ubuntu), with `sudo nmcli connection modify "System eth0" +ipv4.addresses 203.0.113.11/24` (AlmaLinux/Rocky), or as an extra `iface eth0 inet static` stanza in `/etc/network/interfaces` (Debian with ifupdown). Then apply the change and check it with `ip -br addr`.

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Intermediate | 10 minutes | Ubuntu 22.04/24.04, Debian 12/13, AlmaLinux/Rocky 9/10 | sudo access, the new IP assigned to your server, console access as a fallback |

## Before you start

* The new address must already be assigned to your server. On a VPS, check it is listed on the [Network tab of the VPS Panel](https://help.freakhosting.com/portals/vps-panel/how-to-view-and-manage-network-settings.md); that page also explains how to get another IP. For a dedicated server, [open a ticket](https://freakhosting.com/clientarea/submitticket.php) if you're unsure which addresses are yours.
* Note the new address and its prefix length (netmask `255.255.255.0` = `/24`). You don't add a second gateway: the existing default route is used.
* Open the [VNC console](https://help.freakhosting.com/portals/vps-panel/how-to-enable-and-use-vnc-console-access.md) first in case a mistake disconnects the server.
* Commands use `sudo`; as root, leave it out.

## Which network tool does my server use?

```bash theme={null}
ls /etc/netplan/ 2>/dev/null; nmcli -t general status 2>/dev/null; ls /etc/network/interfaces 2>/dev/null
```

| You see | Tool | Usual on |
| - | - | - |
| `.yaml` files in `/etc/netplan/` | Netplan | Ubuntu, some Debian images |
| Output from `nmcli` | NetworkManager | AlmaLinux, Rocky Linux, Fedora |
| Only `/etc/network/interfaces` | ifupdown | Debian |

## How to add a second IP address permanently

> [tab] Ubuntu (Netplan)
>
> **1. Edit the Netplan file**
>
> ```bash theme={null}
> sudo nano /etc/netplan/50-cloud-init.yaml
> ```
>
> Add the new address under the existing one:
>
> ```yaml theme={null}
> network:
>   version: 2
>   ethernets:
>     eth0:
>       dhcp4: false
>       addresses:
>         - 203.0.113.10/24
>         - 203.0.113.11/24
>       routes:
>         - to: default
>           via: 203.0.113.1
>       nameservers:
>         addresses: [1.1.1.1, 9.9.9.9]
> ```
>
> If your interface currently uses `dhcp4: true`, switch to a static setup first: see [static IP with Netplan](https://help.freakhosting.com/portals/other/how-to-configure-a-static-ip-with-netplan.md).
>
> **2. Test and apply**
>
> ```bash theme={null}
> sudo netplan try
> ```
>
> Press **Enter** within 120 seconds to keep the change.

> [tab] AlmaLinux / Rocky (nmcli)
>
> **1. Find the connection name**
>
> ```bash theme={null}
> nmcli connection show
> ```
>
> Note the **NAME** of the connection on your public interface, for example `System eth0` or `eth0`.
>
> **2. Add the address**
>
> ```bash theme={null}
> sudo nmcli connection modify "System eth0" +ipv4.addresses 203.0.113.11/24
> ```
>
> The `+` adds the address instead of replacing the existing ones. If the connection uses DHCP, set the primary address statically too, with `ipv4.method manual ipv4.addresses 203.0.113.10/24 ipv4.gateway 203.0.113.1`.
>
> **3. Activate the change**
>
> ```bash theme={null}
> sudo nmcli connection up "System eth0"
> ```

> [tab] Debian (ifupdown)
>
> **1. Edit the interfaces file**
>
> ```bash theme={null}
> sudo cp /etc/network/interfaces /root/interfaces.bak
> sudo nano /etc/network/interfaces
> ```
>
> Add a second stanza for the same interface, without a gateway:
>
> ```ini theme={null}
> auto eth0
> iface eth0 inet static
>     address 203.0.113.10/24
>     gateway 203.0.113.1
>
> iface eth0 inet static
>     address 203.0.113.11/24
> ```
>
> Debian's `interfaces` manual allows several stanzas per interface and applies all of them when the interface comes up.
>
> **2. Apply**
>
> Run this from the VNC console, because the interface goes down briefly:
>
> ```bash theme={null}
> sudo ifdown eth0 && sudo ifup eth0
> ```

## How to add an IP temporarily (until reboot)

To test an address without changing any file:

```bash theme={null}
sudo ip addr add 203.0.113.11/24 dev eth0
```

Remove it again with `sudo ip addr del 203.0.113.11/24 dev eth0`. The address also disappears at the next reboot.

## How to check it worked

```bash theme={null}
ip -br addr show eth0
```

```text theme={null}
eth0             UP             203.0.113.10/24 203.0.113.11/24
```

From another machine, `ping 203.0.113.11` should answer (if ICMP is allowed). To check the server can send from the new address:

```bash theme={null}
curl --interface 203.0.113.11 -I https://example.com
```

## Frequently asked questions

### Which IP does the server use for outgoing traffic?

By default, the primary address on the interface (normally the first one listed). Programs can bind to a specific address, for example `listen 203.0.113.11:80;` in nginx.

### Do I need a separate gateway for the second IP?

Not when both addresses are in the same subnet. If the new address is in a different subnet with its own gateway, you need policy routing; ask support for the correct details before setting it up.

### What happened to `eth0:1` alias interfaces?

`eth0:1` labels come from the older `ifconfig` tools. Current tools add several addresses directly to `eth0`, as shown above.

### The new IP doesn't answer from outside. What should I check?

Check `ip -br addr` shows it, that your firewall allows the traffic, and that the service listens on that address (`ss -tlnp`). Then confirm in the panel that the address is assigned to this server.

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every guide in this section.

> [card] [Static IP with Netplan](https://help.freakhosting.com/portals/other/how-to-configure-a-static-ip-with-netplan.md)
>
> Full Netplan setup on Ubuntu.

> [card] [Configure IPv6](https://help.freakhosting.com/portals/other/how-to-configure-ipv6-on-linux.md)
>
> Add IPv6 addresses and routes.

> [card] [Find your server IP](https://help.freakhosting.com/portals/other/how-to-find-your-server-ip-address.md)
>
> List every address on the server.

> [card] [Additional IPs on Windows](https://help.freakhosting.com/portals/other/how-to-add-additional-ip-addresses-on-windows-server.md)
>
> The same task on Windows Server.

> [card] [VPS network settings](https://help.freakhosting.com/portals/vps-panel/how-to-view-and-manage-network-settings.md)
>
> See the IPs assigned to your VPS.

***

> [!NOTE]
>
> **Checked against the [Netplan documentation](https://netplan.readthedocs.io/en/stable/using-static-ip-addresses/), [Red Hat Enterprise Linux 9 networking guide](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/configuring_basic_system_settings/assembly_configuring-and-managing-network-access_configuring-basic-system-settings) and Debian's [interfaces(5) manual](https://manpages.debian.org/trixie/ifupdown/interfaces.5.en.html)** on 4 November 2026; the Netplan example was validated with `netplan generate` and the `nmcli` syntax checked with `nmcli connection modify --help` on Ubuntu 24.04 LTS. Commands can differ on other distributions or releases.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.