Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a VPS with 4 IP addresses. I am changing the IP address of eth0 on daily basis. eht0:1 has its own IP address.

eth0 (,,
eth0:1 (

I have my custom written Python scripts those are continuously uploading data to remote database and other processes. I want to know which interface my scripts will use?

Because I am changing the eth0 IP address daily, I want that my script will use only eth0. And I want to use eth0:1 for ping and http apache server.

share|improve this question

closed as unclear what you're asking by slm, Anthon, peterph, jasonwryan, terdon Dec 28 '13 at 23:45

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

It depends on your routing table configuration, not NIC interfaces.

So to find out which interface it is using, you need to know which gateway kernel uses to route the packets, e.g

%> ip route get dev vboxnet0  src 

Fom the output you can tell the interface in use is vboxnet0

share|improve this answer

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