I can create an
example configuration for you if you are interested.
That would be great :-)
Thanks for your explanations!
I have not tested it, so there may be errors (my self compiled kernel at
home does not support iproute2).
Let say, you have 3 network cards with the following IP addresses:
eth0: 192.168.0.2/24
eth1: 192.168.1.2/24
eth2: 192.168.2.2/24
eth0 is connected to your company's network. eth1 and eth2 are connected
to 2 different internet providers. The gateway is 192.168.1.1 for eth1
and 192.168.2.1 for eth2.
Assuming you want to route mail over eth1 and web access over eth2, you
would do the following:
Mark all packets for mail routing:
iptables -t mangle -A PREROUTING -i eth1 -j MARK --set-mark 0x01
iptables -t mangle -A PREROUTING -i eth0 --dport 25 -j MARK --set-mark 0x01
Mark all packets for web access:
iptables -t mangle -A PREROUTING -i eth2 -j MARK --set-mark 0x02
iptables -t mangle -A PREROUTING -i eth0 --dport 80 -j MARK --set-mark 0x02
Populate routing table 1 (for eth1):
ip route add 192.168.0.0/24 dev eth0 table 1
ip route add default via 192.168.1.1 dev eth1 metric 1 table 1
Populate routing table 2 (for eth2):
ip route add 192.168.0.0/24 dev eth0 table 2
ip route add default via 192.168.2.1 dev eth2 metric 1 table 2
Populate the rule table to send all packets marked "0x01" to routing
table 1:
ip rule add fwmark 0x01 table 1
Populate the rule table to send all packets marked "0x02" to routing
table 2:
ip rule add fwmark 0x02 table 2
Greetings, Patrick Kaell