LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-04-2015, 04:03 AM   #1
atux_null
Member
 
Registered: Mar 2015
Distribution: debian 12, ubuntu 22.04
Posts: 65

Rep: Reputation: Disabled
loadbalance router help


hi. i do have an old small PC with 3 network cards and i got it run debian 7. this PC is my SOHO router.
eth0:192.168.0.79/24 with gateway 192.168.0.1 (DSL router)
eth1:192.168.1.1/24 LAN

at the moment only with the following i get access to the net:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT
iptables -A FORWARD -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT

i have a second DSL connection that i would like to add in eth2 which has the following config:
192.168.2.79/24 with gateway 192.168.2.1 (dsl_router_2)

what config do i have to do so i can have a loadbalance failover. i would appreciate the per session connection, in order not to have problems with sip calls and https sites.

Just now i have found the following http://members.hellug.gr/vyruss/comp...d_balance.html. i have done:
#touch balance.sh
#vi balance.sh and then i pasted the contents of the script, i have change it to my networks
#chmod +x balance.sh


my question is, what do i have to do with that script to make it work, please?

Last edited by atux_null; 08-04-2015 at 04:35 AM.
 
Old 08-04-2015, 09:51 PM   #2
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,900

Rep: Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050
  1. Make sure the network cables are plugged into the right ports.
  2. Be sure the correct values are entered for each variable in the script
  3. Mark it executable and place it somewhere where it will be ran at each boot.

Then as root run it:

Code:
~# sh /path/to/script/balance.sh
** It should just work assuming this tutorial is the actual solution to your problem. **

It might also help to read the documentation to iptables since it seems like you are sort of just running a script you do not fully understand.

Code:
~# man iptables
 
Old 08-05-2015, 01:53 AM   #3
atux_null
Member
 
Registered: Mar 2015
Distribution: debian 12, ubuntu 22.04
Posts: 65

Original Poster
Rep: Reputation: Disabled
how do i run this at the system boot?
 
Old 08-06-2015, 08:56 AM   #4
atux_null
Member
 
Registered: Mar 2015
Distribution: debian 12, ubuntu 22.04
Posts: 65

Original Poster
Rep: Reputation: Disabled
i am trying to do this http://members.hellug.gr/vyruss/comp...d_balance.html to run automatically.

any help available.
 
Old 08-06-2015, 09:11 AM   #5
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,900

Rep: Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050
Quote:
Originally Posted by atux_null View Post
i am trying to do this http://members.hellug.gr/vyruss/comp...d_balance.html to run automatically.

any help available.
You need to create a boot script that runs your script during start up. I forget if Debian 7 uses systemd or sysv-init as the init system. Debian 8 uses systemd. The process is different depending on which init system is in use. I do not have a Debian system currently. Someone else will have to help you.
 
Old 08-06-2015, 10:14 AM   #6
atux_null
Member
 
Registered: Mar 2015
Distribution: debian 12, ubuntu 22.04
Posts: 65

Original Poster
Rep: Reputation: Disabled
it is debian 8 that i have upgraded yesterday.
any ideas?
 
Old 08-06-2015, 10:59 AM   #7
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,900

Rep: Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050
First, you will need to edit your script so that it has "start" and "stop" functionality. Meaning, you should be able to execute this script to turn on your load balancer and to turn off the load balancer.

Second, you will need to do something similar to this discussion to create a service file for systemd that will start and stop your load balancer.

I do not have Debian installed. I do not have systemd installed. I also do not have experience with creating systemd service files. I cannot help you much at this point. Hopefully someone who has the required experience will step in to help you.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Squid proxy server loadbalance shan_nathan Linux - Server 7 12-31-2019 04:40 AM
[SOLVED] webserver loadbalance crackconfig Linux - Server 2 03-06-2014 02:42 AM
Loadbalance nginx proxies with keepalived possible? Fcukinyahoo Linux - Networking 1 07-31-2012 02:32 PM
Loadbalance requests from 1000 hosts to 3 samba servers ortodopodo Linux - Networking 2 12-11-2009 12:20 AM
Adding new Linux firewall/router on network with pre-existing gateway/router grittyminder Linux - Networking 4 08-13-2008 02:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration