Monthly Archives: November 2012

Prioritizing Network Connection in Windows

Windows somehow gives LAN cable connection priority for connecting to internet. This was a mystery which has boggled me for quite some time. Recently I landed in a scenario where on my laptop I had a LAN cable connection as well as a WiFi connection. Now in this situation both Ethernet and WiFi adapter have got internet access via different ISP and the gateway for both are different. Now I wanted my FTP client to download stuffs via my LAN cable and I wanted my Dropbox client to upload files via my WiFi connection. After spending some time on internet I found out that the only solution that guarantees result is to take control over the metrics of the network adapters. If the metrics of WiFi is made lower than the metrics of Ethernet then Windows OS routes all internet traffic via WiFi. After changing the metrics I checked and confirmed that my Browser and Dropbox applications were using WiFi instead of Ethernet. This seems to be working reliably for now. I performed the following steps:

  1. Open command prompt (type cmd.exe in Start Menu in Win 7 or in Run dialog in Win XP).
  2. Type ncpa.cpl (This will open the network connections windows)
  3. Right click on your Wireless Network Connection adapter (WiFi).
  4. Click on “Properties” in the popup. This will open the properties dialog.
  5. In the properties dialog choose “Internet Protocol Version 4 (TCP/IPv4)”.
  6. Click on “Properties” button. This will open the “Internet Protocol Version 4 (TCP/IPv4) Properties”.
  7. Click on the “Advanced” button. This will open the “Advanced TCP/IP Settings”.
  8. In this dialog uncheck the “Automatic Metric” checkbox.
  9. Type ‘1’ without quotes in the “Interface metric” text field.
  10. Click on OK in this dialog and the underlying dialog to save your changes. Click on “Close” in the properties dialog to conclude this task.
  11. Now in the Network Connections window select your “Local Area Connection” (Ethernet Adapter).
  12. Repeat steps 4 through 10 with the only difference that in step 9 type ‘2’ instead of ‘1’.
  13. That’s it you are done.

The idea is that if you provide a lower metrics to your WiFi and a higher metrics to your LAN/Ethernet adapter then Windows OS will always use your WiFi connection for all Internet traffic. This worked well for me.

Using wget to do high speed HTTP transfer within LAN

Today I needed to transfer contents between my Linux servers using a CAT5 LAN connection. The source server served files via HTTP and also had a FTP server running. I ruled out using FTP for transfer as I wanted to do the transfer via command line recursively so the natural candidate was wget. On the target Linux box I executed the following command to get a good transfer speed:
wget -r -nH –cut-dirs=2 –no-parent –reject=”index.html*”
The speed received was something like this:
Downloaded: 2476 files, 27G in 45m 49s (10.0 MB/s)

This completed the job in a a short while with no residual HTML file being generated in target.