Linux Advanced Routing & Traffic Control HOWTO
Total Page:16
File Type:pdf, Size:1020Kb
Linux Advanced Routing & Traffic Control HOWTO Bert Hubert Netherlabs BV <[email protected]> Gregory Maxwell <[email protected]> Remco van Mook <[email protected]> Martijn van Oosterhout <[email protected]> Paul B Schroeder <[email protected]> Jasper Spaans <[email protected]> Revision History Revision 1.1 2002−07−22 DocBook Edition A very hands−on approach to iproute2, traffic shaping and a bit of netfilter. Linux Advanced Routing & Traffic Control HOWTO Table of Contents Chapter 1. Dedication.........................................................................................................................................1 Chapter 2. Introduction......................................................................................................................................2 2.1. Disclaimer & License.......................................................................................................................2 2.2. Prior knowledge................................................................................................................................2 2.3. What Linux can do for you...............................................................................................................3 2.4. Housekeeping notes..........................................................................................................................3 2.5. Access, CVS & submitting updates..................................................................................................3 2.6. Mailing list........................................................................................................................................4 2.7. Layout of this document...................................................................................................................4 Chapter 3. Introduction to iproute2..................................................................................................................5 3.1. Why iproute2?...................................................................................................................................5 3.2. iproute2 tour......................................................................................................................................5 3.3. Prerequisites......................................................................................................................................5 3.4. Exploring your current configuration...............................................................................................6 3.4.1. ip shows us our links...............................................................................................................6 3.4.2. ip shows us our IP addresses...................................................................................................6 3.4.3. ip shows us our routes.............................................................................................................7 3.5. ARP...................................................................................................................................................8 Chapter 4. Rules − routing policy database....................................................................................................10 4.1. Simple source policy routing..........................................................................................................10 4.2. Routing for multiple uplinks/providers...........................................................................................11 4.2.1. Split access............................................................................................................................12 4.2.2. Load balancing......................................................................................................................13 Chapter 5. GRE and other tunnels..................................................................................................................14 5.1. A few general remarks about tunnels:............................................................................................14 5.2. IP in IP tunneling............................................................................................................................14 5.3. GRE tunneling................................................................................................................................15 5.3.1. IPv4 Tunneling......................................................................................................................15 5.3.2. IPv6 Tunneling......................................................................................................................16 5.4. Userland tunnels..............................................................................................................................17 Chapter 6. IPv6 tunneling with Cisco and/or 6bone......................................................................................18 6.1. IPv6 Tunneling...............................................................................................................................18 Chapter 7. IPsec: secure IP over the Internet................................................................................................21 Chapter 8. Multicast routing...........................................................................................................................22 Chapter 9. Queueing Disciplines for Bandwidth Management....................................................................24 9.1. Queues and Queueing Disciplines explained..................................................................................24 9.2. Simple, classless Queueing Disciplines..........................................................................................25 9.2.1. pfifo_fast...............................................................................................................................25 9.2.2. Token Bucket Filter...............................................................................................................27 9.2.3. Stochastic Fairness Queueing................................................................................................29 i Linux Advanced Routing & Traffic Control HOWTO Table of Contents Chapter 9. Queueing Disciplines for Bandwidth Management 9.3. Advice for when to use which queue..............................................................................................30 9.4. Terminology....................................................................................................................................30 9.5. Classful Queueing Disciplines........................................................................................................32 9.5.1. Flow within classful qdiscs & classes...................................................................................32 9.5.2. The qdisc family: roots, handles, siblings and parents..........................................................33 9.5.3. The PRIO qdisc.....................................................................................................................34 9.5.4. The famous CBQ qdisc.........................................................................................................36 9.5.5. Hierarchical Token Bucket....................................................................................................41 9.6. Classifying packets with filters.......................................................................................................42 9.6.1. Some simple filtering examples............................................................................................43 9.6.2. All the filtering commands you will normally need..............................................................44 9.7. The Intermediate queueing device (IMQ).......................................................................................44 9.7.1. Sample configuration............................................................................................................45 Chapter 10. Load sharing over multiple interfaces.......................................................................................47 10.1. Caveats..........................................................................................................................................48 10.2. Other possibilities.........................................................................................................................48 Chapter 11. Netfilter & iproute − marking packets......................................................................................49 Chapter 12. Advanced filters for (re−)classifying packets............................................................................50 12.1. The u32 classifier..........................................................................................................................50 12.1.1. U32 selector.........................................................................................................................51 12.1.2. General selectors.................................................................................................................52 12.1.3. Specific selectors.................................................................................................................53 12.2. The route classifier........................................................................................................................53