2 NICs with different gateway
Dear All,
I am running centOS 5.6 with 2 NICs, I need to set gateway for each NIC.. Eth0: 10.100.100.1 gateway: 10.100.100.101 Eth1: 10.100.100.2 gateway: 10.100.100.102 so packages come from Eth0 will be routed to 10.100.100.101 so does packages come from Eth1 will be routed to 10.100.100.2 any body please help? many thanks in advance Teddy |
That's not how routing works. NICs don't have gateways; routing tables do, and you usually have exactly one of those.
I don't blame you for thinking gateways are somehow tied to NICs, though, because that's how many configuration tools present the parameters. But if you specify two "default gateways" (note how it doesn't really make sense to talk about having more than one "default" of anything), you end up with either:
It is possible to bind a process to a specific IP, but that won't actually affect the choice of gateway. To do that, you need to implement what is known as "policy routing", where you have more than one routing table using different gateways, and traffic is routed using the various tables based on some specific criteria, like the source address. Does that sound like what you want to accomplish? |
You can set up custom routing tables using iproute2 and give each nic a different default gateway. I've done so on CentOS 6, but only with the two nics on two different subnets.
I followed a process similar to the one described here: https://www.thomas-krenn.com/en/wiki..._on_One_System |
Dear All,
noted with thanks.. Regards Tedd |
All times are GMT -5. The time now is 11:50 PM. |