
Recently at a local cable.network setup @ gulzar-e-hijri, an OP asked told me that he wanted to add an extra DSL line just for some specific users (VIP users who are paying some extra money for better speed, as the current single dsl is getting clogged by over subscribed users. He wanted to manage all users / link via single Mikrotik router-board.
I accomplished this task by adding 2nd DSL line with the Mikrotik BOX and few rules, and Alhamdolillah it worked fine :). I am just sharing basic logic on how i achieved it.
I accomplished this task by adding 2nd DSL line with the Mikrotik BOX and few rules, and Alhamdolillah it worked fine :). I am just sharing basic logic on how i achieved it.
You can take this idea and modify it according to your requirement, either use this logic and mix it with hotspot or pppoe base setup. In this example, user MAC-IP was binded.
Let us assume that we have 2 Users lists.
DSL1_USERS_LIST = 192.168.2.6
DSL2_USERS_LIST = 192.168.2.7
DSL1 Router GW IP = 192.168.5.2
DSL2 Router GW IP = 192.168.6.2
Now we will route users through DSL-1 OR DSL-2 wan links based on there ip addresses.
To accomplish this task, the simple logic is …
- STEP#1: First we will create ADDRESS-LIST, and add our users in the list,
- STEP#2: Then We have to add two IP Firewall Mangle rules to mark the packets originated from user 1 and user2.
- STEP#3: Then we should specify two default routes (destination 0.0.0.0/0) with appropriate routing marks and gateways.
- STEP#4: Then simple add one NAT rule for local ip series and Action masquerade.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| # Adding IP Address on interfaces like lan/wan# IP for LAN User Network Connectivity/ip addressadd address=192.168.2.1/24 disabled=no interface=LAN network=192.168.2.0# IP for WAN DSL Connectivityadd address=192.168.5.1/24 disabled=no interface=WAN1 network=192.168.5.0add address=192.168.6.1/24 disabled=no interface=WAN2 network=192.168.6.0# Create 2 Address lists and add ip as per required, you can add Range as well.# I am adding just 2 ips only/ip firewall address-listadd address=192.168.2.6 disabled=no list=DSL1_USERS_LISTadd address=192.168.2.7 disabled=no list=DSL2_USERS_LIST# Marking Users connection coming from specific address lists/ip firewall mangleadd action=mark-routing chain=prerouting disabled=no new-routing-mark=wan1_user passthrough=no src-address-list=DSL1_USERS_LISTadd action=mark-routing chain=prerouting disabled=no new-routing-mark=wan2_user passthrough=no src-address-list=DSL2_USERS_LIST# Create Routes for above marked packets so each marked packets goes via specific wan link only/ip routeadd disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.5.2 routing-mark=wan1_user scope=30 target-scope=10add disabled=no distance=2 dst-address=0.0.0.0/0 gateway=192.168.6.2 routing-mark=wan2_user scope=30 target-scope=10# Finally create NAT rule so that users (ip range) internet can work/ip firewall natadd action=masquerade chain=srcnat disabled=no src-address=192.168.2.0/24
|
No comments:
Post a Comment