2

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

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 address/interface temporarily, like eth0:1?

Something like :

USE_INTERFACE=eth0:1 node test.js

3 Answers 3

2

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.

1

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 [email protected]

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 !

0

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/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .