Re: [LARTC] How to MARK NATtted packets coming from external interface to an internal host ?

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 13, 2001 at 02:42:59PM -0200, Claudio L. Salvadori wrote:

> I have considered using 'tc filter' with the u32 classifier
> but I couldn't find a way to differentiate between traffic coming
> from the Internet (source ip = any) from traffic originating
> in the gateway (source ip = ip of eth0). I need this because
> I would like to shape only traffic coming from the Internet.
> Internal clients should be able to download data from the gateway 
> without any bandwidth restriction.

That basically means that you should use iptables. My own version of
iptables can to this:

# iptables -t mangle -A OUTPUT -d 1.2.3.4 -j PRIO --classid 10:2

To match only locally generated packets. Change OUTPUT to PREROUTING to
process all non-local packets. 

I'm trying to push this into the kernel, but will take a while.

> If at least there was a NOT (! like in iptables) operator
> in the match syntax  I could assume that traffic not coming from the 
> source ip of eth0 is coming from the Internet. Something like this:
> 
> tc filter add dev eth0 parent 10:1\
>                         protocol ip\
>                         prio 1\
>                         u32\
>   NOT operator -->      match ip src ! (eth0 IP)\
>                         match ip dst (client IP)\
>                         classid 10:2
> 
> Any ideas on how to differentiate these two kinds of traffic
> using 'tc filter' ?

Yes, make two rules. One that first exempts anything from your eth0 IP. Give
it prio 0, and the next rule prio 1, which will never see packets from your
local IP.

Regards,

bert

-- 
http://www.PowerDNS.com          Versatile DNS Software & Services
Trilab                                 The Technology People
Netherlabs BV / Rent-a-Nerd.nl           - Nerd Available -
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet



[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux