Community discussions

MikroTik App
 
hettonkgb
just joined
Topic Author
Posts: 4
Joined: Fri Jun 04, 2021 3:29 am

Assigning a specific ip to use another WAN

Fri Aug 12, 2022 5:25 pm

Hello!

I've started to dig in to my Router RB1100AHx2 wich has been used to try to gain some knowledge in networking wich is very intreressting!

My goal right now is to be able to assign a specific internal ip adress to another WAN adress.

For explanation, I have 2 cords running from my mikrotik router to my fiberswitch, I've made 2 WAN interfaces (WAN1 & WAN2)
My internal ip adress pool (192.168.88.1-254) is connecting to internet trough WAN1, Is it possible to make for example ip adress 192.168.88.50 connect to internet trough WAN2 interface? And how can i achieve this? I've serched but due to my lack of knowledge i haven't been able to figure it out.

If anyone would like to explain this to me i would greatly apreciate it!
Thanks in advance!
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 23614
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Assigning a specific ip to use another WAN  [SOLVED]

Fri Aug 12, 2022 8:39 pm

Sure,
default route or manual entered routes are required for both wans and they should already be on the router.
add dst-address=0.0.0.0/0 gateway=ISP1 table=main distance=5 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=ISP2 table=main distance=10

That is likely what you have in one form or the other and this ensures ALL traffic will go to WAN1.
If WAN1 is not available traffic gets sent to to WAN2 and the router keeps checking if WAN1 is up yet and will switch traffic back when it does.
What dictates this behaviour is setting the distances.

1. Now..........
Create a new table for the router to look at for available routes.
/routing table add name=useWAN2 fib

2. Next...........
Create another instance of the route for ISP2, but the third route is modified as such
add dst-address=0.0.0.0/0 gateway=ISP2 table=useWAN2 distance=10

3. Finally, to 'force' the user out WAN2, create a routing rule............
/routing rule add src-address=192.168.88.50/32 action=lookup-only-in-table table=useWAN2
 
hettonkgb
just joined
Topic Author
Posts: 4
Joined: Fri Jun 04, 2021 3:29 am

Re: Assigning a specific ip to use another WAN

Fri Aug 12, 2022 11:01 pm

Sure,
default route or manual entered routes are required for both wans and they should already be on the router.
add dst-address=0.0.0.0/0 gateway=ISP1 table=main distance=5 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=ISP2 table=main distance=10

That is likely what you have in one form or the other and this ensures ALL traffic will go to WAN1.
If WAN1 is not available traffic gets sent to to WAN2 and the router keeps checking if WAN1 is up yet and will switch traffic back when it does.
What dictates this behaviour is setting the distances.

1. Now..........
Create a new table for the router to look at for available routes.
/routing table add name=useWAN2 fib

2. Next...........
Create another instance of the route for ISP2, but the third route is modified as such
add dst-address=0.0.0.0/0 gateway=ISP2 table=useWAN2 distance=10

3. Finally, to 'force' the user out WAN2, create a routing rule............
/routing rule add src-address=192.168.88.50/32 action=lookup-only-in-table table=useWAN2
Thank you for this, Learning more each day!
Have a great weekend!
 
rdwnrymn
just joined
Posts: 3
Joined: Sat Jan 13, 2024 3:12 pm

Re: Assigning a specific ip to use another WAN

Wed Jan 22, 2025 12:28 pm

Sure,
default route or manual entered routes are required for both wans and they should already be on the router.
add dst-address=0.0.0.0/0 gateway=ISP1 table=main distance=5 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=ISP2 table=main distance=10

That is likely what you have in one form or the other and this ensures ALL traffic will go to WAN1.
If WAN1 is not available traffic gets sent to to WAN2 and the router keeps checking if WAN1 is up yet and will switch traffic back when it does.
What dictates this behaviour is setting the distances.

1. Now..........
Create a new table for the router to look at for available routes.
/routing table add name=useWAN2 fib

2. Next...........
Create another instance of the route for ISP2, but the third route is modified as such
add dst-address=0.0.0.0/0 gateway=ISP2 table=useWAN2 distance=10

3. Finally, to 'force' the user out WAN2, create a routing rule............
/routing rule add src-address=192.168.88.50/32 action=lookup-only-in-table table=useWAN2
with this config is it posible that the router reachable from the internet? e.g for remote winbox
 
eguun
Frequent Visitor
Frequent Visitor
Posts: 95
Joined: Fri Apr 10, 2020 10:18 pm

Re: Assigning a specific ip to use another WAN

Wed Feb 26, 2025 9:05 am

Sure,
default route or manual entered routes are required for both wans and they should already be on the router.
add dst-address=0.0.0.0/0 gateway=ISP1 table=main distance=5 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=ISP2 table=main distance=10

That is likely what you have in one form or the other and this ensures ALL traffic will go to WAN1.
If WAN1 is not available traffic gets sent to to WAN2 and the router keeps checking if WAN1 is up yet and will switch traffic back when it does.
What dictates this behaviour is setting the distances.

1. Now..........
Create a new table for the router to look at for available routes.
/routing table add name=useWAN2 fib

2. Next...........
Create another instance of the route for ISP2, but the third route is modified as such
add dst-address=0.0.0.0/0 gateway=ISP2 table=useWAN2 distance=10

3. Finally, to 'force' the user out WAN2, create a routing rule............
/routing rule add src-address=192.168.88.50/32 action=lookup-only-in-table table=useWAN2
Deep thanks Anav,

was struggling to get some traffic from my WAN2 (ie dynDNS) and the src-address from fetch wasn't sufficient.
Your actionable code made it seamlessly possible

thanks!
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 23614
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Assigning a specific ip to use another WAN

Wed Feb 26, 2025 8:19 pm

There is no such concept as remote winbox. One NEVER wants to open the winbox port to the internet.
Instead you VPN into the router and then access winbox.

Two ways.,
Public IP at your router, or to the ISP router (and it can forward ports)
OR
Use BTH feature on MT depending upon the model you have.

AGAIN< DO NOT ACCESS WINBOX OVER THE INTERNET>
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 23614
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Assigning a specific ip to use another WAN

Wed Feb 26, 2025 8:28 pm

Okay, the other question you have to ask yourself is do you want the users going to WAN2, to use WAN1 if WAN2 is not available ( problem at ISP for example).

Option1: Users in WAN1, use failover WAN2, if WAN1 does not become available and similarly user(s) in WAN2 use WAN1 if WAN2 is not available.

/routing table
add fib name=useWAN2
/routing rule
add src-address=192.168.88.50/32 action=lookup table=useWAN2

/ip route
add dst-address=0.0.0.0/0 gateway=ISP1 table=main distance=5 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=ISP2 table=main distance=10 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=ISP2 table=useWAN2

Note1: Check gateway=ping ensure the router moved back to ISP1 when its back on line and also ensures users slated for WAN2, go back to WAN2 when it comes back on line.
Note2: the action:lookup means that the router will go to the main table and look for an active route.
+++++++++++++++++++

Option2: Users in WAN1, use failover WAN2, if WAN1 does not become available BUT user(s) in WAN2 get no internet if WAN2 goes down ( no access to wan1 )

/routing table
add fib name=useWAN2
/routing rule
add src-address=192.168.88.50/32 action=lookup-only-in-table table=useWAN2

/ip route
add dst-address=0.0.0.0/0 gateway=ISP1 table=main distance=5 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=ISP2 table=main distance=10 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=ISP2 table=useWAN2