Adv-Routing-HOWTO(1).pdf
(
246 KB
)
Pobierz
Linux Advanced Routing & Traffic Control HOWTO
Linux Advanced Routing & Traffic Control HOWTO
Bert Hubert
Netherlabs BV
<
bert.hubert@netherlabs.nl>
Gregory Maxwell
<
greg@linuxpower.cx>
Remco van Mook
<
remco@virtu.nl
>
Martijn van Oosterhout
<
kleptog@cupid.suninternet.com
>
Paul B Schroeder
<
paulsch@us.ibm.com>
Jasper Spaans
<
jasper@spaans.ds9a.nl>
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 Bucke.
...................................................................................................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
12.3. Policing filters.
..............................................................................................................................54
12.3.1. Ways to police.
....................................................................................................................54
12.3.2. Overlimit actions.
................................................................................................................55
12.3.3. Examples.
............................................................................................................................55
12.4. Hashing filters for very fast massive filtering..
.............................................................................55
Chapter 13. Kernel network parameters.
.......................................................................................................58
13.1. Reverse Path Filtering.
..................................................................................................................58
13.2. Obscure settings.
...........................................................................................................................59
13.2.1. Generic ipv4.
.......................................................................................................................59
13.2.2. Per device settings.
..............................................................................................................62
13.2.3. Neighbor policy.
..................................................................................................................63
13.2.4. Routing settings.
..................................................................................................................64
Chapter 14. Advanced & less common queueing disciplines.
.......................................................................66
14.1. bfifo/pfifo.
.....................................................................................................................................66
14.1.1. Parameters & usage.
............................................................................................................66
14.2. Clark−Shenker−Zhang algorithm (CSZ).
.....................................................................................66
14.3. DSMARK.
....................................................................................................................................67
14.3.1. Introduction.
........................................................................................................................67
14.3.2. What is Dsmark related to?.
................................................................................................67
ii
Linux Advanced Routing & Traffic Control HOWTO
Table of Contents
Chapter 14. Advanced & less common queueing disciplines
14.3.3. Differentiated Services guidelines..
.....................................................................................67
14.3.4. Working with Dsmark.
........................................................................................................68
14.3.5. How SCH_DSMARK works..
............................................................................................68
14.3.6. TC_INDEX Filter.
...............................................................................................................69
14.4. Ingress qdisc..
................................................................................................................................71
14.4.1. Parameters & usage.
............................................................................................................71
14.5. Random Early Detection (RED).
..................................................................................................71
14.6. Generic Random Early Detection.
................................................................................................72
14.7. VC/ATM emulation.
.....................................................................................................................72
14.8. Weighted Round Robin (WRR).
...................................................................................................72
Chapter 15. Cookbook.
.....................................................................................................................................74
15.1. Running multiple sites with different SLAs.
................................................................................74
15.2. Protecting your host from SYN floods.
........................................................................................75
15.3. Rate limit ICMP to prevent dDoS.
................................................................................................76
15.4. Prioritizing interactive traffic.
.......................................................................................................76
15.5. Transparent web−caching using netfilter, iproute2, ipchains and squid..
.....................................77
15.5.1. Traffic flow diagram after implementation.
........................................................................80
15.6. Circumventing Path MTU Discovery issues with per route MTU settings.
.................................80
15.6.1. Solution
...............................................................................................................................81
15.7. Circumventing Path MTU Discovery issues with MSS Clamping (for ADSL, cable, PPPoE
& PPtP users).
.......................................................................................................................................82
15.8. The Ultimate Traffic Conditioner: Low Latency, Fast Up & Downloads.
...................................82
15.8.1. Why it doesn't work well by defaul.
...................................................................................83
15.8.2. The actual script (CBQ).
.....................................................................................................84
15.8.3. The actual script (HTB).
......................................................................................................86
15.9. Rate limiting a single host or netmask.
.........................................................................................87
Chapter 16. Building bridges, and pseudo−bridges with Proxy ARP.
.........................................................89
16.1. State of bridging and iptables
.......................................................................................................89
16.2. Bridging and shaping.
...................................................................................................................89
16.3. Pseudo−bridges with Proxy−ARP.
...............................................................................................89
16.3.1. ARP & Proxy−ARP
............................................................................................................90
16.3.2. Implementing it.
..................................................................................................................90
Chapter 17. Dynamic routing − OSPF and BGP.
..........................................................................................92
Chapter 18. Other possibilities.
.......................................................................................................................93
Chapter 19. Further reading.
...........................................................................................................................95
Chapter 20. Acknowledgements.
.....................................................................................................................96
iii
Chapter 1. Dedication
This document is dedicated to lots of people, and is my attempt to do something back. To list but a few:
·
Alexey N. Kuznetsov
Rusty Russell
·
The good folks from Google
·
The staff of Casema Internet
·
Chapter 1. Dedication
1
Plik z chomika:
megaskrypty
Inne pliki z tego folderu:
3-Button-Mouse(1).pdf
(58 KB)
XWindow-Overview-HOWTO(1).pdf
(30 KB)
Xterm-Title(1).pdf
(39 KB)
Xterminals(1).pdf
(30 KB)
Xinerama-HOWTO(1).pdf
(33 KB)
Inne foldery tego chomika:
Programowanie
Zgłoś jeśli
naruszono regulamin