iii
Introduction v
1. Document Conventions ................................................................................................... vi
1.1. Typographic Conventions ..................................................................................... vi
1.2. Pull-quote Conventions ....................................................................................... viii
1.3. Notes and Warnings ........................................................................................... viii
2. Feedback ....................................................................................................................... ix
1. Linux Virtual Server Overview 1
1.1. A Basic LVS Configuration ........................................................................................... 1
1.1.1. Data Replication and Data Sharing Between Real Servers ................................... 3
1.2. A Three-Tier LVS Configuration .................................................................................... 3
1.3. LVS Scheduling Overview ............................................................................................ 4
1.3.1. Scheduling Algorithms ....................................................................................... 5
1.3.2. Server Weight and Scheduling ........................................................................... 6
1.4. Routing Methods .......................................................................................................... 7
1.4.1. NAT Routing ..................................................................................................... 7
1.4.2. Direct Routing ................................................................................................... 8
1.5. Persistence and Firewall Marks ..................................................................................... 9
1.5.1. Persistence ....................................................................................................... 9
1.5.2. Firewall Marks ................................................................................................. 10
1.6. LVS — A Block Diagram ............................................................................................ 10
1.6.1. LVS Components ............................................................................................ 11
2. Initial LVS Configuration 13
2.1. Configuring Services on the LVS Routers .................................................................... 13
2.2. Setting a Password for the Piranha Configuration Tool ................................................. 14
2.3. Starting the Piranha Configuration Tool Service ........................................................... 14
2.3.1. Configuring the Piranha Configuration Tool Web Server Port .............................. 15
2.4. Limiting Access To the Piranha Configuration Tool ....................................................... 15
2.5. Turning on Packet Forwarding .................................................................................... 16
2.6. Configuring Services on the Real Servers .................................................................... 16
3. Setting Up LVS 19
3.1. The NAT LVS Network ............................................................................................... 19
3.1.1. Configuring Network Interfaces for LVS with NAT .............................................. 19
3.1.2. Routing on the Real Servers ............................................................................ 20
3.1.3. Enabling NAT Routing on the LVS Routers ....................................................... 21
3.2. LVS via Direct Routing ............................................................................................... 21
3.2.1. Direct Routing and arptables_jf ......................................................................... 22
3.2.2. Direct Routing and iptables .............................................................................. 23
3.3. Putting the Configuration Together .............................................................................. 24
3.3.1. General LVS Networking Tips .......................................................................... 25
3.4. Multi-port Services and LVS ........................................................................................ 25
3.4.1. Assigning Firewall Marks .................................................................................. 26
3.5. Configuring FTP ......................................................................................................... 27
3.5.1. How FTP Works .............................................................................................. 27
3.5.2. How This Affects LVS Routing ......................................................................... 27
3.5.3. Creating Network Packet Filter Rules ................................................................ 28
3.6. Saving Network Packet Filter Settings ......................................................................... 29
4. Configuring the LVS Routers with Piranha Configuration Tool 31
4.1. Necessary Software ................................................................................................... 31
4.2. Logging Into the Piranha Configuration Tool ................................................................ 31