Application Layer Packet Shaping on Linux
sommere writes "We have added application layer (layer-7) filtering to Linux. That means that you can set up your linux-router/linux-switch to prioritize mail over the web over kazaa or gnutella regardless of what port each program is using. Colleges have been paying thousands of dollars for packet shapers to prioritize their networks, now you can do it for free. Get your kernel patch at l7-filter.sourceforge.net."
PS: fist post fools
This really helps networks that have smaller circuits and lots of clients doing various tasks on them. Not such a big help for a home user but great for corporations.
It's looking more and more like commodity linux boxen, with the right software, can do what your average pricey cisco box is renowned for.
If you can't beat them, arrange to have them beaten. -George Carlin
Hmm.. packet shaping.. can't wait to merge this in with the rest of my kernel and give it a whirl.. although, I do have to admit that some of the packets I've been getting are pretty nicely shaped.. there's the Ana packets, and the Kim packets.. but if this patch can help shape some of those no-so-well-shaped ones, I'm all for it!
---
Refusing to be a karma hore! Score: +5 Funny, -1 Karma Hore
In one hand, >I can prioritize what I want how I want. And it was good.
In the other hand, my ISP may downgrade my Quake performance or my school may block telnetting to my home box completely (no matter which port I put the demon on). And this was bad.
The idea is good but I'm worried it will be heavily abused and that worries me. In the other hand, it may mean a neat security tool...
45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B2
It cost my school 15 grand for 100mbit of shaping to be exact. Try using Kazaa when there are 4 huge dorms full of students trying to access kazaa, irc, ftp, hotline and some other protcols on 150k. Not fun
Tim Smith - Ramblings from Nerd Land
This type of thing has been in OpenBSD long time now (altq) but it nice to see that this type of thing is done in linux.
The problem in the world today is communication. Too much communication - Homer Simpson
you can set up your linux-router/linux-switch to prioritize mail over the web over kazaa or gnutella
I vote for more kazaa than mail. Unless someone sends me movies by mail.
"A door is what a dog is perpetually on the wrong side of" - Ogden Nash
Title says it all really. This will be of great help to those who implement/support Linux on a commercial level.
An infinite number of monkeys will eventually come up with the complete works of
If an attacker knows that you prioritize a certain service, wouldn't he cause a greater disruption with his DOS with this?
Another thing: couldn't the ??AA get ISPs to use this feature, not to kill P2P sharing, but to reduce its priority (perhaps as a compromise from not being able to kill P2P outright)?
Of course, there are many benefits to this as well, I'm just pointing out possiblities.
It is obvious to anyone that you could not possibly have developed such an advanced feature for the Linux kernel on your own or with the help of the community. This feature has obviously been lifted verbatim form the proprietary Unix code owned by SCO. I expect you to pay our standard SCOSource licensing fee of $150US per processor running this code, IMMEDIATELY. Failure to pay for this license within the hour is a violation of SCO's Intellectual Property rights and WE WILL SUE YOUR ASS OFF!!!!!!!!!!!!!
Darl "Sue em" McBride
How does a router know what the intended purpose/application a packet is destined for? Does not only the receiving computer actually know what applications have bound what ports?
Some drink at the fountain of knowledge. Others just gargle.
Yes! Hopefully my college's sysadmin will be nice enough to make Kazaa so slow that people will stop installing that spyware-infested, OS-breaking POS software, so that I (being a dorm's paid computer janitor) won't have to fix their computer later on :P
Now, if something could be done about stopping those fine young college girls inadvertantly running attacks on their campus's servers? :P
(Now that I think about it, I don't mind the girls needing help so much as the dumb college guys spilling beer on their laptop's keyboard...)
Is there any documentation on this feature or any other QoS/traffic shaping for linux?
I'm really interested in finding a way to limit bandwidth based on IP or MAC address or both. I understand dummynet for freebsd is great at this but I don't think it will work with my shuttle box due to the SiS 740/961 north/south bridge combo. I could barely get it working in linux.
Anybody have a good howto or something for linux traffic shaping?
-RobertWhy isn't anyone trying to make a home-server linux distro? "just put the cd in and wait, in half a hour you will have a printer-sharing, file-sharing server that will greatly enhance your internet experience! Now you and your family can download, surf and game without any problems in the bandwidth!" If Linux is going to break into home of joe average that might very well be the way. As a black box that does wonders for you. No learning, no configuring, just advantages.
For those of us practicing for our CCNA exams... packets are at layer 3, its known as data at layer 7.
FLR
the difference between bill and linus in this case is that bill FORCES it on you, linus does not. and my guess it that this feature WONT be bundled, per se (not a defaultly enabled feature), but just another option u can choose to use when you make menuconfig, like isdn support or telephony support.
> "I allege that SCO is full of it" -Linus
If your ISP starts using stuff like this start using a encrypted protocal to transport and tunnel your normal software.
Your ISP can tell you have a SSL tunnel but it's really hard to check what the packets are for.
There are ways around it. Currently the problem is with large amounts of ignorant or clueless users just destroying networks with stupid Kazaa searches for porn. Now they'll have to upgrade or try harder.
Remember it's like attrition (like spam) each side just one upping the other side
This packet shaping software must be watching for embedded packet headers within the stream.
Suppose you have a Kazaa packet that is tunneling through HTTP. The shaper notes the HTTP header and passes the data according to HTTP rules until the embedded Kazaa packet is found. Now the shaper switches to Kazaa mode and shaping changes accordingly.
Now, if you want to defeat the shaper, tar and compress your kazaa files, then uuencode them and embed them inside html files. To the packet shaper, it looks like you are transfering some very large web pages. Alternately, drop your uuencoded text into mail messages, instant messages, etc.
Does anyone else use Wondershaper? It works very well for my cable modem and is extremely easy to set up and use. Any comments on how it compares to this one?
Good work.
I've been doing traffic shaping based on port policies for months using the CBQ.init Script.
What's the advantage of using Layer-7 shaping, when CBQ does it quite efficiently?
This only works until the protocols become smarter. An encrypted IPIP (or SSH, or IPSec, et. al) stream carrying kazaa traffice looks the same to a packet inspection system as an encrypted IPIP tunnel carrying data from your rotodynamics sensors. There will come a point when bandwidth usage will be dealt with at the social level because all technical solutions have been obsoleted by encryption and tunnelling.
Thankfully, once your packets get routed onto the backbone, you shouldn't have to worry about this. Why? Because your data is packetized, and the internet is best effort. That means that your packets may travel over several sources to get to the destination. Thus, it would be possible to fragment your packets locally to a very high degree so that a router in the backbone would never be able to tell what protocol is in use because the packets would be sent via various hosts. So, the MPAA can't go an install this in the backbone of the net to stop your l33t divx pirating.
On a local network, well that's another story. There will always be ways around stuff like this though. It wouldn't be hard to get another link (cellphone?) and send just enough packets over that to make stuff confusing.
My Slashdot account is old enough to drink...
There is no SCO code in that patch is there? :)
Sorry I had to do it for one of these posts.
Mike
I didn't use the preview button, so get over it!!!!
Mike
I love you moderators. You mod up an incorrect post because you too are clueless. Here's a tip; when you don't really know the subject, don't moderate the post.
This dweeb is el wrongo and has a LOT to learn before he gets his shiny CCNA. I'll offer him this tidbit; your post would get you kicked out of the CCIE exam.
TTFN
Now that would be useful to have in the kernel.
I know you can do a certain amount with Apache, but to be able to slot a nice little Linux box in where an Alteon would normally sit would be a)cool and b)cheap.
oh brave new world, that has such people in it!
I suspect there are uncountably many other p2p systems, but as you have already noted none of them have the adoption rate of Kazaa.
The problem of adding to Kazaa is that it is uncertain what you will get out of it. Not uncertain in the sense that I was uncertain that my MSFT options would ever have value (they didn't), but uncertain in that when you identify your effort you open yourself to legal sanction.
That coupled with the scarcity of programming work today may explain why we see innovative security tools and p2p software that is still focusing on 1998-99 technology.
Finally, I can make sure my pesky mail doesn't slow down my pop-up ads!
[ http://www.dvigroup.net/self ]
but if you were considering deploying this on any server of major importance, you may want to notice that they moved from 0.0.1 release to 1.0 release in 11 days. I for one, am now even more eager to fire up this patch and then break it. :)
"This is Zombo Com, and welcome to you who have come to Zombo Com" - www.zombo.com
My name and thier protocol, it's kinda like Phoenix browser and database!!
For those not ready to upgrade to Linux 2.5, and for those on other platforms, there is Trickle, a userland traffic shaper for Linux, *BSD and Solaris. It works on a per-process basis (or on groups of processes to limit aggregate traffic consumption), does not require root-level access nor kernel patches, and is, of course, open source.
own the OSI model? =-).
My bro is an avid Kazaa/WinMX Pr0n colletor, and I'll come home and find 25 people downloading from him and his HUGE collection of trashy pr0n. :)
I'd like to be able to leave it running in a weighted environment without having to manually decide what share he should get or kill all the downloads
errr....umm...*whooosh* *whoosh* Is this thing on ?
Yep, if you have c:\... They disabled access to "program files" and "winnt" directories. (including temp directory, so if you get some files created there and they get your profile over the disk quotas, you can't even delete them, and since you're not allowed to save anything, the logout session can't be saved, the only logout method is the reset button.)
Posting anonymously to save my freshly earned karma modifier from harm if this gets modded down as offtopic (which it is). - SF.
FreeBSD has had this for years. Why keep on reinventing the wheel? Fight NIH!
Hmm ... ALPS for Linux ... sounds like it would go perfectly with my breast-shaped keyboard!
It was just a few months ago that i needed a solution like this but had to bite the bullet for one of those $15,000 packetShaper routers. This is great and it sucks at the same time ;(
More p0rn less SPAM :)
The OSI model is a MODEL.
You filter the equivalent of the 7th layer.
duh
The computing service (who're responsible for the university and student networks) monitor general levels of traffic; if you've been using a lot of bandwidth for extended periods of time, they'll contact you, ask you what your excuse is, and tell you to slow down. The idea is that after a few warnings they'll disconnect your network socket, but most people take the hint.
Just looking at the stats rather than the protocol is also good for plausible deniability, since they don't particularly want to know the specifics of illegal file sharing and the like; they have been known to specifically stop a Direct Connect hub, but IIRC that was after another student had a private feud with the hub operator and decided to report them, after which the computing service had little choice.
They also occasionally scan random IPs for common server and trojan ports, then connect to some servers to see what banners etc. they produces, but this is more an anti-h4x0r thing than anything else; they don't even seem to mind students running low-traffic web servers on port 80, but they're likely to contact the student and verbally cluebat them if the server says it's IIS.
Depends on the size of your incoming pipe. With my ~1.5meg DSL connection I expect my current hardware could keep up with it quite nicely; the hardware ain't where the bottleneck is. If I had some gigabyte fiber coming into the home it might be different, but for now hardware performance will not be a problem. What I can do with the new technologu is a different matter. Would still like to see more ideas than how to share porn.
I'm an American. I love this country and the freedoms that we used to have.
+/* XXX Is it ok to do nothing here? This gets called each time a filter
+is added (not sure why). */
This ain't touching my kernel...
Damn Kazaa users, how dare they saturate the network and degrade your Kazaa experience.
"I assumed blithely that there were no elves out there in the darkness"
This 'Linus' Gnome' clearly violates the First Law of Thermodynaics.
"I assumed blithely that there were no elves out there in the darkness"
I'm curious about this... how much luck would the traffic shaper have telling apart, for example, an SSL-encrypted IMAP session, HTTP session, or Jabber session. If they were going to arbitrary ports how would it tell them apart?
Does it need to perform its own man-in-the-middle attack to get at the transmitted data?
Guys, the XMMS team has been busy with exactly what these L7 guys are trying. Check out http://www.packetlogic.com No wonder XMMS is stuck at 1.2.7 :)
It runs on Linux and blows the doors of anything Cisco, Allot, anybody else can do with Layer 7 protocol shaping/firewalling and better yet, you even get real-time surveillance.
Don't tell my boss; he might make me put this on the router so his EverQuest sessions don't start lagging when some secretary starts doing useful work online...
the difference between bill and linus in this case is that bill FORCES it on you, linus does not.
Not that there is an HTML browser in every windows manager for XWindows or anything. Oh wait, there pretty much is. Um...
And the difference between them and MS is? Oh wait, I know, MS is actually an HTML rendering engine for developers, not just an inaccessible browser that is built into the XWindow desktop managers.
IE was a HTML rendering technology; the IE browser was just the pretty face in the early days. It was designed so developers could have their application display an HTML page just like they can tell Windows to draw a Button or show a Picture or put text on the screen.
It was an extension that was added to Windows just like when the ability to display a picture by just calling a few APIs was added to Windows.
Microsoft wanted Windows to be able to offer HTML display support natively, the browser was not something they set out to conquer the world with. At the time, they were more focused on MSN and its 'Explorer' based online browsing service.
People complain about IE being shoved down their throats, but I don't see them complain about the BITMAP rendering engine in Windows being shoved down their throat because MSPAINT is included in windows.
If you don't like IE, delete the Icons for it. You can even delete the HTML rendering engine, but it will break any application (such as ones made by my company) that use the HTML rendering engine to display help and HTML content for our users.
Additionally, I also don't see people complaining about the Browsers being shoved down their throats that are included in almost every Windows Manger for Linux. I also don't see people complaining that IBM shoved a browser down people's throats with OS/2. (If anyone is old enough to remember, it was the first mainstream PC OS that shipped with a built in browser - Windows was not. And in OS/2, it was just a browser, not something developers could access or use in their applications.)
Give up the 'We hate Microsoft Goat', especially over something like IE and the few megs that is added to the core of windows that gives developers a mechanism for displaying HTML natively in Windows. This is no different than the BITMAP rendering core in Windows or any other piece of Windows that makes Windows what it is and the GUI of Windows what it is.
Why does everything from MS have to be bad and everything from Linus have to be good. Please stop this crap. This has become a religious war that is really stupid when you step back and look at it.
In fact it has gotten so bad here, that there are even flame wars and religions popping up on which Linux distribution is better or whether OSX, Solaris, AIX, or FreeBSD is better.
What happened to evaluating products for what they are instead of just hating everyone else?
Please don't reply with the 'MS Bully, Monopoly' stuff, Sun, IBM and Apple have all done very 'questionable' stuff with licensing and anti-competitive practices. -And yes I can provide examples.
What I really want is to be able to redirect based on packet data, rather than port number.
If you can tell me how to do this on LVS, then I'd be much obliged - I can't see how to do it...
oh brave new world, that has such people in it!
i think this is inappropriate
It doesn't even see the code anymore, just - redhead - blonde...
Any technology distinguishable from magic, is insufficiently advanced.
oh brave new world, that has such people in it!
Nice troll.
Azurite is fine covellite is mine.
without a doubt, along with all the other advanced routing features of linux... none of them are default.
Vital services can still get in while your webserver remains overloaded.
Why are we advertising this? We're ruining the basis of our whole community!
Vehicle Stars used car search is my current project
got a full t-1 going through a linux router box with QoS, I started out just scheduling based on port, but now packet size is the best way. The pipe could have very heavy traffic, but yet my shell is a smooth as silk, DNS querys are quick. I recommend it highly
The American government is officially totalitarian
This is not a nightmare
It really is this bad
Please don't insult the suffering of all those who have actually lived under totalitarian rule.
So, if you happen to act like a terrorist the government will treat you one. They might even be blatantly racist and overzealous. But they're not totalitarian.
Dissent is still very much a part of America--and no one, yet, has been punished just for speaking out against the government. (Well, not citizens by the government. A few university professors and private citizens have lost their jobs, and a few immigrants have been forcefully emmigrated, but you get the point.)
(Not that Republican domination isn't that scary--[just what we need, tax cuts in wartime]--but it's not quite totalitarian. Might as well call Canada Communist.)
IMNVHO this would be better done in the netfilter (aka iptables) kernel subsystem than in the qdisc system. Not only can it then be used for more than just rate limiting (but also for firewalling, transparent proxying etc), but there is limited similar functionality already available in the patch tree (the STRING match) that could be extended to run regular expressions. Importantly, netfilter can communicate with the qdisc subsystem by tagging packates appropriately, enabling the rate-limiting and advanced queueing already discussed. I'm sure that the core work already done could be ported from one subsystem to to the other, although perhaps not overnight.
The fwsnort tool has proved the concept, I think, by translating rules from the Snort intrusion detection system into iptables rulesets.
For more complex protocols, such as FTP or IRC DCC, you'd also get Netfilter's connection-tracking support code for free.
I also think beginners will find the iptables tool easier to deal with that the tc tool, which has a steeper learning curve.
The Cisco equivalent of this is called Network-Based Application Recognition (NBAR). Rather than use regular expressions, Cisco ship PDLMs (Packet Description Language Modules) that can loaded and unloaded whilst IOS is running, much like you'd get by combining Netfilter's ip_conntrack_helper modules with the ideas these guys have.
(I still think they should be doing this inside Netfilter rather than qdisc)
NBAR can also be - and is - used to filter network worms at ISP borders, by matching the specially-crafted URLs used to compromise vulnerable systems. For example, here's the Cisco config to catch the Nimda worm.
If you were going to design a new network application, you could add a wrapper around your packet to make it look like an http packet or some higher priority packet.
http://yetanotherpoliticalrant.blogspot.com
Companies won't give me a job because I'm drawing ass and tities in Gimp. So I throw eggs at their front doors.
Paint is a wrapper for metafiles, not bitmaps. So nyah.
You complain about the current bandwidth usage of your brothers pr0n collection, but when asked, you provide his KaZaA username on slashdot. That's like putting a gun to your head, pull the trigger and blame the bullet for harming you.
Kjella
Live today, because you never know what tomorrow brings
IE started as just another application. Bundling it into the MSHTML components and ActiveX controls (which is rather more than a HTML renderer) didn't happen until much later.
Paint is a wrapper for metafiles, not bitmaps. So nyah.
Ok, MSPaint is a bitmap editor, it does not handle metafile (WMF or EMF metafiles) so nyah yourself.
Secondly, the original code that MS licensed to create IE was intended to be used as an engine for HTML. This is in the documents that are available regarding their meetings with Netscape when they wanted to originally license the Netscape technology instead of Mosaic. Go look it up, it is court record now.
As for them making it an ActiveX (OLE) based engine as apposed to the OLDER mechanisms for components in the GUI, has nothing to do with the intent of what they were doing.
This also shows that you have little knowledge of ActiveX and why they choose to use this mechanism for implementing the engine as opposed to just creating a new API subset for IE.
Considering you can't discern a metafile from a bitmap shows that this debate is probably not worth continuing.
This one is not an insurmountable problem, I AM the network admin, and the router is like 3ft from me, I was just thinking a dynamic weighting system, ala mainframe would be the IDEAL solution to the problem.
errr....umm...*whooosh* *whoosh* Is this thing on ?
This is utterly redundant, but I can't help but pat the team responsible for this on the back anyway: this is a fantastic addition to the capabilities of the Linux kernel. Well done guys!
You win again, gravity!
Dearest crackhead moderators,
Why has this blatant, non-paid marketing drivel been modded as being "Informative"?
Please fix it.
Thanks.
[Next week: "Informative" magazine subscription offers, "Interesting" cheap long distance, and "Insightful" YOU'VE ALREADY WON proclaimations.]
After seeing all the enthousiasm I read the referring page and their FAQ. It seems to be yet another 0.1 release of something that could be done. This is not something you could actually use and the n maybe refine a bit...
Also, from the FAQ it seems they are on a fundamentally wrong track:
A: Linux Quality of Service only looks at outgoing packets (once a
packet is in your computer why would you want to slow it down?)
First, there really is a point in slowing down incoming traffic, namely to throttle down the other side and avoid excessive queues to build up on a slow connection. It seems they did not get that.
But worse, it is a fundamental flaw to only look at outgoing traffic, and it also seems to be inferred that there is no state kept for a connection (they say it "classifies packets", not that it "classiefies connections"). This makes it useless.
E.g. when the incoming packet says "HELO domain" you may not want to slow that down but you may want to put that CONNECTION in the SMTP category. What can you do once the connection is transferring the SMTP data?
What you need for any packetshaping to be successfull is a state kept per connection that allows further shaping based on earlier matches.
I agree,
By putting this capability into netfilter you could also vastly improve on IP Accounting. Now not just accounting by service port but also by Application!
Try this: Luinux.
Still has some shotcomings but i'm working on them.
of course I presume if I access something via an ssh tunnel or vpn (providing they have priority) this can't have any effect.
To place the packets in the classes, you need some filters. The 2 most used filters are fw (it can use iptables marks) and u32 (it can use any bit in a packet). So basically, you are limited to ip-addresses and ports.
But with l7 filtering, you can look in the packets and use the contents of the packet to filter the packets and place them in the class you want. To do so, you have to be able the recognise the traffic. And that's what the extra kernel patch will do.
The more people are looking for ways to recognise patterns, the better. So if you find a new way to recoginise kazaa traffic (use tcpdump or so to examine the packets), send it to the l7 patch author so he can update the protocol definition file.
Some handy URL's : :) with more info about traffic shaping with cbq/htb.
lartc.org : information about "linux advanced routing and traffic control"
docum.org : my site
> It's not impossible to do throttling on inbound packets,
/. less and less useful.
Why in the hell are comments like that given moderator points? It's yet another example of the garbage that makes
You can not directly control inbound traffic. Think about it. It can't be done. You can't control the other end of the connection. The other end should slow down if it doesn't receive ACK's, but again, it is impossible to throttle inbound packets. If you could, then most DOS attacks would not work.
Judging by the patterns that comes along with the l7-filtering package, I'd say this is actually a layer-5 filtering process. All the patterns check only for the strings that are specific for establishing and maintaining the sessions, such as the POP3-server acknowledging that it is ready to recieve data, like the HTTP part where it looks for the request of a file.
Z \%]*
.pat file.
What the patterns don't look at is the presentation layer, such as what kind of file it's trying to get, or in what encoding format it is transfered. It also doesn't care of the contents of the file requested, hence it is neither level 6 (presentation) nor level 7 (application), but simply layer 5 (session).
So, the patterns that come along with this are only layer 5. This however, doesn't mean you can't do layer-7 filtering. It seems easy to me to add words that just can't be searched for with google. just add something like:
sexgoogling
GET \/search\?q\=[a-zA-Z\%]*(sex|xxx|porn|pr0n)[a-zA-
to a
--
Niklas
Quidquid latine dictum sit, altum sonatur.
I think everyone is missing something more important than blocking P2P networks. How about blocking SPYWARE clients (gator, cydoor, et. al.). I've blocked their ip address, but they simply use a different one. What about blocking THOSE packets because of their contents, because of their security risk. That seems like a much more worthwhile goal to me.
Your astute observation that "...but it isn't going to beat custom hardware of the same generation..." (my italics) refutes your argument if you know what the state of dedicated HW vs off-the-shelf is right now.
In order to keep their BOM (bill of materials) parts cost down, vendors like Cisco put JUST ENOUGH processor, ram etc into those dedicated appliances to run highly optimized stacks like IOS effectively within the Quality of Service guaranteed by the specs.. Which often results in CPU/RAM combinations in the Cisco box that have NOWHERE near the raw throughput of a commodity modern cheapo consumer PC system.
So, your point about generations is right on - the reality is that a $500 PC might have many times the raw performance of that multi-thousand$ highly optimized network appliance device which is usually (for cost -and design continuity and other reasons) coasting on much older generations of hardware - because it doesn't NEED to be faster. And it often has expensive, specialized ASICs and network processors to make keeping pace with current generic CPUs even less necessary. By comparison, cheap PC can run a generic kernel and stack, lose a LOT to inefficiency and still potentially outperform the dedicated appliance. ( I have no doubt that if Cisco built all their appliances with 3GHz cpus with 1/2 gig of RAM, with all the other advantages they have there would be no comparison - but they generally don't)
So the question is, what's the cost benefit comparison between efficient/proprietary/expensive/dedicated and inefficient/generic-high-throughput/cheapPC systems, if the PC can perform well enough?
Cost effectiveness comes down to cases, but it is not, I suggest, a slam-dunk for the Cisco and other specialized boxes.