Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1130
  • Last Modified:

fping with source interface

Does anyone know how to use fping with different source interface (different source ip)?
0
cheechew
Asked:
cheechew
  • 5
  • 2
1 Solution
 
ahoffmannCommented:
AFAIK not possible
0
 
The--CaptainCommented:
Sure it is - why not

route add -host <host-to-fping> dev <desired-source-interface>

or

route add -host <host-to-fping> gw <gateway-for-desired-interface>

?

As long as <desired-source-interface> is connected to a network that can reach <host-to-fping> (1st example), or each different interface is on a different subnet and each subnet has a <gateway-for-desired-interface> that will route packets to <host-to-fping> (2nd example), I would think that the routing subsystem would take care of this for you...

I know the 2nd example works - haven't yet tried the 1st example...

-Jon

0
 
cheechewAuthor Commented:
I don't need to add route, all IP are on the same subnet with single physical interface. I am using fping to do ping.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
The--CaptainCommented:
Sigh - why are you so willing to dismiss my ideas without trying them?  I have verified that my 1st example will work, with the addition of one more argument.

You need to use

route add -host <host-to-fping> gw <my-default-gateway> dev <interface-with-desired-IP>

One you add this route, all fpings to <host-to-fping> will go out with s source of <interface-with-desired-IP>.

I've tried it - it works (source IP verified with tcpdump).

No go try it, and don't tell me it won't work, because I just confimed it does.

-Jon

P.S.  Why bother asking for help, if you are so sure of what will work and what will not?

0
 
The--CaptainCommented:
Also, if both src and dest hosts are on the same subnet, my 1st original example will suffice.

I was sooooo tempted to post this as an "answer", since I am actually %100 sure one of the examples I provided will work if properly implemented, but I will refrain in the interests of the community.

cheechew - I didn't become a top-ten topic expert in this TA (linux networking) because I am clueless - In fact, I support myself financially via my own independant consulting service parceling out just such tidbits of knowledge.  Please try my advice.  Not every answer is the one you expect.  In this case, I think you expected specific arguments to fping - sorry, can't help you there.  What I *did* provide was another way to do the same thing.

Also, if you just want to restrict your route mangling to icmp, try policy routing using the iproute2 tools...

-Jon

P.S.  I also know this works because in addition to my tests performed yesterday, I have used exactly the same tactics to get around specific-IP blackholes against a multihomed host, when such a host was accidentally blocked on its primary IP, but not on its secondary IPs.

0
 
cheechewAuthor Commented:
Yes, it is a brilliant solution. Even fping do not have the capibility, but we can play around the route on the OS itself. I have tried on specifying both source gw interface and ip, but have not try on only specifying either of them.
0
 
The--CaptainCommented:
I am not sure if I would call it a "brilliant" solution, but I am confident as to its feasibility.  Let me know how it goes (and yes, you are correct, if I properly perceive the eventual conclusion to your statements) - this trick can indeed be used on any network tool in a similar situation (in which the user needs to specify the src addr, but the tool does not support configuration of the src addr via a direct argument).  As long as the network tool in question does not circumvent the routing subsystem function calls, the tool should correctly choose the proper outbound address on which to bind, given the according associations within the routing table.

Cheers,
-Jon

0
 
The--CaptainCommented:
Thanks!

-Jon
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now