• 0

[C/C#/C++] Force Windows XP to ping via specific interface?


Question

I don't care about the programming language, but C# or C/C++ would be preferable. Sadly, the platform must be Windows XP.

The goal is to ping out of a specific network interface on a multihomed machine, bypassing the routing table in the process.

In Linux/UNIX, this is trivial: simply ping out the interface with the existing ping utility. Windows XP does not provide this functionality.

I attempted to implement the UNIX behavior of ping using raw sockets to send custom made ICMP packets. I set the DontRoute socket option, bound the socket to a local endpoint, and sent the ICMP packet to the remote end point. In my tests, the source and destination addresses are correct, but the wrong interface is used to transmit the packet.

I've tried other avenues such as Cygwin. I could do it with a virtual machine running Linux. I also read somewhere that this is impossible in Windows XP, but possible on Vista/7. I'd be willing to consider manipulating the routing tables and/or interface metrics, if someone can prove that it works.

Words alone cannot express how deeply I hate Windows, so you can imagine how appreciative I'll be for any help.

4 answers to this question

Recommended Posts

  • 0

I imagine you've already found this. It was a top link in google: http://www.experts-exchange.com/Networking...Q_24035725.html

I can't prove it works, but it seems simple enough to try. Or as someone else says in the comments, if the interfaces are on different IPs you can use the -S switch to specify a source address.

Also somehere here managed to remove a default route to make it use a specific interface so the above should work :)

  • 0

Thanks for the reply. Sadly there is no -S option to specify the source address in XP.

I did see the post about changing the routing tables, unfortunately I'll be dealing with multiple routes so that could get hairy. Looks like I'll be going to the virtual machine route. Thanks again for the help.

  • 0

I may be misunderstanding this, but could you not use the switch, -k hostlist?

-k
HostList
: Specifies that the Echo Request messages use the Strict Source Route option in the IP header with the set of intermediate destinations specified in HostList. With strict source routing, the next intermediate destination must be directly reachable (it must be a neighbor on an interface of the router). The maximum number of addresses or names in the host list is 9. The host list is a series of IP addresses (in dotted decimal notation) separated by spaces.

Source

Am I reading that correctly? If you know the source path, you should be able to set the hops?

Or you could use -j hostlist, if you don't know all the hops:

-j
HostList
: Specifies that the Echo Request messages use the Loose Source Route option in the IP header with the set of intermediate destinations specified in HostList. With loose source routing, successive intermediate destinations can be separated by one or multiple routers. The maximum number of addresses or names in the host list is 9. The host list is a series of IP addresses (in dotted decimal notation) separated by spaces.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • All set as AI did the trick
    • AnyDesk 9.5.7 by Razvan Serea AnyDesk is a fast remote desktop system and enables users to access their data, images, videos and applications from anywhere and at any time, and also to share it with others. AnyDesk is the first remote desktop software that doesn't require you to think about what you can do. CAD, video editing or simply working comfortably with an office suite for hours are just a few examples. AnyDesk is designed for modern multi-core CPUs. Most of AnyDesk's image processing is done con­currently. This way, AnyDesk can utilize up to 90% of modern CPUs. AnyDesk works across multiple platforms and operating systems: Windows, Linux, Free BSD, Mac OS, iOS and Android. Just five megabytes - downloaded in a glimpse, sent via email, or fired up from your USB drive, AnyDesk will turn any desktop into your desktop in se­conds. No administrative privileges or installation needed. AnyDesk 9.5.7 changelog: Fixed Bugs Fixed deadlock when updating chat server Fixed crashes caused by exceptions in internal communication layer Fixed crash when opening new monitor in Session in a new window Fixed crash on shutdown Fixed bug that allowed naming Permission Profiles identical to predefined Profiles Fixed bug that could cause licensed remote clients to show up as free Fixed visual bug that caused Set-Password button to show up when Unattended Access was disabled Fixed bug that lead to selecting the wrong initial resolution for webcams New Features Added command line option --record-screen to start a Screen Recording Other Changes Improved visual consistency in some list views Download: AnyDesk 9.5.7 | macOS ~14.0 MB (Free for private use, paid upgrade available) Links: AnyDesk Home Page | Other platforms | Release History | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • WUT?! Tell us you've never built desktop software without telling us you've never built desktop software... The chromium rendering engine is the content-rendering engine for "chromium-based browsers," but that does NOT mean there's a full-on UI underneath that is somehow bloating these products. The bloat is from the additional UI components that the browser vendor (Vivaldi) is adding atop the base package. Most chromium browsers customize the default skin/theme of the overall package so there's absolutely zero added overhead; it's really just a different CSS-based theme pack. Vivaldi, however, adds more than just a different skin; they add built-in extensions (that are managed by other built-in extensions), add other customization modules, and all kinds of other bloat -- and these add-ons are EXACTLY where the resource-hogging stems from. The mere fact it's a chromium-based browser has no impact on the matter. Lastly, power users literally DO notice resource-intensive applications -- they'll even be familiar with tools and widgets that expose those measurements the way only a power-user would! General consumers, however, would simply remark that their rig is sluggish and probably outdated and blindly upgrade to whatever the salespeople are hawking at the local computer store. General consumers wouldn't even upgrade their existing computer cuz they wouldn't know how to!
    • Nope, they just removed the game from sales.
  • Recent Achievements

    • First Post
      Celilo earned a badge
      First Post
    • One Year In
      K.I.S.S. earned a badge
      One Year In
    • Week One Done
      solidox earned a badge
      Week One Done
    • Dedicated
      solidox earned a badge
      Dedicated
    • Week One Done
      Devesh Beri earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      438
    2. 2
      ATLien_0
      166
    3. 3
      +FloatingFatMan
      151
    4. 4
      Nick H.
      66
    5. 5
      macoman
      63
  • Tell a friend

    Love Neowin? Tell a friend!