This simple wrapper library allows you to set the source address of outgoing TCP and UDP traffic.


Download the libsis-0.1.1.tar.gz tarball. If you want, you can look at the sis.c source right now.


If you're on a multi homed host with more than one IP address the kernel usually select one source address based on varios parameters for you if your application does not ask for a particular address itself.

There are applications which let you set the local address of all outgoing connections. A prominent example are all sorts of IRC clients.

Most application however don't support this and unless you care for your source ip it doesn't matter.

In some setups however it is important which source address the application has. Like when you use source based routing, i.e. decide of a packets route not only based on destination but also on source address. This makes sense for instance if you have more than one connectio to the internet.


This library wraps around the libc functions connect() and sendto().

It then bind()s the socket to the local address specified by the SIS_SOURCE environment variable. If the application has already called bind() itself another call of bind() should not change anything - not that I've tested this.


Change to the libsis directory and run make. You should find a file named {.

Set the environment variable LD_PRELOAD to /path/to/libisis/directory/libsis.so:

export LD_PRELOAD=/path…./libsis.so

or if you're using a csh type shell

setenv LD_PRELOAD /path…./libsis.so

then set the environment variable SIS_SOURCE:

export SIS_SOURCE=

or again in a csh type shell


Note: Only IP Addresses are allowed, no hostnames.

Now call your program and it should have its source address set to $SIS_SOURCE in outgoing connections.

You may want to copy the libsis.so* files to a convinient directory.


Works for me; does everything I want.


  • 0.1.1 - 2002-05-23 Initial Release