After the big screen set the network card to turn on the hotspot, we often receive feedback that the cell phone can not search the big screen hotspot, or the cell phone fails to connect to the big screen hotspot.
There are several general categories of such questions:
1. The physical NIC IP is the same as the hotspot NIC IP
2. Hotspot NIC IP, not normal hotspot IP (192.168.)
The hotspot IP we generally designate as 192.168., 192.168. is a reserved IPv4 address range. Where X represents the unique identification of a particular device on the LAN, usually a number between 1 and 254.
This address range is often used as a private IP address within a LAN, such as a Wi-Fi hotspot or some home networks
Setting this private IP address range as a hotspot IP can avoid conflicts with existing networks. At the same time, the more characteristic IP segment allows users to divide the devices in the LAN into specific subnets, which is beneficial for managing and monitoring the connection and communication of the devices
Fixing hotspot IPs for the above 2 types of situations.
1. The physical NIC IP is the same as the hotspot NIC IP
-- If the physical NIC has a hotspot IP such as 192.168.137.1, the hotspot IP needs to be circumvented; if there is already a DHCP server in the LAN assigning an IP address and the hotspot device is trying to assign an IP address, this may cause a conflict in the IP address assignments, resulting in network connectivity issues. Although it is not recommended to assign this IP address to the physical NIC, it seems that the only way to avoid this conflict is to use the hotspot's virtual NIC.
2. Hotspot NIC IP, non-hotspot IP (192.168.)
-- The hotspot is a private network and it is recommended to use the hotspot's proprietary IP domain to minimize conflicts with the LAN's normally assigned IP.
Below is the fix code, part of the business logic for the NIC developed in-house by the team:
1 /// <summary> 2 /// Fix IP conflicts 3 /// </summary> 4 public async Task RepairIpConflictAsync() 5 { 6 var allNetworks = await GetAllNetworkInfosAsync(); 7 // Get the current virtual NIC 8 var virtualAdapter = (x => && 9 (VirtualWifiDescription)); 10 11 if (virtualAdapter == null) return; 12 //Whether the actual NIC is using a hotspot IP 13 var physicalCardErrorIps = new List<string>(); 14 foreach (var x in (x => !(VirtualWifiDescription))) 15 { 16 (x.(ip => ("192.168.137."))); 17 } 18 var isVirtualCardCorrectIp = virtualAdapter.(x => ("192.168.137.")) != null; 19 //The physical NIC is not using the hotspot IP, and the virtual NIC is using the hotspot IP, no need to repair the IP. 20 if ( == 0 && isVirtualCardCorrectIp) 21 { 22 return; 23 } 24 var defaultHotspotIp = "192.168.137.1"; 25 if ( > 0) 26 { 27 for (var i = 1; i < 255; i++) 28 { 29 var ip = $"192.168.137.{i}"; 30 if ((ip)) continue; 31 defaultHotspotIp = ip; 32 break; 33 } 34 } 35 var networkAdapter = new NetworkAdapterController(); 36 (defaultHotspotIp, "255.255.255.0"); 37 }
First, get the current virtual adapter "Microsoft Wi-Fi Direct Virtual Adapter", there will be more than one virtual adapter, choose the one with IPEnabled=true (bind and enable TCP/IP on the network adapter).
There may be physical NICs that use hotspot IPs, so the next step is to get a list of all IPs that use hotspot IPs for subsequent circumvention of those IPs for the hotspot NIC.
Whether the virtual NIC adopts the hotspot IP or not, if not, you need to reset it as well.
So, according to the NIC ID, set this virtual NIC as the hotspot IP of 192.168.range and the default mask "255.255.255.0". At the same time, it skips the hotspot IP already used by the physical NIC to avoid IP conflicts.