| 1 | <?xml version='1.0' encoding='UTF-8'?> |
1 | <?xml version='1.0' encoding='UTF-8'?> |
| 2 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/home-router-howto.xml,v 1.4 2004/07/22 21:17:35 vapier Exp $ --> |
2 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/home-router-howto.xml,v 1.5 2004/07/27 00:58:04 vapier Exp $ --> |
| 3 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
3 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
| 4 | |
4 | |
| 5 | <guide link="/doc/en/home-router-howto.xml"> |
5 | <guide link="/doc/en/home-router-howto.xml"> |
| 6 | |
6 | |
| 7 | <title>Home Router Guide</title> |
7 | <title>Home Router Guide</title> |
| … | |
… | |
| 496 | If you have other common / cool examples, please <uri link="mailto:vapier@gentoo.org">e-mail me</uri>. |
496 | If you have other common / cool examples, please <uri link="mailto:vapier@gentoo.org">e-mail me</uri>. |
| 497 | </note> |
497 | </note> |
| 498 | </body> |
498 | </body> |
| 499 | </section> |
499 | </section> |
| 500 | |
500 | |
| 501 | <!-- |
|
|
| 502 | <section> |
|
|
| 503 | <title>Traffic Shaping</title> |
|
|
| 504 | <body> |
|
|
| 505 | <p> |
|
|
| 506 | TODO |
|
|
| 507 | </p> |
|
|
| 508 | </body> |
|
|
| 509 | </section> |
|
|
| 510 | --> |
|
|
| 511 | |
|
|
| 512 | <section> |
501 | <section> |
| 513 | <title>Identd (for IRC)</title> |
502 | <title>Identd (for IRC)</title> |
| 514 | <body> |
503 | <body> |
| 515 | <p> |
504 | <p> |
| 516 | Internet Relay Chat utilizes the ident service pretty heavily. Now that |
505 | Internet Relay Chat utilizes the ident service pretty heavily. Now that |
| … | |
… | |
| 529 | There are a few other ident servers in portage. Depending on your needs, |
518 | There are a few other ident servers in portage. Depending on your needs, |
| 530 | I would recommend checking out <c>oidentd</c> and <c>fakeidentd</c>. |
519 | I would recommend checking out <c>oidentd</c> and <c>fakeidentd</c>. |
| 531 | </p> |
520 | </p> |
| 532 | </body> |
521 | </body> |
| 533 | </section> |
522 | </section> |
|
|
523 | |
|
|
524 | <!-- |
|
|
525 | <section> |
|
|
526 | <title>Traffic Shaping</title> |
|
|
527 | <body> |
|
|
528 | <p> |
|
|
529 | This is an attempt to simply and Gentooify the <uri link="http://www.tldp.org/HOWTO/ADSL-Bandwidth-Management-HOWTO/">ADSL Bandwidth Management HOWTO</uri> |
|
|
530 | found over at the TLDP. Feel free to refer to the original document |
|
|
531 | for more details. |
|
|
532 | </p> |
|
|
533 | |
|
|
534 | <p> |
|
|
535 | Here we will be setting up what some people refer to as a "Packet Shaper", |
|
|
536 | <uri link="http://en.wikipedia.org/wiki/Traffic_shaping">"Traffic Shaping"</uri>, |
|
|
537 | or <uri link="http://en.wikipedia.org/wiki/QoS">"Quality of Service"</uri>. |
|
|
538 | Simply put, we want to setup rules on our router that will slow down |
|
|
539 | certain activities (like sending large e-mails or downloading from P2P |
|
|
540 | networks) while keeping other activities (like browsing the web or playing |
|
|
541 | online video games) reasonably fast. A 30 second difference in a video |
|
|
542 | game is a lot worse than a 30 second difference in downloading large |
|
|
543 | files :). |
|
|
544 | </p> |
|
|
545 | |
|
|
546 | <p> |
|
|
547 | The first thing is to make sure your kernel has all the features added to |
|
|
548 | it. See the chapter on <uri link="#doc_chap2">Kernel setup</uri> for more |
|
|
549 | information. Next, you will need to <c>emerge iptables iputils</c> so that |
|
|
550 | you will have access to the <c>iptables</c>, <c>ip</c>, and <c>tc</c> |
|
|
551 | commands. |
|
|
552 | </p> |
|
|
553 | |
|
|
554 | <p> |
|
|
555 | Before we jump into the commands, let's cover a little of the theory. The |
|
|
556 | way this whole system works is to classify common network streams and then |
|
|
557 | to prioritize them. You use iptables to classify network streams, iputils |
|
|
558 | to define the different priority levels, and the kernel to adjust speeds. |
|
|
559 | Just remember that although you can control outbound traffic pretty tightly |
|
|
560 | (from the LAN to the WAN), your ability to control inbound traffic (from |
|
|
561 | the WAN to the LAN) is somewhat limited. Just remember that the following |
|
|
562 | examples are to get your feet wet; if you want more then I'd suggest |
|
|
563 | reading up on the subject. In this example, we will be using the |
|
|
564 | <uri link="http://luxik.cdi.cz/~devik/qos/htb/">Hierarchical Token Buckets (HTB)</uri> |
|
|
565 | packet scheduling algorithm. Still with me? Great, let's start shaping :). |
|
|
566 | </p> |
|
|
567 | |
|
|
568 | <pre caption="Setup"> |
|
|
569 | DEV=eth1 <comment>NIC connected to WAN</comment> |
|
|
570 | RATE_OUT=100 <comment>Available outbound bandwidth (in kilobits [kb])</comment> |
|
|
571 | RATE_IN=1400 <comment>Available inbound bandwidth (in kb)</comment> |
|
|
572 | |
|
|
573 | <comment>Here we initialize the priority system. The 45 is used to set the default classification level.</comment> |
|
|
574 | ip link set dev ${DEV} qlen 30 |
|
|
575 | tc qdisc add dev ${DEV} root handle 1: htb default 45 |
|
|
576 | tc class add dev ${DEV} parent 1: classid 1:1 htb rate ${RATE_OUT}kbit |
|
|
577 | </pre> |
|
|
578 | |
|
|
579 | <p> |
|
|
580 | Here we initialized the system which will be used to prioritize all of |
|
|
581 | our network traffic. We created our queue, told it to use the HTB |
|
|
582 | algorithm, and set the default classification level to '45'. The |
|
|
583 | default is completely arbitrary, as are the levels we choose from |
|
|
584 | here on out. The only thing that matters is how the levels compare |
|
|
585 | relatively; a level '10' packet will be given preference over a |
|
|
586 | level '45' packet. Let's move on to declaring different levels. |
|
|
587 | </p> |
|
|
588 | |
|
|
589 | <pre caption="Declaring levels"> |
|
|
590 | tc class add dev $DEV parent 1:1 classid 1:10 htb rate $rkbit ceil $tkbit prio $p |
|
|
591 | tc qdisc add dev $DEV parent 1:10 handle 10: sfq |
|
|
592 | </pre> |
|
|
593 | </body> |
|
|
594 | </section> |
|
|
595 | --> |
| 534 | |
596 | |
| 535 | <section> |
597 | <section> |
| 536 | <title>Mail Server</title> |
598 | <title>Mail Server</title> |
| 537 | <body> |
599 | <body> |
| 538 | <p> |
600 | <p> |