Note that this was only tested on certain combinations like this (Windows 7 with iOS 8), this (Windows 7 with iOS 7), this and this (Windows 7 with iOS 9.3.2 (iphone 6s)). Windows 7 seems a possible Windows OS that can work. Recently, I tested it on Windows 8 and iOS 9. Unfortunately, it did not work. It seems iOS or Windows has changed its way configuring the network. So, if you are using newer OSes, an Ad-hoc wifi hotspot from your PC may be easier to set up to share the Internet connection of your PC to your iPhone.
It is common and straightforward to make PC to use iPhone’s GPRS, 3G or 4G Internet connection through the USB cable. Now during the spring festival in the country, I am facing the problem that I am wanting to make my iPhone use the PC’s Internet connection.
There is no router by hand and what I have is only the iPhone and USB cable. The PC is an old one with Windows XP installed.
Finally, I figured out a way to make iPhone connect to the Internet through the iPhone’s USB cable to the PC Internet connection.
iPhone <--USB--> PC <----> Internet
How to share the Internet of PC to iPhone through USB Cable
The method here is tested on iPhone 6 with iOS 8.1.3 and Windows 7 / Windows XP.
Step 1, disable the adapter for Internet connection in Windows.
Step 2, connect the iPhone to the PC by a USB cable.
Step 3, in the iPhone "personal hotspot" settings, enable "USB only" Internet sharing.
A new adapter in Windows will appear ("Local Area Connection 2" here).
Step 4, in the property of the adapter for Internet in Windows, enable "Internet Connection Sharing".
In the "Settings", select the needed services.
Step 5, re-enable the adapter for Internet in Windows.
Now, visit the Who am I service in your iPhone and check whether your IP is from the Internet provider for your PC.
Why and how does this work
Following is just my guess since both Windows and iOS are closed systems. For easier to understand, I name the adapters as follows.
iPhone tun0 <--USB--> tun1 PC eth0 <----> Internet
After Step 1, the Windows routing table is cleared. After Step 2 and Step 3, both tun0 and tun1 are created and the network packets are forwarded between each other.
iPhone tun0 <--USB--> tun1 PC
Step 4 makes sure that network packets can be forwarded from tun1 to eth0 by Windows. Re-enabling eth0 in Step 5 set up the routing table as we needed.
tun1 =PC=> eth0
The final path for the packet routing will be as follows.
tun0 --> tun1 --> eth0 --> Internet