Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have created 3 virtual interface on a Linux system, using different IP.

I have a software doing requests to a server but it use the default interface, eth0.

Is it possible to execute a software using another ip/interface temporarily ? Like eth0:1 ?

Something like :

USE_INTERFACE=eth0:1 node test.js
share|improve this question

3 Answers 3

This is usually up to the software to support. It is usually implemented by binding the socket to the IP address of the interface you want to use. Check the documentation for a way to bind to a local ip address.

If the software does not support that you have access to the source, you may add or alter the bind() call after creating the socket, so bind to the interface you want.

It may also be possible to hide unwanted interfaces with the control groups features, if your kernel supports it.

share|improve this answer

You can override without touching to the software thanks to LD_PRELOAD.

I found that :

Bind.c

Compile it then :

$ BIND_ADDR="virtual_interface_ip" LD_PRELOAD=./bind.so ssh root@myserver.com

And it will use the virtual interface ip !

Then if you need to have multiple mac adresses on the same network card, you can use multimac :

Multimac

Happy hacking !

share|improve this answer

Ok it's easier by using the same strategy than virtualization system. Using bridge mode, brctl, here is a tutorial :

http://www.lainoox.com/bridge-brctl-tutorial-linux/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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