[CentOS] CentOS 4.x - Multiple gateways

Feizhou feizhou at graffiti.net
Fri May 26 06:35:17 UTC 2006


Tom Brown wrote:
> Hi
> 
> On a multihomed box how can i set different gateways for each NIC? 
> Setting them in the ifcfg-ethx does not seem to make any difference to 
> the routing?
> 
> thanks
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos

Try creating routing tables per NIC, populating those tables and 
creating ip rules to lookup the respective table. This means you need to 
identify which NIC the packets belong to. You can try adding rules to 
the mangle PREROUTING chain of netfilter to mark the packets based on 
their source ip. Then the ip rules can instruct the kernel to lookup the 
proper routing table depending on the firewall mark.

man ip, man iptables, http://linux-ip.net/html/routing-tables.html and 
http://linux-ip.net/html/tools-ip-route.html




More information about the CentOS mailing list