Community discussions

MikroTik App
 
ElMajor76
just joined
Topic Author
Posts: 2
Joined: Tue Jan 10, 2023 7:42 pm

Route an IP of my LAN to WAN2

Tue Jan 10, 2023 7:51 pm

Hi everyone !

I'm a newbie to Mikrotik and I have a hAP ac² as my main router. My router runs RouterOS 7.

I have connected 2 WAN -> 1 from a fiber line and 1 from an LTE line and the failover works well. I don't need load balancing.

But I have a question. I need to route a specific IP to the WAN 2 but I'm a little bit confused with some explanations.

Can anyone helps me with the configuration to route the IP to the WAN 2 (LTE line) ?

Thanks for your help !

PS : I'm apologize for my poor English, I'm French ;)
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19321
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Route an IP of my LAN to WAN2  [SOLVED]

Wed Jan 11, 2023 5:38 pm

Bonjour .......
Puis je vous aider.........
Mais oui,
Parfait.

Alors.

The easiest way to 'force' users out a specific WAN is to use a table, route, route rule. The complex way is via mangling.
a. if you need to force entire subnets, the easy way works well.
b. if you need to force a small number of users, the easy way works well
c. if you need to force large numbers of users, either from one subnet but not the entire subnet or many users across different subnets, then mangling is required.

I will assume b, fits your requirements......

create table.
/routing table add fib name=useWAN2

add route
add dst address=0.0.0.0/0 gwy=ISP2 gateway routing-table=useWAN2

add routing rule
/routing rule add src-address=IP_user1 action=lookup table=useWAN2
/routing rule add src-address=IP_user2 action=lookup table=useWAN2
/routing rule add src-address=IP_userX action=lookup table=useWAN2

Note1: If you want the users NEVER to be able to fall back to WAN1 if WAN2 is not available then change action.
action=lookup-only-in-table

Note2: If your LAN has multiple subnets and those specific users need to reach the other subnet then you will have to add additional routing rules to ensure this traffic doesnt get force out WAN2.
ex. lets say user2, on subnetA needs to reach a server on subnetB. Order counts so ensure the new rule exists before the force out WAN rule!!!

Two examples of solutions.......general applies to all users that may fall under force route........
/routing rules
add dst-address=IPofServerB action=lookup-only-in-table table=main { anyone heading to that IP will use table main }
add src-address=IP_user1 action=lookup table=useWAN2
add src-address=IP_user2 action=lookup table=useWAN2
add src-address=IP_userX action=lookup table=useWAN2

If you wanted to pinpoint user 2
/routing rules
add dst-address=IPofServerB src-address=IP_user2 action=lookup-only-in-table table=main { only user2 is being freed from being forced out WAN2 and allowed to access ServerB }
add src-address=IP_user1 action=lookup table=useWAN2

add src-address=IP_user2 action=lookup table=useWAN2
add src-address=IP_userX action=lookup table=useWAN2
 
ElMajor76
just joined
Topic Author
Posts: 2
Joined: Tue Jan 10, 2023 7:42 pm

Re: Route an IP of my LAN to WAN2

Wed Jan 11, 2023 7:12 pm

Bonjour Anav ! :D

Merci de ton aide ! Ça fonctionne super bien, et j'ai enfin ce que je voulais !

Thanks a lot for your help ! It works as I wish !

Your reply is so cleary, I bookmarked it if I need it again.

Have a nice day ;)

Who is online

Users browsing this forum: Amazon [Bot], intania, jhbarrantes, MarkusT, pedroush and 35 guests