Community discussions

MikroTik App
 
kevinds
Long time Member
Long time Member
Topic Author
Posts: 638
Joined: Wed Jan 14, 2015 8:41 am

How do I set source-IP?

Mon Apr 04, 2022 10:33 am

BGP on v6.49.5

viewtopic.php?t=135754#p668646
Each route has a parameter pref-src whose value specifies the local IP address of the router which should be used for locally originated packets sent down that route.
I'm having an issue that my router is using non-routed IPs for the IP source..

The public bandwidth test server for example viewtopic.php?t=104266 is reachable via an IX, so non-routed IP on the interface.. The bandwidth test doesn't have a source-IP field.

My home ISP is similar. Traceroute and Ping to my home doesn't work unless I put in a source IP or alternate interface..

Is there a way to set pref-src on dynamic (BGP) routes?
 
eduplant
Member Candidate
Member Candidate
Posts: 139
Joined: Tue Dec 19, 2017 9:45 am

Re: How do I set source-IP?  [SOLVED]

Mon Apr 04, 2022 11:20 am

According to the :routing filter documentation [1] it looks like you can use the :routing filter set set-pref-src=<ip_address> option in inbound filters.

[1] https://wiki.mikrotik.com/wiki/Manual:R ... ng_filters
 
kevinds
Long time Member
Long time Member
Topic Author
Posts: 638
Joined: Wed Jan 14, 2015 8:41 am

Re: How do I set source-IP?

Mon Apr 04, 2022 11:27 am

According to the :routing filter documentation [1] it looks like you can use the :routing filter set set-pref-src=<ip_address> option in inbound filters.
Thank you!

That is not where I was expecting. Cool
 
eduplant
Member Candidate
Member Candidate
Posts: 139
Joined: Tue Dec 19, 2017 9:45 am

Re: How do I set source-IP?

Mon Apr 04, 2022 11:36 am

Thank you!

Sure thing. I’m curious what your use case is that requires it. :D
 
kevinds
Long time Member
Long time Member
Topic Author
Posts: 638
Joined: Wed Jan 14, 2015 8:41 am

Re: How do I set source-IP?

Mon Apr 04, 2022 11:58 am


Sure thing. I’m curious what your use case is that requires it. :D
By default RouterOS is trying to use the IP on the interface closest to the destination for it's output traffic, for exchanges, it is using the exchange IP, which can't be replied to because they are not routed.

For example, the bandwidth test server to my router is through a peering exchange, not transit, so inaccessible.

For a lot of "/tool fetch" downloads to work, I need to add source-ip= to the command for anything available via an exchange.

Confirmed fixed. :) :)
Last edited by kevinds on Mon Apr 04, 2022 12:14 pm, edited 1 time in total.
 
eduplant
Member Candidate
Member Candidate
Posts: 139
Joined: Tue Dec 19, 2017 9:45 am

Re: How do I set source-IP?

Mon Apr 04, 2022 12:12 pm

By default RouterOS is trying to use the IP on the interface closest to the destination for it's output traffic, for exchanges, it is using the exchange IP, which can't be replied to because the are not routed.
Ahh, makes sense. You did mention that this was in an IX setting and I didn’t fully think through the ramifications of peering with unroutable address space. Thanks for the clarification.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: How do I set source-IP?

Mon Apr 04, 2022 2:25 pm

Using pref-src / "Pref. Source" / "Preferred Source" on route without involving consuming firewall rules???
 
kevinds
Long time Member
Long time Member
Topic Author
Posts: 638
Joined: Wed Jan 14, 2015 8:41 am

Re: How do I set source-IP?

Mon Apr 04, 2022 7:08 pm

Using pref-src / "Pref. Source" / "Preferred Source" on route without involving consuming firewall rules???
I did try those first..

This solution doesn't work for IPv6 though.. Opened a bug-report today.
Last edited by kevinds on Mon Apr 11, 2022 2:13 am, edited 1 time in total.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: How do I set source-IP?

Mon Apr 04, 2022 7:15 pm

I suppose IPv4, because I do not see any about IPv6
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19103
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: How do I set source-IP?

Mon Apr 04, 2022 8:58 pm

yeah for some people they seem to prefer ipv6, hopefully no one forces it down our throats..... like recycling ;-P
 
kevinds
Long time Member
Long time Member
Topic Author
Posts: 638
Joined: Wed Jan 14, 2015 8:41 am

Re: How do I set source-IP?

Thu Apr 14, 2022 3:44 am

This solution doesn't work for IPv6 though.. Opened a bug-report today.
So the bug isn't a bug because they never designed it to work for IPv6, but this is needed for the same reasons it is needed for IPv4..

Not working as documented seems like a bug to me..

Overall though, this breaks other features and functions,
System - Packages - Check for updates 
being one of them.. Can't use dual-stack services that connect through an internet exchange, because IPv6 is preferred over IPv4..

Argh..
 
eduplant
Member Candidate
Member Candidate
Posts: 139
Joined: Tue Dec 19, 2017 9:45 am

Re: How do I set source-IP?

Thu Apr 14, 2022 3:51 am

So the bug isn't a bug because they never designed it to work for IPv6, but this is needed for the same reasons it is needed for IPv4..

Not working as documented seems like a bug to me..

As in, the preferred-source field of IPv6 routes simply doesn't work? I haven't had a reason to try and set it and I want to make sure I'm understanding what you ran into.
 
kevinds
Long time Member
Long time Member
Topic Author
Posts: 638
Joined: Wed Jan 14, 2015 8:41 am

Re: How do I set source-IP?

Thu Apr 14, 2022 4:02 am

As in, the preferred-source field of IPv6 routes simply doesn't work? I haven't had a reason to try and set it and I want to make sure I'm understanding what you ran into.
Exactly. It gives an error when trying to enter an IPv6 address.

Edit: Specifically the set-pref-src in BGP route filters, discussed above.. I don't know (or care) about for static routes.
Last edited by kevinds on Thu Apr 14, 2022 9:02 am, edited 1 time in total.
 
eduplant
Member Candidate
Member Candidate
Posts: 139
Joined: Tue Dec 19, 2017 9:45 am

Re: How do I set source-IP?

Thu Apr 14, 2022 4:20 am

If Mikrotik claims this isn't a bug, that is disappointing.

I will admit that source address selection in IPv6 is significantly more complicated (multiple scopes and dynamic prefixes with different lifetimes) but for a device acting as a router, you need to be able to have the flexibility to pick your source address. I have a similar complaint over here [1] where OSPFv3 seems to pick an address at random to include in the routing table for virtual links but doesn't give you the control to pick one.

[1] viewtopic.php?p=925266

Who is online

Users browsing this forum: No registered users and 19 guests