Old bug, PING SRC-ADDRESS does not work

This bug has been reported in 2009.

i need this to WORK.
Ping command ignores src-address. Tested as of today, in year 2020, ROS 6.476.7.. Without any preferred source in my routes…

http://forum.mikrotik.com/t/problems-with-ping-and-src-address/29601/1

It works if you use routing-table = and set up a seperate routing table with a routing mark. But src-address is ignored - even if it is a seperate interface.

It seems the routing table takes priority

I’ve never had this issue (and tested again right now on 6.46.7). Are you sure there is no src-nat (or masquerade) rule which replaces the source address set using the src-address parameter of ping?

Yeah thats why i tested, i created a seperate VLAN interface on both routers with other adddresses (my MASQ rule only applies to ETHER1 not the vlan)
Routing/gateway takes priority over src-address in ping command.

Post the configuration export and the actual ping command.

****I tested it just now, to confirm… Works as expected: by setting up the

src-address

in the source router, the destination router sees different source ip address (confirmed by running

/tool sniffer quick

on the destination router:

[admin@mikrotik1] > ping 10.245.24.1 src-address=192.168.0.1
  SEQ HOST                                     SIZE TTL TIME  STATUS             
    0 10.245.24.1                                56  64 9ms  
    sent=1 received=1 packet-loss=0% min-rtt=9ms avg-rtt=9ms max-rtt=9ms 

[admin@mikrotik1] > ping 10.245.24.1                        
  SEQ HOST                                     SIZE TTL TIME  STATUS             
    0 10.245.24.1                                56  64 8ms  
    sent=1 received=1 packet-loss=0% min-rtt=8ms avg-rtt=8ms max-rtt=8ms



[admin@mikrotik2] > tool sniffer quick 
INTERFACE      TIME    NUM DI SRC-ADDRESS                         DST-ADDRESS                         PROTOCOL   SIZE CPU FP 
VPN-mes...    4.944      1 <- 192.168.0.1                         10.245.24.1                         ip:icmp      70   0 no 
VPN-mes...    4.944      2 -> 10.245.24.1                         192.168.0.1                         ip:icmp      70   0 no 
VPN-mes...    8.304      3 <- 10.255.255.2                        10.245.24.1                         ip:icmp      70   0 no 
VPN-mes...    8.304      4 -> 10.245.24.1                         10.255.255.2                        ip:icmp      70   0 no

If there is no MASQ, then I can’t imagine what could go wrong for ping to actually ignore this parameter.


Routing/gateway takes priority over src-address in ping command.

@OP I am not sure how to understand this… Sounds almost like you expect the router to select different route, based on

src-address

from the

ping

command matched to

pref-src

in the

/ip route

entry.
Is that what you are trying to say? That router should choose different route based on the source address?

edit: agreed with @sindy - a config and precise description of expected+observed behavior would be great.

Sounds like we are doing the same thing. I already wrote there is no MASQ on the interface/IP I am using.

I can force it to work by using the routing-mark in the ping command, to use another interface+ip.
But that is the ONLY thing that will make it work on my end.

I will test later with different or older ROS versions

If you don’t want to post your config (of course make it anonymous by replacing all identifiable data) it is hard to understand what could be wrong. Also, you didn’t explain in detail what exactly does not work. (i.e. describe in detail your action, expected behavior and observed behavior). This description is absolutely necessary if you want any helpful answer, because clearly, with current description, we are getting different results than you. Maybe we just don’t understand your trouble.

On the other hand, you again said, that using routing-mark works. So again, I am asking - are you expecting the router to use different route, based on src-address? Because that is not how it works. If this is what you are trying to achieve, then look at definition of pref-src parameter in manual: https://wiki.mikrotik.com/wiki/Manual:IP/Route

Which of the local IP addresses to use for locally originated packets that are sent via this route. Value of this property has no effect on forwarded packets. If value of this property is set to IP address that is not local address of this router then the route will be inactive. If pref-src value is not set, then for locally originated packets that are sent using this route router will choose one of local addresses attached to the output interface that match destination prefix of the route.

It is clear that pref-src has no effect on router’s decision as of which route to use.