To handle multiple public ip on one linux router

Let say we have at least 3 connections.

One private, one public (default outgoing), and a second public.

This is a typical config in your ‘/etc/network/interfaces’ :

And you will need additional route table, edit ‘/etc/iproute2/rt_tables’ and add :

So this config, create a second route table ‘public2’. Any incoming connection that pass through the public ip 2 will go out by this same ip.

By default your network will go out by the default IP (public ip 1)

Enjoy !

Short URL: