CentOS add multiple IP address methods

Source: Internet
Author: User

The operation is as follows, login ssh:

The code is as follows Copy Code

vi/etc/sysconfig/network-scripts/ifcfg-eth0:0

The second IP is

The code is as follows Copy Code

Vi/etc/sysconfig/network-scripts/ifcfg-eth0:1

The third IP is
Ifcfg-eth0:2 (by analogy)

The code is as follows Copy Code


device=eth0:0 Network Card device Name
Onboot=yes Random Boot
Bootproto=static statically Assign IP
Ipaddr=*.*.*.* the IP address to add
netmask=255.255.255.0 Subnet Mask (Actual)
Gateway=*.*.*.* Routing


If the IP is contiguous, you can use the following method.

The code is as follows Copy Code

Vi/etc/sysconfig/network-scripts/ifcfg-eth0-range
Device=eth0
Bootproto=static
ipaddr_start= Start IP
Ipaddr_end= End IP
Clonenum_start= Network card starting number
netmask= Subnet Mask
Onboot=yes

Saving the file and restarting the Network service takes effect.

VI Ifcfg-eth0:2

Then enter, the following content

The code is as follows Copy Code

Device=eth0:2
Bootproto=static
ipaddr=178.252.202.179
netmask=255.255.255.248
Onboot=yes

Then execute the following command to enable 175.252.202.179 this IP

Ifup Eth0:2

Attention:
The variable names in the NIC configuration file such as device, and so on, all require uppercase. Configuring a different NIC requires only modification
DEVICE (device First name) ipaddr (IP address) NETMASK (subnet mask) these are 3.

Related Article

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.