Routing local + international traffic through separate adsl accounts
- WIKI PAGE UNDER CONSTRUCTION**********************
In South Africa broadbrand prices are extremely expensive and the average ADSL cap is a small 3 gig while the majority of the country is still on 56 dialup!!!! So most of us make use of "local-only" ADSL accounts. These accounts grant access to content hosted in South Africa only and they are much more affordable ( 6 times cheaper than normal ADSL accounts)
Most ISP's employ some for of shaping to give http traffic priority over p2p and email. This can make playing online games and voip chat very frustrating because of lag and high latencies. As a result our ISP's in South Africa offer a special kind of ADSL account where they do not shape any protocols, we call this an unshaped account. These accounts are quite expensive so they need to be reserved for gaming and Voip protocols.
However it is a hassle for users to connect/disconnect between the three accounts just to save a little cap. So I have written a tutorial which will automatically split the traffic between the local-only, unshaped and normal (international) ADSL accounts
This worked for me in ROS 3.10 but should work for all ROS 3.x
Create the Local + international + unshaped pppoe connections
Steps for International ADSL Account 1) click on "Interfaces: 2) click on the red cross to add a new interface. 3) select pppoe client. 4) under General, select the interface which is connected to your modem. 5) under dial out, add your normal adsl account's username and password. Make sure that "add default route is off", "dial on demand" is off and "use peer DNS is ON" 6) click apply Steps for Local-only ADSL Account Do steps 1-6 above but make sure that you use your local only adsl username and password Steps for unshaped ADSL Account Do steps 1-6 above but make sure that you use your unshaped adsl username and password
Notes: All three pppoe client connections can share the same interface Alternatively you can use you open dns if you have mulitple ISP's because sometimes they can conflict. If you do use OpenDNS, make sure that use peer dns is '''OFF''' Your modem needs to be in bridge mode so that the mikrotik router can establish the pppoe connections
Creating the international route
Paste this command in the terminal window:
add comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out1
Local + gaming/Voip traffic also gets routed over this international account, which we do not want, so we need to create individual routes for local and unshaped protocols
Creating the local routes
Firstly you need to get a list of your country's specific IP ranges (local). I am from south Africa so I use this one http://alm.za.net/ip/localroutes4.txt....You should use your country specific ip addresses
Copy the list into microsoft excel and edit the cells so that they read:
/ip route add dst-address=aaa.aaa.aaa.aaa/aa gateway=yyy.yyy.yyy.yyy distance=2 /ip route add dst-address=bbb.bbb.bbb.bbb/bb gateway=yyy.yyy.yyy.yyy distance=2 /ip route add dst-address=ccc.ccc.ccc.ccc/cc gateway=yyy.yyy.yyy.yyy distance=2
Replace aaa.aaa.aaa.aaa/aa with the local ip ranges. Replace yyy.yyy.yyy.yyy with the gateway ip from the local adsl account.
To get the ip of your ISP specific gateway:
1) Click on "IP" > "Addresses" 2) It is the Network ip address for the pppoe-out2 (local) interface
/ip route add dst-address=18.104.22.168/23 gateway=22.214.171.124 distance=2 /ip route add dst-address=126.96.36.199/24 gateway=188.8.131.52 distance=2 /ip route add dst-address=184.108.40.206/24 gateway=220.127.116.11 distance=2 /ip route add dst-address=18.104.22.168/24 gateway=22.214.171.124 distance=2 /ip route add dst-address=126.96.36.199/24 gateway=188.8.131.52 distance=2 /ip route add dst-address=184.108.40.206/24 gateway=220.127.116.11 distance=2 /ip route add dst-address=18.104.22.168/24 gateway=22.214.171.124 distance=2 /ip route add dst-address=126.96.36.199/16 gateway=188.8.131.52 distance=2 /ip route add dst-address=184.108.40.206/21 gateway=220.127.116.11 distance=2 /ip route add dst-address=18.104.22.168/21 gateway=22.214.171.124 distance=2 /ip route add dst-address=126.96.36.199/22 gateway=188.8.131.52 distance=2 /ip route add dst-address=184.108.40.206/24 gateway=220.127.116.11 distance=2 /ip route add dst-address=18.104.22.168/18 gateway=22.214.171.124 distance=2 /ip route add dst-address=126.96.36.199/18 gateway=188.8.131.52 distance=2 ... ... ... '''NB MAKE SURE THAT THE DISTANCE IS 2!!!'''
We have +-1300 routes for South africa so I obviously didnt put them in the wiki but you get the idea
Once the local list in excel is complete, we can copy/paste them into the terminal First check the syntax by copying the 1st route and pasting it into a new terminal window
/ip route add dst-address=184.108.40.206/23 gateway=220.127.116.11
If that works then copy/paste about 150 at a time into the terminal window...
Your routes should then look something like this
destination gateway gateway interface interface distance routing mark Pref.Source S 0.0.0.0/24 pppoe-out1 1 AS 18.104.22.168/23 22.214.171.124 pppoe-out2 2 AS 126.96.36.199/24 188.8.131.52 pppoe-out2 2 AS 184.108.40.206/24 220.127.116.11 pppoe-out2 2 AS 18.104.22.168/24 22.214.171.124 pppoe-out2 2 AS 126.96.36.199/24 188.8.131.52 pppoe-out2 2 AS 184.108.40.206/24 220.127.116.11 pppoe-out2 2 AS 18.104.22.168/24 22.214.171.124 pppoe-out2 2 AS 126.96.36.199/16 188.8.131.52 pppoe-out2 2 AS 184.108.40.206/21 220.127.116.11 pppoe-out2 2 AS 18.104.22.168/21 22.214.171.124 pppoe-out2 2 AS 126.96.36.199/22 188.8.131.52 pppoe-out2 2 AS 184.108.40.206/24 220.127.116.11 pppoe-out2 2 AS 18.104.22.168/18 22.214.171.124 pppoe-out2 2 AS 126.96.36.199/18 188.8.131.52 pppoe-out2 2 AS 184.108.40.206/18 220.127.116.11 pppoe-out2 2 AS 18.104.22.168/18 22.214.171.124 pppoe-out2 2 AS 126.96.36.199/24 188.8.131.52 pppoe-out2 2 AS 184.108.40.206/16 220.127.116.11 pppoe-out2 2 AS 18.104.22.168/16 22.214.171.124 pppoe-out2 2 AS 126.96.36.199/16 188.8.131.52 pppoe-out2 2 AS 184.108.40.206/16 220.127.116.11 pppoe-out2 2 AS 18.104.22.168/16 22.214.171.124 pppoe-out2 2 AS 126.96.36.199/16 188.8.131.52 pppoe-out2 2 AS 184.108.40.206/16 220.127.116.11 pppoe-out2 2
Local traffic should now be routed over the pppoe-out2 interface.