Community discussions

MikroTik App
 
eon445
just joined
Topic Author
Posts: 2
Joined: Thu May 19, 2022 6:17 pm

need help with load balancing with specific ip address accssible through only one provider

Thu May 19, 2022 6:45 pm

i have a mikrotik router with first two Ethernet port is used as WAN (both using pppoe) with load balancing option. the third port acts as lan port.
i am very new to mikrotik and networking stuff, i followed a tutorial on youtube for the initial setup it works great.

now the issue that i have is that the ip address 172.127.100.100 is only accessible via pppoe_provider_1

sometimes connecting to 172.127.100.100 gives a network timeout which is probably due to packet being routed through pppoe_provider_2 ?

so i need some help in configuring the router so that when any user on LAN port tries to access 172.127.100.100, connection will always go through pppoe_provider_1

here is the current configuration
/interface ethernet
set [ find default-name=ether1 ] name=ether1-WAN1
set [ find default-name=ether2 ] mac-address=B0:A7:B9:C8:31:A9 name=    ether2-WAN2
set [ find default-name=ether3 ] name=ether3-LAN
/interface pppoe-client
add disabled=no interface=ether1-WAN1 name=pppoe_provider_1 password=123456 user=siple@home
add disabled=no interface=ether2-WAN2 name=pppoe_provider_2 password=123456 user=arba1@fse.com
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip kid-control
add name=kid1
/ip pool
add name=dhcp_pool0 ranges=192.168.5.2-192.168.5.254
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=ether3-LAN name=dhcp1
/ip address
add address=192.168.5.1/24 interface=ether3-LAN network=192.168.5.0
/ip dhcp-client
add comment=defconf disabled=no interface=ether3-LAN

/ip dhcp-server network
add address=192.168.5.0/24 dns-server=8.8.8.8 gateway=192.168.5.1
/ip dns
set servers=8.8.8.8
/ip firewall filter
add action=log chain=forward connection-state=new dst-port=80,443 log-prefix=    WebRequests protocol=tcp src-port=""
/ip firewall mangle
add action=accept chain=prerouting in-interface=pppoe_provider_1
add action=accept chain=prerouting in-interface=pppoe_provider_2
add action=mark-connection chain=prerouting dst-address-type=!local new-connection-mark=wan1_conn passthrough=yes per-connection-classifier=    both-addresses-and-ports:2/0 src-address=192.168.5.0/24
add action=mark-connection chain=prerouting dst-address-type=!local new-connection-mark=wan2_conn passthrough=yes per-connection-classifier=    both-addresses-and-ports:2/1 src-address=192.168.5.0/24
add action=mark-routing chain=prerouting connection-mark=wan1_conn new-routing-mark=to_wan1 passthrough=yes src-address=192.168.5.0/24
add action=mark-routing chain=prerouting connection-mark=wan2_conn new-routing-mark=to_wan2 passthrough=yes src-address=192.168.5.0/24
/ip firewall nat
add action=masquerade chain=srcnat out-interface=pppoe_provider_1 src-address=192.168.5.0/24
add action=masquerade chain=srcnat dst-address-type="" out-interface=    pppoe_provider_2 src-address=192.168.5.0/24 src-address-type=""
/ip route
add check-gateway=ping distance=1 gateway=pppoe_provider_1 routing-mark=    to_wan1
add check-gateway=ping distance=1 gateway=pppoe_provider_2 routing-mark=    to_wan2
add check-gateway=ping distance=1 gateway=pppoe_provider_2
add check-gateway=ping distance=2 gateway=pppoe_provider_1
/ip service
set telnet disabled=yes
set ftp disabled=yes
set ssh disabled=yes
set api-ssl disabled=yes
/system clock
set time-zone-autodetect=no
/system clock manual
set time-zone=+06:00
/system logging
add topics=pppoe
add topics=firewall
/tool graphing interface
add allow-address=192.168.5.0/24 interface=ether1-WAN1
add allow-address=192.168.5.0/24 interface=ether2-WAN2
/tool netwatch
add
/tool traffic-monitor
add interface=ether1-WAN1 name=tmon1 traffic=received

thanks in advance.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19106
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: need help with load balancing with specific ip address accssible through only one provider

Thu May 19, 2022 8:50 pm

A few questions........
Are they from the same provider?
If so there is no point in doing failover/backup as it one internet is down they will both be down coming from the same source and
I think, no sense if having check-gateway=ping on your routes......

