Windows sends TCP connect to host on locally connected network to default gatewayWhat is the largest TCP/IP network port number allowable for IPv4?How can I connect to Android with ADB over TCP?Socket.Bind and IP source routing, with multiple local network interfacesWindows TCP: Diagnosing TCP network bottlenecksHow to specify a specific NIC to be used in an application written in c++ (boost asio)Incoming TCP raw socket in Windows is not receivedAdding a route or default gateway to QNXHow can I ignore a TCP PSH bit in Windows 7?IPv6 black holing packets from a local TCP socketHow to permanently remove default routing rule for secondary network interface from window's IP routing table in C#

Are there hydrocarbons on the Moon?

Is it really necessary to have 4 hours meeting in Sprint planning?

What was an "insurance cover"?

Do household ovens ventilate heat to the outdoors?

Could someone please show me the steps of this sum?

How to influence manager to not schedule team meetings during lunch?

What do these pins mean? Where should I plug them in?

Pseudo Game of Cups in Python

CDG baggage claim before or after immigration?

Microservices and Stored Procedures

C# Fastest way to do Array Table Lookup with Integer Index

Was there a trial by combat between a man and a dog in medieval France?

Safely hang a mirror that does not have hooks

pandas aggregate with dynamic column names

Is it possible that the shadow of The Moon is a single dot during solar eclipse?

Is there any actual security benefit to restricting foreign IPs?

Would Taiwan and China's dispute be solved if Taiwan gave up being the Republic of China?

Сardinality estimation of partially covering range predicates

Why are some of the Stunts in The Expanse RPG labelled 'Core'?

Writing a letter of recommendation for a mediocre student

How to manage expenditure when billing cycles and paycheck cycles are not aligned?

How do I clean sealant/silicon from a glass mirror?

I feel like most of my characters are the same, what can I do?

How to ask a man to not take up more than one seat on public transport while avoiding conflict?



Windows sends TCP connect to host on locally connected network to default gateway


What is the largest TCP/IP network port number allowable for IPv4?How can I connect to Android with ADB over TCP?Socket.Bind and IP source routing, with multiple local network interfacesWindows TCP: Diagnosing TCP network bottlenecksHow to specify a specific NIC to be used in an application written in c++ (boost asio)Incoming TCP raw socket in Windows is not receivedAdding a route or default gateway to QNXHow can I ignore a TCP PSH bit in Windows 7?IPv6 black holing packets from a local TCP socketHow to permanently remove default routing rule for secondary network interface from window's IP routing table in C#






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am investigating a strange problem on windows and I have no clue, what is going on.



I have a windows host running windows 10. This host is connected to two networks, our LAN and a WLAN. A program on that system is communicating via WLAN to an embedded system connected to the same WLAN network. The communication usually is working fine and uses HTTP and some custom TCP protocol.



When a software update is performed on the embedded system, it has to perform a reboot. The windows program sends a command to the embedded system via HTTP. This HTTP transaction finishes without any problem and the embedded system performs its reboot.



After the completion of the HTTP transaction the windows program waits for 10 seconds starting polling the embedded device by performing TCP connects. A one second timeout is used and the TCP re-connect is retried for at 120 seconds.



The network trace shows, that after 27 unsuccessful attempts to establish a TCP connection, the windows system suddenly stops sending the TCP SYN frames on the WLAN interface but it starts sending them to the default router on the LAN interface.



