Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
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 –  Gilles Nov 28 '12 at 23:33
add comment

1 Answer

up vote 0 down vote accepted

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).

share|improve this answer
    
Thank you it was really helpful. –  pppoe Jan 24 '13 at 10:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.