4

I have a PC which connects to a network by both wired cable and wireless. Of course, it has 2 IP Addresses : 192.168.5.111 and 192.168.5.112. (Subnet mask 255.255.255.0)

As usual, the PC picks the wired-IP(192.168.5.111) as its main-IP while the wireless-IP is almost "disabled". That means:

1/ No other PC could ping to the wireless IP
2/ No other PC could make a TCP connection to wireless IP.
3/ When I broadcast to "192.168.5.255" or send any UDP packet, the recipients never 
see that sender's address as the wireless IP

This is expected behavior. The odd happened when I unplugged the cable to remove the wired-network.

1/ Other PCs could now ping my wireless IP
2/ Other PCs could now make TCP connection to wireless IP
3/ BUT : When I broadcasted to "192.168.5.255", no other PC in LAN received my packet.
When other PCs broadcasted to "192.168.5.255", my PC received nothing as well.

I tried broadcasted to "255.255.255.255" and things worked as expected. But, recipients see my IP as 192.168.5.111 (the unplugged IP) instead of 192.168.5.112 (my wireless IP). And in other hand, I know it's not a good solution to broadcast to "255.255.255.255" as many experts recommended.

I've stepped 1 step farther when I open the network devices and disabled the "Ethernet(Wired)" device. After that I could do the No.3/ and get things worked as expected.

So my question is: Is my wired-connection cached somewhere in my PC that I could not broadcast normally by wireless-IP without the wired-device disabled? Is there any workaround to fix this ?


PRACTICAL DATA :

This is the routeTable when I have both network adapter enabled (wired & wireless):

===========================================================================
Interface List
 11...5c ff 35 0b d8 34 ......Atheros AR8131 PCI-E Gigabit Ethernet Controller
 14...00 26 82 a5 62 82 ......Broadcom 802.11n Network Adapter
  1...........................Software Loopback Interface 1
 12...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
 13...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.5.1    192.168.5.102     30
          0.0.0.0          0.0.0.0      192.168.5.1    192.168.5.104     20
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      192.168.5.0    255.255.255.0         On-link     192.168.5.102    286
      192.168.5.0    255.255.255.0         On-link     192.168.5.104    276
    192.168.5.102  255.255.255.255         On-link     192.168.5.102    286
    192.168.5.104  255.255.255.255         On-link     192.168.5.104    276
    192.168.5.255  255.255.255.255         On-link     192.168.5.102    286
    192.168.5.255  255.255.255.255         On-link     192.168.5.104    276
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link     192.168.5.102    286
        224.0.0.0        240.0.0.0         On-link     192.168.5.104    276
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link     192.168.5.102    286
  255.255.255.255  255.255.255.255         On-link     192.168.5.104    276
===========================================================================

And this is routeTable when I unplug the cable of wired network:

===========================================================================
Interface List
 11...5c ff 35 0b d8 34 ......Atheros AR8131 PCI-E Gigabit Ethernet Controller
 14...00 26 82 a5 62 82 ......Broadcom 802.11n Network Adapter
  1...........................Software Loopback Interface 1
 12...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
 13...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.5.1    192.168.5.102     30
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      192.168.5.0    255.255.255.0         On-link     192.168.5.102    286
    192.168.5.102  255.255.255.255         On-link     192.168.5.102    286
    192.168.5.255  255.255.255.255         On-link     192.168.5.102    286
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link     192.168.5.102    286
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link     192.168.5.102    286
===========================================================================
vantrung -cuncon
  • 155
  • 1
  • 3
  • 15
  • Yes, DHCP leases are cached as long as they are valid. Please take a look at the routing table (`route print`) to check if it looks incorrect when you’re unplugged. Also, WiFi being “disabled” while connected via Ethernet is in no way normal. – Daniel B Nov 30 '14 at 17:25
  • If you meant "the cached IP still in route table" when you wrote "(route print) to check if it looks incorrect" then I'm sure it was never there when the cable is unplugged. Maybe it's in the router, maynot it ? – vantrung -cuncon Dec 01 '14 at 06:40
  • The router can’t know it’s the same device, so it’s not the router. It’s also not Windows, because it’s working fine for me. – Daniel B Dec 01 '14 at 06:44

2 Answers2

2

Since Windows 7, there are problems with having both the wired and wireless adapters active at the same time. It actually surprises me that you can get as much done with the two adapters being active in parallel.

The only iron-cast solution, in my experience, is to have one adapter enabled and the other disabled. This apparently cleans-up whatever information is left-over when the other adapter has taken over, so everything works as expected. You have already found out the same fact.

I am sure that this is a bug in Windows, not allowing a smooth fall-over from one adapter to another. It might have something with routing tables not being cleaned-up (which you can verify by using the route command). The only clean solution is not to have both adapters active at the same time.

