On Tue, Jun 26, 2001 at 02:28:51PM +0530, VaibhaV wrote:

> > How do I decide which network interface to send the packet to depending on
> > whether it is a mail or another protocol packet?
> 
> What you are talking about is "protocol based routing / filtering" which 
> can be done by using iptables. Search for iptables docs on google.
> 
> VaibhaV

To add more to this, see the following link
http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/Adv-Routing-HOWTO.html#ss8.5

An extract from the relevant section - 

================================================
10. Netfilter & iproute - marking packets

So far we've seen how iproute works, and netfilter was mentioned a few 
times. This would be a good time to browse through Rusty's Remarkably 
Unreliable Guides. Netfilter itself can
be found here. 

Netfilter allows us to filter packets, or mangle their headers. One 
special feature is that we can mark a packet with a number. This is done 
with the --set-mark facility. 

As an example, this command marks all packets destined for port 25, 
outgoing mail: 

     # iptables -A PREROUTING -i eth0 -t mangle -p tcp --dport 25 \
      -j MARK --set-mark 1

Let's say that we have multiple connections, one that is fast (and 
expensive, per megabyte) and one that is slower, but flat fee. We would 
most certainly like outgoing mail to go via the
cheap route. 

We've already marked the packets with a '1', we now instruct the routing 
policy database to act on this: 

     # echo 201 mail.out >> /etc/iproute2/rt_tables
     # ip rule add fwmark 1 table mail.out
     # ip rule ls
     0:      from all lookup local 
     32764:  from all fwmark        1 lookup mail.out 
     32766:  from all lookup main 
     32767:  from all lookup default 

Now we generate the mail.out table with a route to the slow but cheap 
link: 

     # /sbin/ip route add default via 195.96.98.253 dev ppp0 table 
mail.out

================================================

-- 
Politicians and Diapers need to be changed often,
                and for the same reason.
----------------------------------------------------------
 VaibhaV Sharma             |      [EMAIL PROTECTED]
 Exocore Consulting         |   http://www.exocore.com
 Bangalore, India           |         +91 (80) 3440397
----------------------------------------------------------

_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to