The problem you are experiencing may be due to an incomplete setup for load balancing, which takes into account external incoming traffic and ensures return traffic goes out the same WAN.
Also it may be some routing rule that moves traffic regardless out a specific WAN.

I dont see any firewall rules and they should be provided for a review......

This is my favourite link/instruction for load balance - https://mum.mikrotik.com/presentations/US12/steve.pdf
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19106
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: need help with load balancing with specific ip address accssible through only one provider

Thu May 19, 2022 9:03 pm

(1) These could be modified slightly.......
add action=mark-connection chain=prerouting dst-address-type=!local new-connection-mark=wan1_conn passthrough=yes per-connection-classifier=both-addresses-and-ports:2/0 src-address=192.168.5.0/24
add action=mark-connection chain=prerouting dst-address-type=!local new-connection-mark=wan2_conn passthrough=yes per-connection-classifier=both-addresses-and-ports:2/1 src-address=192.168.5.0/24


add action=mark-connection chain=prerouting dst-address-type=!local connection-mark=no-mark new-connection-mark=wan1_conn passthrough=yes per-connection-classifier=both-addresses-and-ports:2/0 src-address=192.168.5.0/24
add action=mark-connection chain=prerouting dst-address-type=!local connection-mark=no-mark new-connection-mark=wan2_conn passthrough=yes per-connection-classifier=both-addresses-and-ports:2/1 src-address=192.168.5.0/24

(2) These are OK.
add action=mark-routing chain=prerouting connection-mark=wan1_conn new-routing-mark=to_wan1 passthrough=yes src-address=192.168.5.0/24
add action=mark-routing chain=prerouting connection-mark=wan2_conn new-routing-mark=to_wan2 passthrough=yes src-address=192.168.5.0/24

(3) Missing OUTPUT CHAIN mangle rules............

add action=mark-routing chain=output connection-mark=wan1_conn new-routing-mark=to_wan1 passthrough=yes
add action=mark-routing chain=output connection-mark=wan2_conn new-routing-mark=to_wan2 passthrough=yes

(4) Missing INcoming traffic (originating externally).

add action=mark-connection chain=prerouting connection-mark=no-mark disabled=no \
in-interface=pppoe_provider_1 new-connection-mark=connection-mark=wan1_conn passthrough=yes
add action=mark-connection chain=prerouting connection-mark=no-mark disabled=no \
in-interface=pppoe_provider_2 new connection-mark=wan2_conn passthrough=yes

(5) Modify existing routes
/ip route
add check-gateway=ping distance=1 gateway=pppoe_provider_1 routing-mark=to_wan1
add check-gateway=ping distance=1 gateway=pppoe_provider_2 routing-mark=to_wan2
add check-gateway=ping distance=1 gateway=pppoe_provider_2
add check-gateway=ping distance=2 gateway=pppoe_provider_1


/ip route
add distance=1 gateway=pppoe_provider_1 routing-mark=to_wan1
add distance=1 gateway=pppoe_provider_2 routing-mark=to_wan2
add distance=1 gateway=pppoe_provider_2
add distance=1 gateway=pppoe_provider_1
 
eon445
just joined
Topic Author
Posts: 2
Joined: Thu May 19, 2022 6:17 pm

Re: need help with load balancing with specific ip address accssible through only one provider

Thu May 19, 2022 9:34 pm

thanks for your reply Anav

Are they from the same provider?

they are different providers. when i disable provider_2 i can access the ip via provider_1 without the timeout issue.
just to clarify this again Provider_2 cant access that ip.

when both provider_2 and provider_1 is connected i get timeout error not always but sometime.
I dont see any firewall rules and they should be provided for a review......
the configuration i provided is exported via the terminal
this what i used to export the configuration
export file=myconfig.cfg
shouldn't it include all configuration including firewall ?

i will try out out your suggestion from your second post , when i get back to it.
thanks again.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19106
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: need help with load balancing with specific ip address accssible through only one provider

Thu May 19, 2022 9:56 pm

Yes, it reminds me of the sad song......
Where have all the firewall rules gone, long time passing/ago ..............

https://www.youtube.com/watch?v=ZgXNVA9ngx8

If the router is public IP facing you should have firewall rules setup.
viewtopic.php?t=180838

Okay so if they are different providers, then check gateway makes sense......
You just need them on the two default routes though.

Who is online

Users browsing this forum: No registered users and 39 guests