Sometimes one network card needs to answer to more than one IP address - the classic case being two services that both insist on the same port (game servers, mail servers, anything with a hardcoded port a client won't let you override). Instead of fighting for the port, you give the box a second identity on the network and let each service own its own address. Usually I would personally use my reverse proxy, but sometimes this is not an option. This walkthrough covers Ubuntu with netplan + NetworkManager as the renderer. If your netplan config uses renderer: networkd instead, the commands differ - check with cat /etc/netplan/*.yaml first.

1. Check your current setup

Find your interface name and confirm the renderer:
ip addr
sudo cat /etc/netplan/*.yaml
Look for a line like renderer: NetworkManager. If you see that, use the nmcli method below. Note your interface name too (e.g. enp42s0, eth0) - you'll need it.

$ sudo cat /etc/netplan/*.yaml
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
network:
  version: 2
  ethernets:
    enp42s0:
      dhcp4: true
As seen above mine is NetworkManager and network card is enp42s0.

2. Test it live first (temporary - gone on reboot)

Before touching any persistent config, add the address directly with ip. This is a good sanity check before committing to it permanently. Say you have 192.168.0.10 and you need to add 192.168.0.11
sudo ip addr add 192.168.0.11/24 dev enp42s0
Confirm it's live:
ip addr show enp42s0
You should see a second inet line for 192.168.0.11/24 alongside your existing address, marked secondary.

$ ip addr show enp42s0
2: enp42s0:  mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether d8:43:ae:4d:aa:a2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.11/24 brd 192.168.0.255 scope global noprefixroute enp42s0
       valid_lft forever preferred_lft forever
    inet 192.168.0.10/24 brd 192.168.0.255 scope global secondary dynamic noprefixroute enp42s0
       valid_lft 78038sec preferred_lft 78038sec

3. Find the NetworkManager connection profile

nmcli con show
Match the connection NAME to your interface's DEVICE column - typically something like netplan-enp42s0.

$ nmcli con show
NAME             UUID                                  TYPE      DEVICE          
netplan-enp42s0  8b20fbe7-8eac-2ab2-8765-d3c2fb430e87  ethernet  enp42s0        

4. Make it permanent

This adds the address to the saved profile without disturbing your existing (likely DHCP) address:
sudo nmcli con mod netplan-enp42s0 +ipv4.addresses 192.168.0.11/24
sudo nmcli con up netplan-enp42s0
Heads up: con up briefly reapplies the whole network profile. If you're connected over SSH via the primary address, the session will very likely survive since that address doesn't change - but don't be alarmed if it blips for a second. But still, take your precautions!

5. Confirm it stuck

ip addr show enp42s0
nmcli con show netplan-enp42s0 | grep ipv4.addresses
The first command confirms the address is live right now. The second confirms it's saved into the connection profile - meaning it'll still be there after a reboot. You want to see 192.168.0.11/24 in both outputs.

Removing the IP again

To back this out cleanly, remove the address from the saved profile and reapply:
sudo nmcli con mod netplan-enp42s0 -ipv4.addresses 192.168.0.11/24
sudo nmcli con up netplan-enp42s0
Note the - instead of + - that's what tells NetworkManager to remove that specific address from the list rather than add to it.

Confirm it's actually gone

ip addr show enp42s0
nmcli con show netplan-enp42s0 | grep ipv4.addresses
The 192.168.0.11 line should no longer appear in either output. If you only ran the temporary ip addr add from step 2 and never made it permanent, a simple reboot (or sudo ip addr del 192.168.0.11/24 dev enp42s0) clears it just as well, since it was never saved anywhere.

Quick reference

ActionCommand
Add (temporary)sudo ip addr add 192.168.0.11/24 dev enp42s0
Add (permanent)sudo nmcli con mod netplan-enp42s0 +ipv4.addresses 192.168.0.11/24
Apply changessudo nmcli con up netplan-enp42s0
Remove (permanent)sudo nmcli con mod netplan-enp42s0 -ipv4.addresses 192.168.0.11/24
Verify liveip addr show enp42s0
Verify persistednmcli con show netplan-enp42s0 | grep ipv4.addresses