How to add a single IP address and multiple IP addresses in CentOS

Source: Internet
Author: User
1. add a single IP address 1, enter/etc/sysconfig/network-scripts/to create a file ifcfg-eth0: *, * is the number, multiple IP addresses increase in turn to 0 as an example, create file ifcfg-eth0: 0 # cd/etc/sysconfig/network-scripts/# viifcfg-eth0: 0 & nb

1. add a single IP address
1. enter/etc/sysconfig/network-scripts/to create a file ifcfg-eth0: *, * is the number, multiple IP increases in turn
Take 0 as an example to create a file ifcfg-eth0: 0

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

2. enter the content in the following format:

DEVICE = eth0: 0 TYPE = Ethernet ONBOOT = yes BOOTPROTO = static IPADDR = IP address to be bound NETMASK = subnet mask GATEWAY = GATEWAY address

3. after saving, run service network restart to restart the IP address added by the network service.

# service network restart

 

2. add multiple IP addresses in batches
1. enter/etc/sysconfig/network-scripts/to create a file ifcfg-eth0-range0

 # vi ifcfg-eth0-range0

2. enter the content in the following format:

DEVICE = eth0 ONBOOT = yes BOOTPROTO = static IPADDR_START = start IP address IPADDR_END = end IP address CLONENUM_START = 0 GATEWAY = GATEWAY address NETMASK = subnet mask NO_ALIASROUTING = yes

3. after saving and exiting, run service network restart to restart the network service.

# service network restart
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.