Is it possible to have multiple public IP addresses (500) on one server running CentOS and switch them without restarting networking service.

I would like to use one public IP per specific service like sending mail, another for receiving mail or calling third party API.

The exact thing that I need is to somehow, when I run specific Python script for service - traffic will use public IP address defined in script.

  • 1
    The fact that you need to use 500 public addresses on one server is an early indication that you are doing something wrong.
    – dtoubelis
    Sep 13 '15 at 15:49
  • Please make sure you understand meaning of term "public IP address" and either rephrase your question or provide some context.
    – dtoubelis
    Sep 14 '15 at 0:39

To add another IP address to your interface is simple:

 ip addr add dev eth0 label eth0:1

Then in your Python code just bind to the IP address you want to use.

  • 1
    label eth0:1 can be omitted. And probably should be omitted. Sep 13 '15 at 17:05

I will bind range of IPs to server using this tutorial then in Python I will to bind it correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.