How to configure multiple IPs in Ubuntu 22.04

How to configure multiple IPs in Ubuntu22.04

How to configure multiple IPs in Ubuntu22.04. Nowadays, the IP addresses of overseas servers are generally one machine with multiple IPs. However, some service providers do not bind the IP address to the server. You need to set the binding manually, especially under Linux. Many novice users don’t know how to bind IPs. Let’s teach you how to configure binding multiple IPs in Ubuntu22.04.

Ubuntu 22.04 配置多IP的方法-1

Ubuntu configures multiple IPs

First, use the command to check the name of the network card configuration file.

ls /etc/netplan/

The name of the network card configuration file is 00-install-config.yaml , enter the /etc/netplan/ directory, and then use the vi command to open and edit this file.

cd /etc/netplan/ vi 00-installer-config.yaml

After opening the network card configuration file 00-install-config.yaml, find your IP address

# This is the network config written by 'subiquity' network: ethernets: eno1: addresses: - - critical: true dhcp-identifier: mac gateway4: match: macaddress: 00: 6b:2d:62:8h:18 nameservers: addresses: - search: - version: 2

Add your IP addresses below addresses:, one per line, with - in front of the IP address.

Note: After the IP address is your subnet mask, which will be provided by the host operator. You can also query on this machine


After modifying the network card configuration file, use the :wq! command to exit the vi editor.

If you enter the wrong command when saving using the vim command, it will report: E492: Not an editor command: qw!

The correct command is: wq!

The last step is to make the modified network card effective.

netplan apply


Ping the newly configured server IP on this machine. If the ping can be successful, then the multiple IPs have been successfully configured. At this point, the static IP configuration for Ubuntu22.04 is completed.

When configuring multiple IPs for Ubuntu 22.04, you need to pay attention to the following issues:

1. IP address validity: Ensure that the multiple IP addresses assigned are valid in the network and are not occupied by other devices.

2. Network interface: Select the correct network interface for configuration, usually an Ethernet interface (such as ens33). Make sure you know the interface name you want to configure.

3. Subnet mask: Set the correct subnet mask according to the network environment to ensure that the IP address is subneted correctly.

4. DHCP: If you need to use DHCP to obtain an IP address, ensure that the DHCP options are set correctly in the configuration.

5. Gateway and DNS: Configure the correct gateway and DNS server addresses to ensure normal network connection and domain name resolution.

6. Network configuration file: according to Different versions and network management tools may require the use of different configuration files or methods. Make sure you understand and use the appropriate configuration files correctly.

7. Conflict detection: When configuring multiple IP addresses, pay attention to avoid IP address conflicts. Make sure that each IP address is unique and does not conflict with the IP addresses of other devices.

8. Test and verify: After completing the configuration, perform a network connection test to ensure that multiple IP addresses are working properly and that communication with other network devices is normal.

9. Back up configuration files: Before making any configuration changes, it is a good idea to back up the original configuration files so that they can be restored if needed.

10. Understand the network topology: Understand the topology of the entire network, including subnets, VLANs, etc., to ensure that multi-IP configurations are compatible with the network environment. Configuring multiple IPs may vary depending on your network environment and specific needs. If you encounter problems, it is recommended to refer to Ubuntu's documentation, network administrator's guidance, or related technical forums for more accurate information and solutions. At the same time, proceed with caution and back up important configuration files to prevent unexpected situations.

5/5 - (1 vote)

Leave a Reply

Your email address will not be published. Required fields are marked *