Routing local + international traffic through separate adsl accounts
Introduction
- WIKI PAGE UNDER CONSTRUCTION**********************
This tutorial will show you how to use a cheap local-only adsl account for local traffic and a normal adsl account for international traffic. This will work for your mikrotik web proxy aswell
This worked for me in ROS 3.10 but should work for all ROS 3.x
Create the two 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 on",
"dial on demand" is off and "use peer DNS is off"
6) click apply
7) Add another pppoe client but use your local-only adsl account
Steps for Local-only ADSL Account
Do steps 1-7 above but make sure that "add default route is OFF"
Notes: Both pppoe client connections can share the same interface
Create the routes
There should already be a default route which sends all internet traffic over the international adsl account.
Destination Gateway-interface S 0.0.0.0/24 pppoe-out1
Local traffic also gets routed over the same account which we do not want so we need to create individual routes for this.
Firstly you need to get a list of your countries specific IP ranges. 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. /ip route add dst-address=bbb.bbb.bbb.bbb/bb gateway=yyy.yyy.yyy.yyy. /ip route add dst-address=ccc.ccc.ccc.ccc/cc gateway=yyy.yyy.yyy.yyy.
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.
Example
/ip route add dst-address=17.255.248.0/23 gateway=165.146.180.1 /ip route add dst-address=32.106.152.0/24 gateway=165.146.180.1 /ip route add dst-address=32.106.153.0/24 gateway=165.146.180.1 /ip route add dst-address=32.107.9.0/24 gateway=165.146.180.1 /ip route add dst-address=32.238.152.0/24 gateway=165.146.180.1 /ip route add dst-address=32.238.153.0/24 gateway=165.146.180.1 /ip route add dst-address=32.239.182.0/24 gateway=165.146.180.1 /ip route add dst-address=41.0.0.0/16 gateway=165.146.180.1 /ip route add dst-address=41.0.16.0/21 gateway=165.146.180.1 /ip route add dst-address=41.0.72.0/21 gateway=165.146.180.1 /ip route add dst-address=41.0.208.0/22 gateway=165.146.180.1 /ip route add dst-address=41.0.248.0/24 gateway=165.146.180.1 /ip route add dst-address=41.1.0.0/18 gateway=165.146.180.1 /ip route add dst-address=41.1.64.0/18 gateway=165.146.180.1 ... ... ...
We have +-1300 routes for South africa so I obviously didnt put them in the wiki but you get the idea
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
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=17.255.248.0/23 gateway=165.146.180.1
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 17.255.248.0/23 165.146.180.1 pppoe-out2 1 AS 32.106.152.0/24 165.146.180.1 pppoe-out2 1 AS 32.106.153.0/24 165.146.180.1 pppoe-out2 1 AS 32.107.9.0/24 165.146.180.1 pppoe-out2 1 AS 32.238.152.0/24 165.146.180.1 pppoe-out2 1 AS 32.238.153.0/24 165.146.180.1 pppoe-out2 1 AS 32.239.182.0/24 165.146.180.1 pppoe-out2 1 AS 41.0.0.0/16 165.146.180.1 pppoe-out2 1 AS 41.0.16.0/21 165.146.180.1 pppoe-out2 1 AS 41.0.72.0/21 165.146.180.1 pppoe-out2 1 AS 41.0.208.0/22 165.146.180.1 pppoe-out2 1 AS 41.0.248.0/24 165.146.180.1 pppoe-out2 1 AS 41.1.0.0/18 165.146.180.1 pppoe-out2 1 AS 41.1.64.0/18 165.146.180.1 pppoe-out2 1 AS 41.1.128.0/18 165.146.180.1 pppoe-out2 1 AS 41.1.192.0/18 165.146.180.1 pppoe-out2 1 AS 41.1.254.0/24 165.146.180.1 pppoe-out2 1 AS 41.2.0.0/16 165.146.180.1 pppoe-out2 1 AS 41.3.0.0/16 165.146.180.1 pppoe-out2 1 AS 41.4.0.0/16 165.146.180.1 pppoe-out2 1 AS 41.5.0.0/16 165.146.180.1 pppoe-out2 1 AS 41.6.0.0/16 165.146.180.1 pppoe-out2 1 AS 41.7.0.0/16 165.146.180.1 pppoe-out2 1 AS 41.8.0.0/16 165.146.180.1 pppoe-out2 1