To bind an additional IP address to your Ubuntu 22.04 server, you need to configure the network interface.
Step 1: Identify Network Interface
First, identify the network interface you want to bind the IP address to. Using this command:
ip a
You will see a list of network interfaces example (e.g., eth0
, ens33
, ens160
, etc.).
Step 3: Add Additional IP Configuration
Locate your primary network interface configuration and add the additional IP address under the addresses
section.
Example:
If you want to add an additional IP 192.168.1.101/24
to the ens33
interface, the configuration should look like this.
network:
version: 2
ethernets:
ens33:
dhcp4: no
addresses:
- 192.168.1.100/24 # Primary IP
- 192.168.1.101/24 # Additional IP
gateway4: 192.168.1.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
Step 4: Apply the Configuration
Save the file and apply the configuration using:
sudo netplan apply
Step 5: Verify the IP Binding
Check if the additional IP has been successfully added:
ip a
You should see both IP addresses listed under your network interface.
Troubleshooting Tips
-
If you get an error after applying the configuration, use:
sudo netplan try
This command helps to test the configuration before applying it permanently.