Load Balancing Setup Process

Load Balancing Setup Process

লোড ব্যালেসিং এমন একটি পদ্ধতি যা দিয়ে নেটওয়ার্ক এর ট্রাফিক একাধিক গেটওয়ে দিয়ে সেন্ড করা সম্ভব। মানে আপনি ভিন্ন ভিন্ন দুটি ISP কোম্পানির নেট কানেকশন একটি রাউটার দিয়ে চালাতে পারবেন। একটি লাইন যদি অফ থাকেও আপনার নেটওয়ার্ক এর অন্য একটি কনেকশণ অন থাকবে।আপনার যদি একাধিক ISP কোম্পানির নেট কানেকশন থেকে থাকে তবে আপনি লোড ব্যালেসিং করতে পারবেন। আপনি জিজ্ঞেস করতে পারেন একাধিক নেট কানেকশন আমি কেন ব্যাবহার করব?

এর উত্তর হলঃ

১। কোন ISP আপনাকে ১০০% গ্যারান্টি দেবে না যে তাদের নেট কানেকশন কখনও ডিসকানেক্ট হবে না। আর আপনার যদি সবসময়ই নেট এ থাকতে হয় তবে।

২। আপনি হয়ত এমন একটি ISP এর নেট ব্যাবহার করছেন যার স্পীড ভালনা কিন্তু তার EMAIL বা IPPBX সার্ভিস আপনাকে নিতেই হবে । সেক্ষেত্রে আপনাকে দুটি ISP এর নেট কানেকশন লাগবে ।

চলুন দেখি এই লোড ব্যালেসিং কিভাবে করবেন। লোড ব্যালেসিং অনেক ভাবেই করা জায়,কিন্তু আমি আপনাদের PBR মানে পলিসি বেইজড রাউটিং(Policy Based Routing) এই পদ্ধতি টি দেখাব। আমি এখানে যে রাউটার টি ব্যাবহার করেছি তা Mikrotik ব্রান্ডের।

এবার আসুন জেনে নেই Policy Based Routing কি?

Policy Based Routing এমন একটি পদ্ধতি যা কোন নেটওয়ার্ক অ্যাডমিনেট্রেটর দ্বারা নির্ধারিত পলিসির উপর ভিত্তি করে রাউটিং decisions নেয়।সুতরাং আজ আমি মাইক্রটিক রাউটার এর পলিসি দেখাব যা দিয়ে আপনি একটি লোড ব্যালেন্সড নেটওয়ার্ক করতে পারবেন।

উদাহরন সরুপ নিচের এই অফিস নেটওয়ার্ক ডায়াগ্রামের ছবিটি ভাল ভাবে দেখুন যেখানে দুটি ভিন্ন ISP কোম্পানির কানেকশন ব্যাবহার হচ্ছে গেটওয়ে হিসেবে একটি মাইক্রটিক রাউটারে। এই নেটওয়ার্ক ডায়াগ্রামে নেট কানেকশন দুটি ওয়ান পোর্ট এর মাধ্যমে রাউটার এর সাথে কানেক্টেড। এছাড়া কিছু সংখ্যক Host একটি ডিস্ট্রিবিঅশন Switch দ্বারা রাউটারের সাথে কানেক্টেড। মোট Host কে আমরা দু ভাগে ভাগ করে ওয়ান১ ISP এবং ওয়ান২ ISP  দ্বারা নেট এক্সেস এর সুবিধা দেব।

সমস্ত প্রক্রিয়াটি ৫ টি ধাপে সম্পন্ন হবে আর তা হল :

  1. Assigning WAN and LAN IP addresses.
  2. DNS Server Configuration
  3. NAT Configuration
  4. Mangle Rule Creation
  5. Route Configuration

এখান থেকে আমি English এ লিখছি কারন সমস্ত সেট আপ প্রসেস এবং এর ডায়ালগ বক্স English এতকরে আপনাদের বিভ্রান্ত হতে হবে না

Step 1. Assigning WAN and LAN IP Addresses

For configuring a perfect load balancing network with policy based routing, first you have to assign WAN and LAN IP addresses in your MikroTik Router. As you have two ISP connections, you must have two WAN IP addresses as well as two gateway addresses. For the configuration of this article, I am using below two WAN IP addresses and two gateway addresses for different ISP connections.

  1. WAN1 IP Address:15.221/24 and Gateway:172.22.15.1
  2. WAN2 IP Address:168.210/24 and Gateway:192.168.168.254

I am using these WAN IP addresses and Gateway addresses for the configuration of this article but in practical your WAN IP addresses and Gateway addresses must be different and these will be provided by your ISP Company. However, you also have a LAN network with a large number of hosts. For the configuration of this article, I am assuming the LAN IP block and gateway address will be like below.

  1. IP Block:10.0/24
  2. Gateway:10.254

