Bind multiple IP addresses to a LINUX Nic

Source: Internet
Author: User
In linux, we sometimes need to set different IP addresses for a single NIC, which involves binding multiple IP addresses to a single NIC. This method can be used to easily bind multiple IP addresses to a single NIC. The environment used by the author is centos5.6, which should be applicable to both fedora and rhel ....

 

In linux, we sometimes need to set different IP addresses for a single NIC, which involves binding multiple IP addresses to a single NIC. This method can be used to easily bind multiple IP addresses to a single NIC. The environment used by the author is centos5.6, which should be applicable to both fedora and rhel.

We know that the storage path of linux network devices is/etc/sysconfig/network-scripts/

 

The network adapter we want to apply is eth0. let's take a look at the IP address of the device.

 

IP: 192.168.234.128

Brast: 192.168.234.255

Mask: 255.255.255.0

To add an IP, you only need to create a ifcfg-eth0 in/etc/sysconfig/network-scripts/: x (x can be 0, 1, 2 .......). For ease we can talk about ifcfg-eth0, copy a Copy named ifcfg-eth0: 1 and then modify the file.

# Cat ifcfg-eth0 [root @ localhost network-scripts] #

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

DEVICE = eth0 (modified to eth0: 1)

BOOTPROTO = none

HWADDR = 00: 0C: 29: 96: 93: CA

ONBOOT = yes (indicates that the instance is enabled and retained)

NETMASK = 255.255.255.0

IPADDR = 192.168.234.128 (changed to the new ip address 192.168.234.100)

GATEWAY = 192.168.234.255

TYPE = Ethernet

USERCTL = no

IPV6INIT = no

PEERDNS = yes

Modified results:

 

Enable the device and run the command ifup eth0: 1.

Next, we will test the ping function on another computer.

 

After testing, we can add an IP address. we can also add n ip addresses.

This article comes from "cloud computing, IT is no longer important ." Blog

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.