You are on page 1of 2

______ _____ __

__________ ______

__

__

/ __/ |/ / //_____/ _/_ __/ /_ ____ _____ ___ ____ __ / ___ _/ /_____ _
______ ___ _ ___ __ _________ ___ _
_\ \/ /|_/ / ,< /____/ / / /
/ / / // / _ / _ `(_-< / // / _ `/ '_/ _ `(
_-/ _ `/ ' \/ _ / // / __/ _ / _ `/
/___/_/ /_/_/|_| /___/ /_/
/_/ \_,_/_//_\_,_/___/ \___/\_,_/_/\_\\_,_/_
__\_,_/_/_/_/ .__\_,_/_/ /_//_\_,_/ [Bekasi 20/08/2012]
/_/
Routing for multiple uplink/providers (Load balancing)
Agus Bimantoro <hxs_@msn.com>
Table of contains:
1.
2.
3.
4.
5.
6.

What is Load Balancing ?


Schema of Network
Network Configurations
Routing Configurations
Firewall NAT
EoF

[1] Whats is Load Balancing ?


----------------------------Dalam bahasa yang sederhana load balancing merupakan sebuah teknik di dalam jari
ngan komputer untuk mendistribusikan/berbagi beban kerja.
tujuannya agar penggunaan sumber daya menjadi lebih optimal.
Misalnya: Load Balancing untuk multiple koneksi, Server Balancing, etc.
[2] Schema of Network
--------------------+--------------[ flash ]-----|
\
|
\
+---- usb0 ------+
\
--------------\ |
|
local network -- eth0
ROUTER |
{ INTERNET }
--------------/ |
|
+---- usb1 ------+
/
|
/
|
/
+--------------[ tri ]--------

[3] Network Configurations


-------------------------usb0:
ip = 10.10.7.2
netmask = 255.255.255.0
network = 10.10.7.0/24
gateway = 10.10.7.1

usb1:
ip = 192.168.1.2
netmask = 255.255.255.0
network = 192.168.1.0/24
gateway = 192.168.1.1
eth0:
ip = 192.168.56.1
netmask = 255.255.255.0
network = 192.168.56.0/24
[4] Routing Configurations
-------------------------# buat jalur
echo "10 flash" >> /etc/iproute2/rt_tables
echo "20 tri" >> /etc/iproute2/rt_tables
# buat routing table
ip route add 10.10.7.0/24 dev usb0 src 10.10.7.2 table flash
ip route add default via 10.10.7.1 table flash
ip route add 192.168.1.0/24 dev usb1 src 192.168.1.2 table tri
ip route add default via 192.168.1.1 table tri
# buat main routing
ip route add 10.10.7.0/24 dev usb0 src 10.10.7.2
ip route add 192.168.1.0/24 dev usb1 src 192.168.1.2
# setup routing rules
ip rule add from 10.10.7.2 table flash
ip rule add from 192.168.1.2 table tri
# balance network trafic
ip route add default scope global nexthop via 10.10.7.1 dev usb0 weight 1 nextho
p via 192.168.1.1 dev usb1 weight 1
[5] Firewall NAT
---------------echo 1 >
iptables
iptables
iptables
iptables
iptables

/proc/sys/net/ipv4/ip_forward
-A FORWARD DROP
-A FORWARD -s 192.168.56.0/24
-A FORWARD -d 192.168.56.0/24
-t nat -A POSTROUTING -o usb0
-t nat -A POSTROUTING -o usb1

-j
-j
-j
-j

ACCEPT
ACCEPT
SNAT --to 10.10.7.2
SNAT --to 192.168.1.2

[6] EoF
------Any question ?, please send to my email at <hxs_@msn.com>

You might also like