• 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

    • Taiwan hits Huawei and SMIC with new export restrictions by David Uzondu Taiwan has added Huawei and Semiconductor Manufacturing International Corporation, or SMIC, to its export control entity list. According to CNBC, this means companies in Taiwan now need a special license to ship certain high-tech goods to these two mainland Chinese firms. The conflict has been escalating for a while. The United States government, for instance, has been going after Huawei since at least 2019, putting the telecom equipment maker on its own Entity List over national security fears. The worry has always been about Huawei's connections to the Chinese government and the potential for its network gear to be used for spying. The United Kingdom eventually followed suit, ordering all Huawei 5G equipment to be ripped out of its networks by 2027. Remember, in December 2020, the US added SMIC to its Entity List over its alleged ties to the Chinese military. The goal was to choke off the chipmaker's access to the tools it needs to produce the most advanced semiconductors. Despite all the pressure, the two firms managed to collaborate and produce a 7nm chip for Huawei's Mate 60 phone, which annoyed some people in Washington who thought the sanctions had completely crippled China's chipmaking ambitions. This new blacklisting from Taiwan just tightens the screws even more. Last year, research firm TechInsights found a TSMC-made chip inside a Huawei AI training card. That was a huge "oh no" moment because it showed that, despite all the American restrictions, Huawei was still getting its hands on advanced Taiwanese silicon. That discovery led directly to the U.S. Commerce Department leaning on TSMC to shut down access for Chinese clients to specific AI chips. Huawei had cleverly exploited loopholes to hoard millions of GPU dies for its Ascend AI chip program, a direct attempt to build a homegrown alternative to Nvidia's dominant hardware. For Taiwan, this feels less like a trade issue and more like a matter of survival. The island's lead in chipmaking, largely thanks to TSMC, is often seen as its "silicon shield." The idea is that global reliance on Taiwanese chips makes any military action by China a huge risk for the world. Letting its most advanced tech reach the country that threatens its very existence could seriously weaken that shield. Source: CNBC
    • Anything is "news worthy" if it's new and someone writes about it. Something like an inconsequential note about "correcting a typo in the readme file" buried deep in the changelog could become "news worthy". And, on related note, anything can be used as a justification to complain about something one is clearly already biased against. Say, if someone's biased against Windows 11, they could see even an inconsequential change like an added time display as a reason to rant about "Microsoft these days"... ¯\_(ツ)_/¯
    • I expect i will always have the choice, I doubt I will be around to see self drive cars on the roads in any great amounts. I can understand where your wife is coming from, but then being in a car alone can have other problems.
    • I have no interest in changing to Windows 11, even if I update my PC. My Pc can run it unofficially, and I have had a peek now and again, but so many things that put me off, All the AI stuff that is all over the place, so not an easy way to switch it off, the forced MS account, the way Windows 11 pops up dialogues when you are not using Edge or any other MS supplied software. The awful context menus. The search in windows using Bing and then the results in Edge. There are other reason. I changed to Mac for the most part, but as I have said before, I do have an old AMD R 7 1700 machine for my games, unless it stops working I will keep it going with Windows 10.
    • I switched to Mac, I would have changed to Linux, but i run software that is no compatible with Linux and no replacement.
  • Recent Achievements

    • Explorer
      Legend20 went up a rank
      Explorer
    • One Month Later
      jezzzy earned a badge
      One Month Later
    • First Post
      CSpera earned a badge
      First Post
    • One Month Later
      MIR JOHNNY BLAZE earned a badge
      One Month Later
    • Apprentice
      Wireless wookie went up a rank
      Apprentice
  • Popular Contributors

    1. 1
      +primortal
      615
    2. 2
      ATLien_0
      277
    3. 3
      +FloatingFatMan
      180
    4. 4
      Michael Scrip
      150
    5. 5
      Steven P.
      115
  • Tell a friend

    Love Neowin? Tell a friend!