I have to idea, why windows is suddenly using the default router trying to reach a node on a locally connected network. :-(



After a while, windows starts using the WLAN interface, again. This seems to be triggered by a timeout of the ARP entry for the embedded system. Windows send an ARP reply on the WLAN interface, the embedded system sends an ARP response, and then windows is using the WLAN interface for the TCP SYN frames, again. Unfortunately the 120s retry period has expired by then.



Does anybody know, what is causing this strange behavior of windows, where I can find documentation about it and how I can stop windows from doing this?



Many thanks in advance,



Mario



Update



Today I checked the problem on windows 7 and windows 7 behaves the same as windows 10. I also observed HTTP connection requests originating from internet explorer being sent to the default gateway instead of the correct interface. I checked the routing table and the ARP table during the misbehavior and found, that the routing table is correct, but the ARP table is missing an entry for the embedded system.



It seems that something is causing windows to drop the ARP table entry and instead of issuing ARP requests on the interface found in the routing table to use the default route.



Next update



It seems to be intended behavior (a least according to https://superuser.com/a/743329/941271 and https://superuser.com/a/743329/941271.



I learned, that the arp -a command windows does not show the complete ARP table on windows :-(. When using netsh interface ipv4 show neighbors, I can see an entry for my target IP address marked as unreachable.



I haven't yet found any documentation about this 'feature' in Microsoft documentation.



Yet another update



I still have not found any description about this behavior from Microsoft, but I found an API to manipulate the neighbor table: GetIpNetTable2() and DeleteIpNetEntry2(). Calling DeleteIpNetEntry2() before trying to connect the target device solves my problem.



Here is my code:



#pragma comment(lib, "iphlpapi.lib")
static void PurgeUnreachableEntry(const boost::asio::ip::address &Addr)

int AF;
if (Addr.is_v4()) AF=AF_INET;
else if (Addr.is_v6()) AF=AF_INET6;
else return;

PMIB_IPNET_TABLE2 pipTable = NULL;
unsigned long status = GetIpNetTable2(AF, &pipTable);
if (status != NO_ERROR)

printf("PurgeUnreachableEntry: GetIpNetTable() failed: %sn",
boost::system::error_code(status, boost::system::system_category()).message().c_str());
return;

boost::shared_ptr<MIB_IPNET_TABLE2> IpTable(pipTable, FreeMibTable);

for (unsigned i= 0; i < pipTable->NumEntries; i++)
MIB_IPNET_ROW2 &Entry=pipTable->Table[i];

if (!Entry.IsUnreachable) continue;

boost::asio::ip::address EntryAddr;
switch (Entry.Address.si_family)

case AF_INET:
EntryAddr = boost::asio::ip::address_v4(*(boost::asio::ip::address_v4::bytes_type*)&Entry.Address.Ipv4.sin_addr);
break;
case AF_INET6:
EntryAddr = boost::asio::ip::address_v6(*(boost::asio::ip::address_v6::bytes_type*)&Entry.Address.Ipv6.sin6_addr, Entry.Address.Ipv6.sin6_scope_id);
break;
default:
continue;


if (Addr != EntryAddr) continue;

DeleteIpNetEntry2(&Entry);











share|improve this question
































    0















    I am investigating a strange problem on windows and I have no clue, what is going on.



    I have a windows host running windows 10. This host is connected to two networks, our LAN and a WLAN. A program on that system is communicating via WLAN to an embedded system connected to the same WLAN network. The communication usually is working fine and uses HTTP and some custom TCP protocol.



    When a software update is performed on the embedded system, it has to perform a reboot. The windows program sends a command to the embedded system via HTTP. This HTTP transaction finishes without any problem and the embedded system performs its reboot.



    After the completion of the HTTP transaction the windows program waits for 10 seconds starting polling the embedded device by performing TCP connects. A one second timeout is used and the TCP re-connect is retried for at 120 seconds.



    The network trace shows, that after 27 unsuccessful attempts to establish a TCP connection, the windows system suddenly stops sending the TCP SYN frames on the WLAN interface but it starts sending them to the default router on the LAN interface.



    I have to idea, why windows is suddenly using the default router trying to reach a node on a locally connected network. :-(



    After a while, windows starts using the WLAN interface, again. This seems to be triggered by a timeout of the ARP entry for the embedded system. Windows send an ARP reply on the WLAN interface, the embedded system sends an ARP response, and then windows is using the WLAN interface for the TCP SYN frames, again. Unfortunately the 120s retry period has expired by then.



    Does anybody know, what is causing this strange behavior of windows, where I can find documentation about it and how I can stop windows from doing this?



    Many thanks in advance,



    Mario



    Update



    Today I checked the problem on windows 7 and windows 7 behaves the same as windows 10. I also observed HTTP connection requests originating from internet explorer being sent to the default gateway instead of the correct interface. I checked the routing table and the ARP table during the misbehavior and found, that the routing table is correct, but the ARP table is missing an entry for the embedded system.



    It seems that something is causing windows to drop the ARP table entry and instead of issuing ARP requests on the interface found in the routing table to use the default route.



    Next update



    It seems to be intended behavior (a least according to https://superuser.com/a/743329/941271 and https://superuser.com/a/743329/941271.



    I learned, that the arp -a command windows does not show the complete ARP table on windows :-(. When using netsh interface ipv4 show neighbors, I can see an entry for my target IP address marked as unreachable.



    I haven't yet found any documentation about this 'feature' in Microsoft documentation.



    Yet another update



    I still have not found any description about this behavior from Microsoft, but I found an API to manipulate the neighbor table: GetIpNetTable2() and DeleteIpNetEntry2(). Calling DeleteIpNetEntry2() before trying to connect the target device solves my problem.



    Here is my code:



    #pragma comment(lib, "iphlpapi.lib")
    static void PurgeUnreachableEntry(const boost::asio::ip::address &Addr)

    int AF;
    if (Addr.is_v4()) AF=AF_INET;
    else if (Addr.is_v6()) AF=AF_INET6;
    else return;

    PMIB_IPNET_TABLE2 pipTable = NULL;
    unsigned long status = GetIpNetTable2(AF, &pipTable);
    if (status != NO_ERROR)

    printf("PurgeUnreachableEntry: GetIpNetTable() failed: %sn",
    boost::system::error_code(status, boost::system::system_category()).message().c_str());
    return;

    boost::shared_ptr<MIB_IPNET_TABLE2> IpTable(pipTable, FreeMibTable);

    for (unsigned i= 0; i < pipTable->NumEntries; i++)
    MIB_IPNET_ROW2 &Entry=pipTable->Table[i];

    if (!Entry.IsUnreachable) continue;

    boost::asio::ip::address EntryAddr;
    switch (Entry.Address.si_family)

    case AF_INET:
    EntryAddr = boost::asio::ip::address_v4(*(boost::asio::ip::address_v4::bytes_type*)&Entry.Address.Ipv4.sin_addr);
    break;
    case AF_INET6:
    EntryAddr = boost::asio::ip::address_v6(*(boost::asio::ip::address_v6::bytes_type*)&Entry.Address.Ipv6.sin6_addr, Entry.Address.Ipv6.sin6_scope_id);
    break;
    default:
    continue;


    if (Addr != EntryAddr) continue;

    DeleteIpNetEntry2(&Entry);











    share|improve this question




























      0












      0








      0








      I am investigating a strange problem on windows and I have no clue, what is going on.



      I have a windows host running windows 10. This host is connected to two networks, our LAN and a WLAN. A program on that system is communicating via WLAN to an embedded system connected to the same WLAN network. The communication usually is working fine and uses HTTP and some custom TCP protocol.



      When a software update is performed on the embedded system, it has to perform a reboot. The windows program sends a command to the embedded system via HTTP. This HTTP transaction finishes without any problem and the embedded system performs its reboot.



      After the completion of the HTTP transaction the windows program waits for 10 seconds starting polling the embedded device by performing TCP connects. A one second timeout is used and the TCP re-connect is retried for at 120 seconds.



      The network trace shows, that after 27 unsuccessful attempts to establish a TCP connection, the windows system suddenly stops sending the TCP SYN frames on the WLAN interface but it starts sending them to the default router on the LAN interface.



      I have to idea, why windows is suddenly using the default router trying to reach a node on a locally connected network. :-(



      After a while, windows starts using the WLAN interface, again. This seems to be triggered by a timeout of the ARP entry for the embedded system. Windows send an ARP reply on the WLAN interface, the embedded system sends an ARP response, and then windows is using the WLAN interface for the TCP SYN frames, again. Unfortunately the 120s retry period has expired by then.



      Does anybody know, what is causing this strange behavior of windows, where I can find documentation about it and how I can stop windows from doing this?



      Many thanks in advance,



      Mario



      Update



      Today I checked the problem on windows 7 and windows 7 behaves the same as windows 10. I also observed HTTP connection requests originating from internet explorer being sent to the default gateway instead of the correct interface. I checked the routing table and the ARP table during the misbehavior and found, that the routing table is correct, but the ARP table is missing an entry for the embedded system.



      It seems that something is causing windows to drop the ARP table entry and instead of issuing ARP requests on the interface found in the routing table to use the default route.



      Next update



      It seems to be intended behavior (a least according to https://superuser.com/a/743329/941271 and https://superuser.com/a/743329/941271.



      I learned, that the arp -a command windows does not show the complete ARP table on windows :-(. When using netsh interface ipv4 show neighbors, I can see an entry for my target IP address marked as unreachable.



      I haven't yet found any documentation about this 'feature' in Microsoft documentation.



      Yet another update



      I still have not found any description about this behavior from Microsoft, but I found an API to manipulate the neighbor table: GetIpNetTable2() and DeleteIpNetEntry2(). Calling DeleteIpNetEntry2() before trying to connect the target device solves my problem.



      Here is my code:



      #pragma comment(lib, "iphlpapi.lib")
      static void PurgeUnreachableEntry(const boost::asio::ip::address &Addr)

      int AF;
      if (Addr.is_v4()) AF=AF_INET;
      else if (Addr.is_v6()) AF=AF_INET6;
      else return;

      PMIB_IPNET_TABLE2 pipTable = NULL;
      unsigned long status = GetIpNetTable2(AF, &pipTable);
      if (status != NO_ERROR)

      printf("PurgeUnreachableEntry: GetIpNetTable() failed: %sn",
      boost::system::error_code(status, boost::system::system_category()).message().c_str());
      return;

      boost::shared_ptr<MIB_IPNET_TABLE2> IpTable(pipTable, FreeMibTable);

      for (unsigned i= 0; i < pipTable->NumEntries; i++)
      MIB_IPNET_ROW2 &Entry=pipTable->Table[i];

      if (!Entry.IsUnreachable) continue;

      boost::asio::ip::address EntryAddr;
      switch (Entry.Address.si_family)

      case AF_INET:
      EntryAddr = boost::asio::ip::address_v4(*(boost::asio::ip::address_v4::bytes_type*)&Entry.Address.Ipv4.sin_addr);
      break;
      case AF_INET6:
      EntryAddr = boost::asio::ip::address_v6(*(boost::asio::ip::address_v6::bytes_type*)&Entry.Address.Ipv6.sin6_addr, Entry.Address.Ipv6.sin6_scope_id);
      break;
      default:
      continue;


      if (Addr != EntryAddr) continue;

      DeleteIpNetEntry2(&Entry);











      share|improve this question
















      I am investigating a strange problem on windows and I have no clue, what is going on.



      I have a windows host running windows 10. This host is connected to two networks, our LAN and a WLAN. A program on that system is communicating via WLAN to an embedded system connected to the same WLAN network. The communication usually is working fine and uses HTTP and some custom TCP protocol.



      When a software update is performed on the embedded system, it has to perform a reboot. The windows program sends a command to the embedded system via HTTP. This HTTP transaction finishes without any problem and the embedded system performs its reboot.



      After the completion of the HTTP transaction the windows program waits for 10 seconds starting polling the embedded device by performing TCP connects. A one second timeout is used and the TCP re-connect is retried for at 120 seconds.



      The network trace shows, that after 27 unsuccessful attempts to establish a TCP connection, the windows system suddenly stops sending the TCP SYN frames on the WLAN interface but it starts sending them to the default router on the LAN interface.



      I have to idea, why windows is suddenly using the default router trying to reach a node on a locally connected network. :-(



      After a while, windows starts using the WLAN interface, again. This seems to be triggered by a timeout of the ARP entry for the embedded system. Windows send an ARP reply on the WLAN interface, the embedded system sends an ARP response, and then windows is using the WLAN interface for the TCP SYN frames, again. Unfortunately the 120s retry period has expired by then.



      Does anybody know, what is causing this strange behavior of windows, where I can find documentation about it and how I can stop windows from doing this?



      Many thanks in advance,



      Mario



      Update



      Today I checked the problem on windows 7 and windows 7 behaves the same as windows 10. I also observed HTTP connection requests originating from internet explorer being sent to the default gateway instead of the correct interface. I checked the routing table and the ARP table during the misbehavior and found, that the routing table is correct, but the ARP table is missing an entry for the embedded system.



      It seems that something is causing windows to drop the ARP table entry and instead of issuing ARP requests on the interface found in the routing table to use the default route.



      Next update



      It seems to be intended behavior (a least according to https://superuser.com/a/743329/941271 and https://superuser.com/a/743329/941271.



      I learned, that the arp -a command windows does not show the complete ARP table on windows :-(. When using netsh interface ipv4 show neighbors, I can see an entry for my target IP address marked as unreachable.



      I haven't yet found any documentation about this 'feature' in Microsoft documentation.



      Yet another update



      I still have not found any description about this behavior from Microsoft, but I found an API to manipulate the neighbor table: GetIpNetTable2() and DeleteIpNetEntry2(). Calling DeleteIpNetEntry2() before trying to connect the target device solves my problem.



      Here is my code:



      #pragma comment(lib, "iphlpapi.lib")
      static void PurgeUnreachableEntry(const boost::asio::ip::address &Addr)

      int AF;
      if (Addr.is_v4()) AF=AF_INET;
      else if (Addr.is_v6()) AF=AF_INET6;
      else return;

      PMIB_IPNET_TABLE2 pipTable = NULL;
      unsigned long status = GetIpNetTable2(AF, &pipTable);
      if (status != NO_ERROR)

      printf("PurgeUnreachableEntry: GetIpNetTable() failed: %sn",
      boost::system::error_code(status, boost::system::system_category()).message().c_str());
      return;

      boost::shared_ptr<MIB_IPNET_TABLE2> IpTable(pipTable, FreeMibTable);

      for (unsigned i= 0; i < pipTable->NumEntries; i++)
      MIB_IPNET_ROW2 &Entry=pipTable->Table[i];

      if (!Entry.IsUnreachable) continue;

      boost::asio::ip::address EntryAddr;
      switch (Entry.Address.si_family)

      case AF_INET:
      EntryAddr = boost::asio::ip::address_v4(*(boost::asio::ip::address_v4::bytes_type*)&Entry.Address.Ipv4.sin_addr);
      break;
      case AF_INET6:
      EntryAddr = boost::asio::ip::address_v6(*(boost::asio::ip::address_v6::bytes_type*)&Entry.Address.Ipv6.sin6_addr, Entry.Address.Ipv6.sin6_scope_id);
      break;
      default:
      continue;


      if (Addr != EntryAddr) continue;

      DeleteIpNetEntry2(&Entry);








      windows tcp routing ip






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 29 at 14:54







      Mario Klebsch

















      asked Mar 28 at 14:51









      Mario KlebschMario Klebsch

      1921 silver badge10 bronze badges




      1921 silver badge10 bronze badges

























          0






          active

          oldest

          votes










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );














          draft saved

          draft discarded
















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55400585%2fwindows-sends-tcp-connect-to-host-on-locally-connected-network-to-default-gatewa%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.




















          draft saved

          draft discarded















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55400585%2fwindows-sends-tcp-connect-to-host-on-locally-connected-network-to-default-gatewa%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript