How to bind multiple IP addresses with one NIC under Linux

Source: Internet
Author: User
Tags bind

When we use Linux to set up Web servers and FTP servers, we may encounter the need to implement multiple sites on a single service (virtual host), in which case we can increase the physical network card to solve.    But how many extra slots do we have on our servers?    So we can do this by binding multiple IP addresses to a network card, so let's look at how to bind multiple IP addresses to a single NIC.    (IIS more than the virtual host set up, Apache under the IP based virtual host are all through this to achieve) Linux under the network card is the beginning of the ETH, network card configuration files stored in/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ETHX. Implementation method: 1 Copy the NIC configuration file, copy the ifcfg-eth0 into ifcfg-eth0:1-----------------------------------------------------[root@station ~] # cd/etc/sysconfig/network-scripts/

[Root@station network-scripts]# CP Ifcfg-eth0 ifcfg-eth0:1

-----------------------------------------------------2) To modify a new profile:-----------------------------------------------------[root@station network-scripts]# vim Ifcfg-eth0:1

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]

Device=eth0:1//Modified into eth0:1

Bootproto=static//IP address fetching mode, static, or none

ipaddr=192.168.1.11//New IP address

netmask=255.255.255.0//Mask

Onboot=yes//Boot auto Load

------------------------------------------------------the configuration file as above, keep it as above, and other deletions. 3 Activate the equipment, test the unicom situation, reboot and test. ------------------------------------------------------

[Root@station network-scripts]# ifup eth0:1

[Root@station network-scripts]# Ping 192.168.1.11

PING 192.168.1.11 (192.168.1.11) bytes of data.

Bytes from 192.168.1.11:icmp_seq=1 ttl=64 time=0.584 ms

Bytes from 192.168.1.11:icmp_seq=2 ttl=64 time=0.336 ms

---192.168.1.11 ping statistics---

2 packets transmitted, 2 received, 0% packet loss, time 999ms

RTT Min/avg/max/mdev = 0.336/0.460/0.584/0.124 ms

------------------------------------------------------

This is the addition of an IP, then add one more? Let's Test it together!

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/

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.