Excellent software and practical tutorials
How to configure multiple IP addresses in Ubuntu 22.04
How to configure multiple IPs in Ubuntu 22.04. Now the IP addresses of overseas servers are generally one machine with multiple IPs, but some service providers do not bind the IP address to the server, and need to manually set the binding, especially in Linux. Many novice users do not know how to bind IP. Here is how to configure binding multiple IPs in Ubuntu 22.04
Ubuntu configures multiple IP addresses
First, use the command to view the name of the network card configuration file
ls /etc/netplan/
The network card configuration file name is 00-install-config.yaml , enter the /etc/netplan/ directory, 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: - 192.168.0.64/29 - 192.168.0.65/29 critical: true dhcp-identifier: mac gateway4: 192.168.0.63 match: macaddress: 00:6b:2d:62:8h:18 nameservers: addresses: - 8.8.8.8 search: - nocix.net version: 2
Add your IP address under addresses:, one per line, with - in front of the IP address.
Note: The subnet mask is behind the IP address. The subnet mask host operator will provide it. You can also query it on your local machine.
route -n
After modifying the network card configuration file, use the :wq! command to exit the vi editor.
If you enter the wrong command when saving with 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 take effect.
netplan apply
Ping the newly configured server IP on this machine. If it can be pinged, then multiple IPs are configured successfully. At this point, the configuration of static IP in Ubuntu 22.04 is complete.
When configuring multiple IPs in Ubuntu 22.04, you need to pay attention to the following issues:
1. Validity of IP addresses: Make sure 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 to configure, usually an Ethernet interface (such as ens33). Make sure you know the name of the interface you want to configure.
3. Subnet mask: Set the correct subnet mask according to the network environment to ensure the correct subnet division of the IP address.
4. DHCP: If you need to use DHCP to obtain an IP address, make sure the DHCP options are set correctly in the configuration.
5. Gateway and DNS: Configure the correct gateway and DNS server address to ensure normal network connection and domain name resolution.
6. Network configuration file: According to Ubuntu Different versions and network management tools may require different configuration files or methods. Make sure you understand and use the appropriate configuration files correctly.
7. Conflict detection: When configuring multiple IP addresses, be careful to avoid IP address conflicts. Make sure 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 the configuration file: Before making any configuration changes, it is best to back up the original configuration file so that you can restore it when needed.
10. Understand the network topology: Understand the topology of the entire network, including subnets, VLANs, etc., to ensure that the multi-IP configuration is compatible with the network environment. The configuration of multi-IP may vary depending on the network environment and specific needs. If you encounter problems, it is recommended to refer to Ubuntu's documentation, the guidance of the network administrator, or related technical forums for more accurate information and solutions. At the same time, operate with caution and back up important configuration files to prevent unexpected situations.