|
Page 4 of 4
So run your updated router.sh and you should now have a router which routes ftp traffic over INTERNET CONNECTION B and all other traffic over INTERNET CONNECTION A. its difficult to get any visual confirmation that its actually working. To test mine, I simply visited www.whatismyip.com and noted my public ip address. I then changed the above rule so that tcp port 80 traffic was routed over the B connection, and revisted www.whatismyip.com and made sure that they changed. Oh! and one other thing: Dont try run the above test on the router itself. If you goto www.whatismyip.com on there, it will always report the public ip address of the default connection in the MAIN table. It only seems to work from a client pc. If anyone can offer any ideas as to why this might be, Im all ears
And there we have it! Just like we did with the firewall rules, you might want to put all of the commands which set up the secondary routing table, and define the ip rules into a sh script. Again, it makes it easier for debugging as we go along, and if you reboot your router, the secondary routing table (tbr) and the ip rule will be lost.
Conclusion
So theres still a lot to do on this. What Ive detailed here is just one possible application of multiple internet connections. As mentioned in the intro, theres lots of other configs we could use including load balancing over the two connections, automatic fail over (so when one fails the other kicks in) Of course we can expand on what rules we've defined so that can have all port 80 traffic (http) going over the quicker 2mb line, and all email (not so time critical) going out via the 512k line. Or even Email comes in on the 512k line, but gets sent on the 2mb line. Ive read (although never attempted) that you can even create rules based on the user thats logged in, giving rise to situations like "IT Department gets to use fast line, everyone else can slum it on the slow line" Which while cruel, is something I think alot of us would like to do!
Check out Part2 where we deal with incoming connections like a webserver, or a mailserver .
UPDATE: at the end of part 3 there is a small discussion on changing which connection a given traffic type gets router over on the fly (e.g. not having to reload the router script everytime you want to make a change) Its best to read part two to get a full idea of how it all works. But if you really cant wait, part 3 is here.
Â
Â
|
Comments
As i am new to linux and want to setup just what you explained here (w/o load balancig tho), it comes handy!
I was wandering if the 3'rd line from the bottom up is correct (-i $ INTERNETIFA ). Shouldn't it be -i $INTERNETIFB ?
I know i'm new, but since your script helped me, i just wanna help out too :)
Mihai,
Welcome to lunarhotel.co.uk. You are quite right! Ive made the change. Well done for spotting it. And well done for having a go at Linux.
The script in its current state doesnt actually support load balancing however. It was something I was looking at doing, but sadly with world-wide recession in full swing, my IT department has had to make cut backs (Like only one internet connection!
If you have anymore thoughts / ideas for the script, please let me know.
RSS feed for comments to this post.