SlideShare a Scribd company logo
LoadBalancing с Linux



 Какво е това нещо LoadBalancer


 Защо може да ми трябва подобно чудо




                                  </WebTech
LoadBalancing с Linux

    Видове LoadBalancing

 Service

 Server

 Network




                           </WebTech
LoadBalancing с Linux

    Service LoadBalancing

 Web server balancing

 Mail server balancing

 DataBase server balancing




                             </WebTech
LoadBalancing с Linux

DNS Round-robin
                                  1    2     3
+ clusters
+ SAN                    DNS    WEB   WEB WEB
+ друг вид Distributed
Network Storage          www.site.com address 1

                         www.site.com address 1
                         www.site.com address 2
                         www.site.com address 3

Кой използва тази технолагия?


                                       </WebTech
LoadBalancing с Linux

           Network LoadBalancing
Route (split access)

Route (multihomed)

Bonding(shared access)

Комбинация



                              </WebTech
LoadBalancing с Linux

             Route (spit access)
/etc/iproute2/rt_tables
   255    local         12   isp1
   254    main          13   isp2
   253    default
ip route add $LOCAL_NET dev $IF_LOCAL table isp1
ip route add $NET_ISP1 dev $IF_ISP1 table isp1
ip route add 0/0 via $GW_ISP1 table isp1

ip route add $LOCAL_NET dev $IF_LOCAL table isp2
ip route add $NET_ISP2 dev $IF_ISP2 table isp2
ip route add 0/0 via $GW_ISP2 table isp2

                                          </WebTech
LoadBalancing с Linux

               Route (spit access)
ip rule add from $IP_ISP1 table isp1
ip rule add from $IP_ISP2 table isp2

iptables -t nat -A POSTROUTING -j SNAT -s $LOCAL_IP 
–to $IP_ISP1

iptables -t nat -A POSTROUTING -j SNAT -s $LOCAL_IP 
–to $IP_ISP2




                                              </WebTech
LoadBalancing с Linux

               Route (multihomed)
ip route add 0/0 nexthop via $GW_ISP1 weight 1 
                 nexthop via $GW_ISP2 weight 2

ip rule add from fwmask 1 table isp1
ip rule add from fwmask 2 table isp2

iptables -A POSTROUTING -t nat -m mark --mark 1 -j SNAT
 --to $IP_ISP1
iptables -A POSTROUTING -t nat -m mark --mark 2 -j SNAT
 --to $IP_ISP2


                                               </WebTech
LoadBalancing с Linux

              Route (multihomed)

iptables -t mangle -A POSTROUTING -j MARK --set-mark 1
 -m state --state NEW -o $IF_ISP1
iptables -t mangle -A POSTROUTING -j MARK --set-mark 2
 -m state --state NEW -o $IF_ISP2

iptables -t mangle -A POSTROUTING -j CONNMARK 
--save-mark -m state --state NEW
iptables -t mangle -A PREROUTING -j CONNMARK 
--restore-mark


                                              </WebTech
LoadBalancing с Linux

         Route (multihomed)

patch-o-matic-ng (преди 12.05.2006)

  модули:
    random
    nth




                                      </WebTech
LoadBalancing с Linux

            Bonding (share load)

Какво е представлява

Какво може да прави

Настройки

Проблеми




                                   </WebTech
LoadBalancing с Linux

                Bonding (share load)
  Нужен софтуер

   # gcc -Wall -O -I/usr/src/linux/include ifenslave.c -o
ifenslave
   # cp ifenslave /sbin/ifenslave

  Настройки

     /etc/modules.conf     /etc/modprobe.conf



                                                    </WebTech
LoadBalancing с Linux

           Bonding (share load)
Monitoring
  arp_interval
  arp_ip_mon
  downdelay(ethernet)
  miimon

Пример
  alias bond0 bonding
  options bond0 mode=balance-alb miimon=100
        primary=eth0 updelay=50


                                        </WebTech
LoadBalancing с Linux

           Bonding (share load)
Type of bonding
  mode 0 или balance-rr
  mode 1 или active-backup
  mode 2 или balance-xor
  mode 3 или broadcast
  mode 4 или 802.3ad(link agregation)
  mode 5 или balance-tlb
  mode 6 или balance-alb




                                        </WebTech
LoadBalancing с Linux

          Bonding (share load)

Проблемите
  ограниченията на ethernet
  arp_interval & arp_ip_target
  missing interfaces




                                 </WebTech
