Configure multiple IP addresses for a single Nic On debian and centos

Source: Internet
Author: User

Debian and centos are configured with multiple IP addresses for a single Nic. debian and contos are bound with multiple IP addresses for a single Nic. For remote operations (such as ssh ), remember to restart the NIC | ifup eth0; otherwise, if there is a problem with the second IP address or the second configuration file, the network will be interrupted, and my debian will be disconnected .... Root @ debian:/etc/network # cat interfaces # This file describes the network interfaces available on your system # and how to activate them. for more information, see interfaces (5 ). # The loopback network interfaceauto loiface lo inet loopback # The primary network interfaceallow-hotplug appseth0 inet static address 10.0.0.212 netmask 255.255.255.0 network 10.0.0.0 broadcast 10.0.0.255 # dns-* o Ptions are implemented by the resolvconf package, if installed dns-nameservers 10.0.0.1allow-hotplug eth0: 1 iface eth0: 1 inet static address 10.0.0.145 netmask 255.255.255.0 network 10.0.0.0 broadcast 10.0.0.255 ## for wlan by # evan auto wlan0 # allow-hotplug wlan0 # iface wlan0 inet dhcp # wireless-essid Pie-58 # wireless -The key lailailaidebian is related to binding Dual ip addresses to a single Nic. A server is required recently, the ip addresses of China Netcom and China Telecom have been assigned separately, and many problems have been encountered. Share with you. A single network card is bound to a dual ip address. Many practices are being reproduced on the Internet. No one tests the authenticity of the ip address, especially for children's shoes that are far away from the data center. Procedure: $ sudo vi/etc/network/interfaces auto lo eth0iface lo inet loopbackiface eth0 inet staticaddress 255.255.192.168.10.1 auto eth0: 0 address 255.255.255.254.0gateway 192.168.10.52 $ sudo/etc/init. d/networking restart is just a practice circulating on the Internet, but I don't know if you have tested it. This doesn't work. The problem lies in eth0: 0. If one network card has two default gateways, the data will not be forwarded. The specific principle is that the ip routing process should be clear. Therefore, the correct method is to remove the gateway in eth0: 0, and then add the gateway in the route. For how to add the gateway, please refer to my previous post. You can also use iptable to do this.

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.