The house I rented in Shanghai only provides wireless network (802.11n) to access the Internet, but I personally hope that I can get a faster wireless intranet and hide my network device from the outside, so I purchased a NETGEAR A6210 wireless network card featuring 802.11AC support and USB 3.0 interface, ready to make such a network connection:

+--------------------+       +-----------------------+
| LAN(802.11AC + GbE)| CAT5E |  HP ProLiant MS Gen8  |
| (PS4, Kindle, etc) +-------+  eth0: 192.168.137.1  |
|  192.168.137.0/24  |       | wlan0: 192.168.0.x/24 |
+--------------------+       +---+-------------------+
                                 | 802.11n
                             +---+------------+
                             | TP-LINK Router |
                             +----------------+

Implenemting this kind of structure is quiet simple for Linux PCs. You only need to enable ip_forward and execute iptables -t nat -A POSTROUTING -j MASQUERADE with root privilege. But unfortunately this USB3.0 wireless NIC has no driver in the mainline kernel. The open source driver provided by MTK has very bad performance under OpenWrt. In conclusion, it seems that the only choice of operating system is Windows.

Configuring such a network for Windows is very simple too. Right-clicking on the adapter of the wireless network card. Then select the Sharing tab, check Allow other network users to connect etc. Then choose the Ethernet Network Connection option from the dropdown. However, Microsoft has buried a bug in the implementation of network sharing in Windows 10: the network sharing will be broken after restarting the computer. Shared interface still providing DHCP service, but IP Forward is completely unavailable. After reactivate the network connection shareing, the problem can be solved.

So, we only need to prepare a scheduled task running the following PowerShell script to make the OS repeat this operation every time when it is booted:

$NetShare = New-Object -ComObject HNetCfg.HNetShare
$wlan = $null
$ethernet = $null

foreach ($int in $NetShare.EnumEveryConnection) {
  $props = $NetShare.NetConnectionProps.Invoke($int)
  if ($props.Name -eq "WLAN") {
    $wlan = $int;
  }
  if ($props.Name -eq "网桥") {
    $ethernet = $int;
  }
}

$wlanConfig = $NetShare.INetSharingConfigurationForINetConnection.Invoke($wlan);
$ethernetConfig = $NetShare.INetSharingConfigurationForINetConnection.Invoke($ethernet);

$wlanConfig.DisableSharing();
$ethernetConfig.DisableSharing();

$wlanConfig.EnableSharing(0);
$ethernetConfig.EnableSharing(1);

References

  1. NetConnectionSharing (PowerShell Module)