1

I have two ethernet interfaces, namely eth0 and eth1. I want to implement an advanced routing rule but I am totally new to firewall/routing rules in CentOS.

Here is what I am trying to do:

Both my interfaces are up and connected to internet. I want to be able to decide dynamically based on the type of traffic through which interface it should go out.

For example, if it is HTTP traffic, I want it to use eth0 and if it is FTP etc traffic, I want it to use eth1, while different type of traffic could have the SAME destination IP address.

How can I accomplish this task?

Mat
  • 51,578
  • 10
  • 158
  • 140
pppoe
  • 23
  • 1
  • 6
  • A couple of questions: Is the traffic originating from the connected machine? If not, are you using NAT? – utopiabound Nov 28 '12 at 15:28
  • @utopiabound, for now i want to test with traffic originating from same machine, however the ultimate goal is exactly in a NAT'd scenario which i wouuld implement on both of these interfaces (may be) not really sure though – pppoe Nov 28 '12 at 15:47
  • possible duplicate of [Output traffic on different interfaces based on destination port](http://unix.stackexchange.com/questions/21093/output-traffic-on-different-interfaces-based-on-destination-port) – Gilles 'SO- stop being evil' Nov 28 '12 at 23:33

1 Answers1

0

This Advanced Routing & Traffic Control HOWTO should have what you need. Once you setup your networks, you'll want to write some rules that will mark packets to go over the alternate connection in iptables (see Chapter 11 Netfilter & iproute - marking packets).

utopiabound
  • 3,244
  • 21
  • 19