[CentOS] routing with 2 public ips
Paul R. Ganci
ganci at nurdog.com
Fri Dec 25 20:28:03 UTC 2015
On 12/25/2015 12:44 PM, Joey wrote:
>
> i have a server with 2 public ips on 2 devices.
>
> I want that the request of incoming traffic dont use the default
> gateway. Incoming traffic sould be answered using the gateway of the
> incoming device
>
> Could i realize this with firewalld? Or directly iptables?
No you can not do that via firewalld or iptables. The problem is you
have to tell the packets to go out the proper interface which must be
done via routing tables. For that purpose you need ip route. I suggest
you take a look at
https://kindlund.wordpress.com/2007/11/19/configuring-multiple-default-routes-in-linux/
This link provides a very thorough description of what must be done.
Just a warning is that you will want your routing tables to be
maintained across system boots. I put my routes for my bridged
interfaces into:
/etc/sysconfig/network-scripts/route-br1
/etc/sysconfig/network-scripts/route-br2
You can put your routes into similar files... just replace the br1/br2
with your appropriate interface names.
--
Paul (ganci at nurdog.com)
Cell: (303)257-5208
More information about the CentOS
mailing list