The article 4 Ways to Automatically Disable Wireless Network Connection when Local Area Connection is Enabled describes four ways of doing it automatically : disable the wireless adapter when Ethernet is available and vice verso. It links-to a Visual Basic script that does that, which seems the best solution among the four, and describes how to make that script run automatically at startup.

Another solution is described in the thread Disable wireless when ethernet connection is detected on an HP EliteBook. The best answer contains a .bat file which is run by the task scheduler when a network goes down.

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • This seems to be a stable but not global solution cause some customers need all the connections simultaneously. For example: wifi for the internet and wired cable for the printer, scanner or even another workgroup...etc. Morever, in almost cases wired is faster. Thus by disabling it we take away our customer's convinience of speed. – vantrung -cuncon Dec 01 '14 at 06:34
  • There are in that case some limitations/bugs arising from the Microsoft implementation of multiple network adapters. You could add to your post a printout of the routing table when the cable is plugged and when unplugged for analysis. – harrymc Dec 01 '14 at 08:46
  • 1
    It seems that Windows simply duplicates all routing entries for both interfaces, where wired gets metrics of 2x or 2xx, and wireless 3x or 3xx. However, I see a broadcast 255.255.255.255 entry with metric 286 left unchanged when the cable is unplugged and might be the problem. Enabling/disabling a network card will cause requesting all routes from the router, so also clears up this left-over. An alternative might be to run `ipconfig /release` and then `ipconfig /renew` to restore the routing table. If this isn't enough, use first `route -f` (reboot if trouble). – harrymc Dec 01 '14 at 11:57
  • I believe this is the global issue with almost all versions of windows7 & windows8. I've tested with 3 PCs with same result. And I think you could reproduce it with your PC. Thus, you could alter the route table directly yourself and see what happen. – vantrung -cuncon Dec 01 '14 at 12:21
  • I don't have two network adapters on my computer, so I need to depend on your results. – harrymc Dec 01 '14 at 12:36
  • The entries are not duplicated. They are the result of DHCP auto-configuration. Also, the 255.255.255.255 entry is perfectly valid, because it’s the WiFi entry—note the .102 address. There is absolutely no problem whatsoever with the routing table. I also never heard of this being a Windows issue, so it’s likely a problem with third-party software. You can have as many connections as you want to the very same network, there won’t be problems. – Daniel B Dec 01 '14 at 14:25
  • @DanielB: Well, there are problems or this post wouldn't exist. AFAIK disabling/enabling an adapter resets the routing table and that fixes his problem, and it fixed mine as well sometime ago. I don't pretend to know where in the routing table or adapter info is data left-over, but it looks likely to have something to do with broadcasting. But of course nothing is certain. I also don't believe in a third-party problem, as it happens in multiple environments. I'm not a Microsoft employee, so can only make educated guesses that more than likely are inaccurate, but my conclusions seem to work. – harrymc Dec 01 '14 at 16:25
-1

The computer remembers what IP it has been given, because it uses it when it sends messages out.

When the connection falls between the computer and the router, then the router assumes the computer is off-line, and reuses the IP address. Your computer does not know this, and starts using the same IP address it was given earlier.

This is very common with Laptops which doze off into sleep mode, whether wifi or wired. Other people fire up their laptops and fondle-slabs and take the number.

The cure is to run ipconfig /renew from a command prompt or icon. This tells the computer that it needs to fetch a new number from the router.

wendy.krieger
  • 718
  • 4
  • 13
  • Invoking "ipconfig /renew" takes about ~ 10 seconds to execute. Do you know exactly where the IP is cached then I can delete it in 0.1 second ? – vantrung -cuncon Dec 01 '14 at 10:53
  • I tend to think it's more the router's fault in taking so long. In theory, `ipconfig /renew` should clear the local cache directly, and the router needs to be fondled. Sometimes i have to turn off and turn on the Wifi for the system to correctly do its thing. – wendy.krieger Dec 01 '14 at 10:56
  • Yes, to disable & re-enable the adapter seems to be my best solution at this moment. Thank you for your answer that helped me to understand more about the situation. – vantrung -cuncon Dec 01 '14 at 10:58
  • I have an Surface that occasionally looses all wireless connection, so it needs a reboot. The iPad looses its way too, and it needs to be stroked in the right way. Networking is still magic to me, but ipconfig /renew does exactly what it says. – wendy.krieger Dec 01 '14 at 11:01
  • 2
    This absolutely not true. Windows will not reuse cached DHCP leases without verifying they’re still available. Also, `/renew` does not clean any cache. That’s what `/release` does. – Daniel B Dec 01 '14 at 11:28