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

Source: Internet
Author: User

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

1. Add a single IP Address:
Create a file ifcfg-eth0 in/etc/sysconfig/network-scripts/: *, * is the number, and multiple IP addresses increase in turn
Take 0 as an example to create a file ifcfg-eth0: 0
Cd/etc/sysconfig/network-scripts/
Vi ifcfg-eth0: 0

Input content format:
DEVICE = eth0: 0
TYPE = Ethernet
ONBOOT = yes
BOOTPROTO = static
IPADDR = IP address to be bound
NETMASK = Subnet Mask
GATEWAY = GATEWAY address

After saving, run servicenetworkrestart to restart the network service.

2. Add multiple IP addresses in batches:
Create a file ifcfg-eth0-range0 in/etc/sysconfig/network-scripts/
Vi ifcfg-eth0-range0

Enter the following file content format:
IPADDR_START = start IP Address
IPADDR_END = end IP
CLONENUM_START = 0

Note: The network configurations such as the gateway in the preceding file correspond to the network adapter eth0.
After saving and exiting, run service network restart to restart the network service.

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.