Bind an Eni to multiple IP addresses in Ubuntu

Source: Internet
Author: User

You can modify the IP address of an Ubuntu Nic in two ways.

The first method is static modification.

 

Go to the/etc/Network/directory and modify the interfaces file.

# The primary network interface
Auto eth0
Iface eth0 Inet static
Address 110. 25 .*.*
Netmask 255.255.255.0
Gateway 110. 25. *. 1

# Auto eth0: 0
# Iface eth0: 0 Inet static
# Address 110. 25 .*.*
# Netmask 255.255.255.0
 

I added the blue part. eth0: 0 is similar to the array subscript. next, you can bind multiple objects, and so on. eth0: 1, eth0: 2, eth0: 3 ........

 

The second method is dynamic modification.


Use the ifconfig command

Sudo ifconfig eth0: 0 110. 25. *. * broadcast 110. 25. *. 255 netmask 255.255.255.0
 
Note:

The first method will not expire after you modify and restart the instance. If this method is slightly improper, remote connection will fail.
The second method takes effect only for the moment and will expire after restart, but will not cause inconvenience to you due to improper operations.
 
Run the ifconfig command to check the modification.
Eth0
Eth0: 0 (one more eth0: 0, check whether it is the same as the gateway of eth0)
Lo

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.