We have got our WAN IP addresses and LAN IP block. Now I will show you how to assign these WAN IP addresses and LAN gateway address in your MikroTik router. Follow my bellow steps to assign WAN and LAN IP addresses in your MikroTik router.

  1. Login to your MikroTik router with Winbox software. If you don’t have Winbox software in your collection, download Winboxfrom Website and then login to your MikroTik with username and password.
  2. Go to IP > Addressesmenu item from the winbox menu bar. Address List window will appear.
  3. Now click on add new button(PLUS Sign). New Address window will appear. Put your WAN1 IP address (in this article: 172.22.15.221/24) in Address input box and choose WAN1 interface (in this article: ether1) from Interface drop-down menu and then click Apply and OK 
  4. Similarly, click on add new buttonagain and put your WAN2 IP address (in this article: 192.168.168.210/24) in Address input field and choose WAN2 interface (in this article: ether2) from Interface drop-down menu and then click Apply and OK button.
  5. Again, click on add new buttonand put your LAN gateway IP (in this article: 192.168.10.254/24) in Addressinput field and choose your LAN interface (in this article: ether10) from Interface drop-down menu and then click Apply and OK button.

Assigning WAN and LAN IP addresses has been completed. Now we will configure DNS server in our next step.

Step 2. DNS Server Configuration

DNS is not a mandatory configuration in MikroTik router but it is necessary for a complete MikroTik router configuration. Optionally, you can turn your MikroTik router into a DNS server which will be beneficial for your network. So, if you want to set DNS IP in your MikroTik router as well as want to turn your MikroTik into a DNS server, follow my below simple steps.

  1. Go to IP > DNS menu option.DNS Settings window will appear. Put your DNS server IP that is provided to you by your ISP or you can use Google public DNS server IP 8.8.8 in Servers input field.
  2. Optionally, you can click on Allow Remote Requestscheckbox to turn your MikroTik router into a DNS server. But you have to block DNS requests from outside of your LAN otherwise your MikroTik will be used as a DNS server by the public users if they know your MikroTik public IP. Follow my article about MikroTik router basic configuration which will show you how to block DNS requests from public network.
  3. Now click Applyand OK button.

Our DNS configuration in MikroTik router has been completed. Now we will create masquerade NAT rule so that our LAN user can access internet through our MikroTik router.

Step 3. NAT Configuration

Now we will create a masquerade NAT rule so that our LAN IP can be NATed by MikroTik router. If we don’t create this rule, our LAN users cannot access internet through our MikroTik router. So, follow my bellow steps to create NAT rule in MikroTik router.

  1. Go to IP > FirewallFirewall window will appear. Click on NAT tab in this window and then click on add new button (PLUS Sign). New NAT Rule window will appear.
  2. Under Generaltab, choose srcnat from Chain drop-down menu and put your LAN IP block address (in this article: 192.168.10.0/24) in Address input field. Now click on Action tab and choose masquerade from Actiondrop-down menu and then click Apply and OK

NAT rule configuration in MikroTik router has been completed. Now we will create Mangle rules in our MikroTik router so that our LAN user can be divided into two groups.

Step 4. Mangle Rule Creation

As we want to send our LAN users through two ISP connections for load balancing, we have to create Mangle rules which will divide our LAN users into two groups and mark them for proper routing. In this article, I am using a class C IP block which is 192.168.10.0/24 for our LAN users. This IP block can be divided into two groups by subnetting like below.

  1. Group A:10.0/25
  2. Group B:10.128/25

By doing this subnetting, our total users are now divided into two groups. The users who will use IP address between 192.168.10.1 to 192.168.10.126 will have in group A and those who will use IP address between 192.168.10.129 to 192.168.10.253 will have in group B. Now, I will show you two Mangle rules in MikroTik router those will do proper grouping and marking our LAN IP. Follow below steps to create these Mangle rules.

  1. Go to IP > Firewallmenu and click on Mangle tab in Firewall window and then click on add new button (PLUS Sign). New Mangle Rule window will appear now.
  2. Choose preroutingoption from Chain drop-down menu and put Group A IP block (in this article: 192.168.10.0/25) inAddress input field. Click on Action tab and choose mark routing option from Action drop-down menu and put group name (here, GroupA) in New Routing Mark input box and uncheck the Passthrough option and then click Apply and OK
  3. Similarly, click on add new buttonagain and choose prerouting option from Chain drop-down menu and put Group B IP block (here, 192.168.10.128/25) in Address input field. Now click on Action tab and choose mark routing option from Action drop-down menu and put group name (here, GroupB) in New Routing Mark input field and uncheck the Passthrough option and then click Apply and OK 

We have successfully created Mangle rules for grouping our LAN users. Now we will configure routes in MikroTik router so that different groups can access internet through different ISP connection.

Step 5.  Route Configuration

After creating Mangle rules, now you have to configure routing so that your different user group can use different WAN connection for accessing internet. So, follow my bellow steps to configure your MikroTik routing properly.

  1. Go to IP > Routesmenu option. Route List window will appear now. Click on add new button (PLUS Sign) from this window. New Route window will appear.
  2. Put ISP1 gateway address (here, 172.22.15.1) in Gatewayinput field and choose your routing mark (here, GroupA) for this gateway from Routing Mark drop-down menu and then click Apply and OK button.
  3. Similarly, click on add new button(+) and put ISP2 gateway address (here, 192.168.168.254) in Gateway input field and choose your routing mark (here, GroupB) for this gateway from Routing Mark drop-down menu and then click Apply and OK button.
  4. Again, click on add new button(+) and put any ISP gateway (here, 172.22.15.1) and Apply and OK If you don’t apply this route, your MikroTik cannot access internet.

After this configuration, your GroupA users will access internet through ISP1 gateway and GroupB users will access internet through ISP2 gateway. So, you will get a perfect load balancing network with this configuration

Load Balancing Setup Process

Leave a Reply

Your email address will not be published. Required fields are marked *