LoadBalancing с Linux

          Комбинации

Bonding tunels за Българския трафик

Split access за Международният трафик

Проблемите




                                        </WebTech
LoadBalancing с Linux

    ?               ?               ?               ?               ?           ?
            ?                   ?           ?               ?
?       ?               ?                 ?                                 ?
    ?           ?                   ? Въпроси ?                         ?
?
            ?               ?           ?           ?           ?       ?
? ?                 ?           ?               ?           ?                   ?
 ? ?                    ?               ?           ?               ?       ?
?       ?           ?       ?               ?           ?       ?       ?
                                                                        </WebTech

More Related Content

PDF
Multihomed Linux router
PDF
Cumulus Linux 2.5.5 What's New
PPTX
Building Scalable Data Center Networks
PDF
Ifupdown2: Network Interface Manager
PDF
Mlag invisibile layer 2 redundancy
PDF
Installation of pfSense on Soekris 6501
PDF
[2018.10.19] Andrew Kong - Tunnel without tunnel (Seminar at OpenStack Korea ...
PDF
Training Slides: Advanced 301: Multi-Site/Multi-Master Tungsten Clustering De...
Multihomed Linux router
Cumulus Linux 2.5.5 What's New
Building Scalable Data Center Networks
Ifupdown2: Network Interface Manager
Mlag invisibile layer 2 redundancy
Installation of pfSense on Soekris 6501
[2018.10.19] Andrew Kong - Tunnel without tunnel (Seminar at OpenStack Korea ...
Training Slides: Advanced 301: Multi-Site/Multi-Master Tungsten Clustering De...

What's hot (17)

PDF
Linux Networking Explained
PDF
Operationalizing BGP in the SDDC
PDF
Building your own sdn with debian linux salt stack and python
PDF
Huawei ARG3 Router How To - Troubleshooting OSPF: Router ID Confusion
PDF
Cumulus Linux 2.5.4
PPT
flowspec @ APF 2013
PDF
Ccna icnd2-labs exercices
PPTX
Operationalizing VRF in the Data Center
TXT
Chapter 03 configuring link aggregation and bridging
PPTX
Install ovs on local pc
PDF
Huawei ARG3 Router How To - Troubleshooting OSPF: Netmask mismatch
PDF
Network Test Automation 2015-04-23 #npstudy
PDF
Contemporary Linux Networking
PDF
Network Jumbo Frame Config Guide
PDF
Understanding Open vSwitch
PDF
Apache Httpd and TLS certificates validations
PPTX
OpenvSwitch Deep Dive
Linux Networking Explained
Operationalizing BGP in the SDDC
Building your own sdn with debian linux salt stack and python
Huawei ARG3 Router How To - Troubleshooting OSPF: Router ID Confusion
Cumulus Linux 2.5.4
flowspec @ APF 2013
Ccna icnd2-labs exercices
Operationalizing VRF in the Data Center
Chapter 03 configuring link aggregation and bridging
Install ovs on local pc
Huawei ARG3 Router How To - Troubleshooting OSPF: Netmask mismatch
Network Test Automation 2015-04-23 #npstudy
Contemporary Linux Networking
Network Jumbo Frame Config Guide
Understanding Open vSwitch
Apache Httpd and TLS certificates validations
OpenvSwitch Deep Dive
Ad

Viewers also liked (7)

PPT
Web Server Clustering - OSSCAMP
PDF
Rfc3261
PDF
Dell Boomi AtomSphere - A presentation by RapidValue Solutions
PPTX
LOAD BALANCING ALGORITHMS
PDF
Dell Boomi AtomSphere - iPaaS Document by RapidValue Solutions
PPT
Load Balancing
PPTX
Load balancing
Web Server Clustering - OSSCAMP
Rfc3261
Dell Boomi AtomSphere - A presentation by RapidValue Solutions
LOAD BALANCING ALGORITHMS
Dell Boomi AtomSphere - iPaaS Document by RapidValue Solutions
Load Balancing
Load balancing
Ad

Similar to Load balancing with Linux (20)

PPTX
The Basic Introduction of Open vSwitch
PDF
Fisl - Deployment
PDF
[네이버오픈소스세미나] Maglev Hashing Scheduler in IPVS, Linux Kernel - 송인주
PDF
VMware ESXi - Intel and Qlogic NIC throughput difference v0.6
PPTX
OpenStack Neutron Dragonflow l3 SDNmeetup
PDF
10 sdn-vir-6up
PPTX
DragonFlow sdn based distributed virtual router for openstack neutron
PDF
Deployment de Rails
PDF
Installation of pfSense on Soekris 6501
PDF
Tópicos - LVS Instalacao Slack11
PDF
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress Guide
PPTX
Don't think about the difficulty Let's try to connect easy to IPv6 network w...
PDF
Deployment with Ruby on Rails
PPTX
Webinar: Agile Network Deployment
PDF
intro lect.pdfkkpkpkpkpkpjjkojkopjjojjoj
PDF
Using Agilio SmartNICs for OpenStack Networking Acceleration
PDF
Linux Kernel vs DPDK: HTTP Performance Showdown
PPTX
PPTX
Scaling OpenStack Networking Beyond 4000 Nodes with Dragonflow - Eshed Gal-Or...
PPTX
22 - IDNOG03 - Christopher Lim (Mellanox) - Efficient Virtual Network for Ser...
The Basic Introduction of Open vSwitch
Fisl - Deployment
[네이버오픈소스세미나] Maglev Hashing Scheduler in IPVS, Linux Kernel - 송인주
VMware ESXi - Intel and Qlogic NIC throughput difference v0.6
OpenStack Neutron Dragonflow l3 SDNmeetup
10 sdn-vir-6up
DragonFlow sdn based distributed virtual router for openstack neutron
Deployment de Rails
Installation of pfSense on Soekris 6501
Tópicos - LVS Instalacao Slack11
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress Guide
Don't think about the difficulty Let's try to connect easy to IPv6 network w...
Deployment with Ruby on Rails
Webinar: Agile Network Deployment
intro lect.pdfkkpkpkpkpkpjjkojkopjjojjoj
Using Agilio SmartNICs for OpenStack Networking Acceleration
Linux Kernel vs DPDK: HTTP Performance Showdown
Scaling OpenStack Networking Beyond 4000 Nodes with Dragonflow - Eshed Gal-Or...
22 - IDNOG03 - Christopher Lim (Mellanox) - Efficient Virtual Network for Ser...

More from Marian Marinov (20)

PDF
How to start and then move forward in IT
PDF
Thinking about highly-available systems and their setup
PDF
Understanding your memory usage under Linux
PDF
How to implement PassKeys in your application
PDF
Dev.bg DevOps March 2024 Monitoring & Logging
PDF
Basic presentation of cryptography mechanisms
PDF
Microservices: Benefits, drawbacks and are they for me?
PDF
Introduction and replication to DragonflyDB
PDF
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQ
PDF
How to successfully migrate to DevOps .pdf
PDF
How to survive in the work from home era
PDF
Managing sysadmins
PDF
Improve your storage with bcachefs
PDF
Control your service resources with systemd
PDF
Comparison of-foss-distributed-storage
PDF
Защо и как да обогатяваме знанията си?
PDF
Securing your MySQL server
PDF
Sysadmin vs. dev ops
PDF
DoS and DDoS mitigations with eBPF, XDP and DPDK
PDF
Challenges with high density networks
How to start and then move forward in IT
Thinking about highly-available systems and their setup
Understanding your memory usage under Linux
How to implement PassKeys in your application
Dev.bg DevOps March 2024 Monitoring & Logging
Basic presentation of cryptography mechanisms
Microservices: Benefits, drawbacks and are they for me?
Introduction and replication to DragonflyDB
Message Queuing - Gearman, Mosquitto, Kafka and RabbitMQ
How to successfully migrate to DevOps .pdf
How to survive in the work from home era
Managing sysadmins
Improve your storage with bcachefs
Control your service resources with systemd
Comparison of-foss-distributed-storage
Защо и как да обогатяваме знанията си?
Securing your MySQL server
Sysadmin vs. dev ops
DoS and DDoS mitigations with eBPF, XDP and DPDK
Challenges with high density networks

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Machine Learning_overview_presentation.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
cuic standard and advanced reporting.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Machine learning based COVID-19 study performance prediction
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
20250228 LYD VKU AI Blended-Learning.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Unlocking AI with Model Context Protocol (MCP)
Building Integrated photovoltaic BIPV_UPV.pdf
Machine Learning_overview_presentation.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
cuic standard and advanced reporting.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
The AUB Centre for AI in Media Proposal.docx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Machine learning based COVID-19 study performance prediction
MIND Revenue Release Quarter 2 2025 Press Release
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Big Data Technologies - Introduction.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation_ Review paper, used for researhc scholars
Mobile App Security Testing_ A Comprehensive Guide.pdf

Load balancing with Linux

  • 1. LoadBalancing с Linux Какво е това нещо LoadBalancer Защо може да ми трябва подобно чудо </WebTech
  • 2. LoadBalancing с Linux Видове LoadBalancing Service Server Network </WebTech
  • 3. LoadBalancing с Linux Service LoadBalancing Web server balancing Mail server balancing DataBase server balancing </WebTech
  • 4. LoadBalancing с Linux DNS Round-robin 1 2 3 + clusters + SAN DNS WEB WEB WEB + друг вид Distributed Network Storage www.site.com address 1 www.site.com address 1 www.site.com address 2 www.site.com address 3 Кой използва тази технолагия? </WebTech
  • 5. LoadBalancing с Linux Network LoadBalancing Route (split access) Route (multihomed) Bonding(shared access) Комбинация </WebTech
  • 6. LoadBalancing с Linux Route (spit access) /etc/iproute2/rt_tables 255 local 12 isp1 254 main 13 isp2 253 default ip route add $LOCAL_NET dev $IF_LOCAL table isp1 ip route add $NET_ISP1 dev $IF_ISP1 table isp1 ip route add 0/0 via $GW_ISP1 table isp1 ip route add $LOCAL_NET dev $IF_LOCAL table isp2 ip route add $NET_ISP2 dev $IF_ISP2 table isp2 ip route add 0/0 via $GW_ISP2 table isp2 </WebTech
  • 7. LoadBalancing с Linux Route (spit access) ip rule add from $IP_ISP1 table isp1 ip rule add from $IP_ISP2 table isp2 iptables -t nat -A POSTROUTING -j SNAT -s $LOCAL_IP –to $IP_ISP1 iptables -t nat -A POSTROUTING -j SNAT -s $LOCAL_IP –to $IP_ISP2 </WebTech
  • 8. LoadBalancing с Linux Route (multihomed) ip route add 0/0 nexthop via $GW_ISP1 weight 1 nexthop via $GW_ISP2 weight 2 ip rule add from fwmask 1 table isp1 ip rule add from fwmask 2 table isp2 iptables -A POSTROUTING -t nat -m mark --mark 1 -j SNAT --to $IP_ISP1 iptables -A POSTROUTING -t nat -m mark --mark 2 -j SNAT --to $IP_ISP2 </WebTech
  • 9. LoadBalancing с Linux Route (multihomed) iptables -t mangle -A POSTROUTING -j MARK --set-mark 1 -m state --state NEW -o $IF_ISP1 iptables -t mangle -A POSTROUTING -j MARK --set-mark 2 -m state --state NEW -o $IF_ISP2 iptables -t mangle -A POSTROUTING -j CONNMARK --save-mark -m state --state NEW iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark </WebTech
  • 10. LoadBalancing с Linux Route (multihomed) patch-o-matic-ng (преди 12.05.2006) модули: random nth </WebTech
  • 11. LoadBalancing с Linux Bonding (share load) Какво е представлява Какво може да прави Настройки Проблеми </WebTech
  • 12. LoadBalancing с Linux Bonding (share load) Нужен софтуер # gcc -Wall -O -I/usr/src/linux/include ifenslave.c -o ifenslave # cp ifenslave /sbin/ifenslave Настройки /etc/modules.conf /etc/modprobe.conf </WebTech
  • 13. LoadBalancing с Linux Bonding (share load) Monitoring arp_interval arp_ip_mon downdelay(ethernet) miimon Пример alias bond0 bonding options bond0 mode=balance-alb miimon=100 primary=eth0 updelay=50 </WebTech
  • 14. LoadBalancing с Linux Bonding (share load) Type of bonding mode 0 или balance-rr mode 1 или active-backup mode 2 или balance-xor mode 3 или broadcast mode 4 или 802.3ad(link agregation) mode 5 или balance-tlb mode 6 или balance-alb </WebTech
  • 15. LoadBalancing с Linux Bonding (share load) Проблемите ограниченията на ethernet arp_interval & arp_ip_target missing interfaces </WebTech
  • 16. LoadBalancing с Linux Комбинации Bonding tunels за Българския трафик Split access за Международният трафик Проблемите </WebTech
  • 17. LoadBalancing с Linux ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Въпроси ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? </WebTech