Thursday, August 30, 2012

Internet access through another PC via a crossover cable

 Intro

   Yesterday I decided to connect my laptop to the internet through my desktop computer, main reason for that being the fact that my wireless router is hitting it's ceiling and having problems maintaining so many Wi-Fi clients.



Both of them have Ethernet cards, the laptop however also has Debian OS on it, rather than Windows OS. There is, surprisingly, NO concise articles on how to connect Debian through Win7 via a crossover cable to the Wi-Fi. This article will not only tell you how to do that, but will also explain to you what you are doing and why. It could be not just a Debian, but any PC.

Wanted Setup

First, decide for yourself, how you what to connect and what. My setup looks like this

Wi-Fi - - - - - - Win7 = = = = = = Debian


- - - - -
Being wireless conn and

= = = =
Being crossover cable connection

NOTE: if you don't have a crossover cable, a regular CAT5 (i.e. UTP) will do instead. In my searches I have discovered that majority of the newer Ethernet cards can "adapt" a normal cable to a crossover automatically. Regardless of what cable you use, I will further refer to it as a "crossover cable".

Hardware Time

1. Turn on Win7 PC and connect to the wireless normally. This article assumes you already know how to do that.
2. Turn on Debian PC and connect both computers with a crossover cable.

Win7 Config

3. On Win7 go to Control Panel > Network and Internet > Network Connections. If you can't find the path, search for "network" and select "View network connections".
4. There will be 2 active connections, one wired and one wireless, active on that screen. There might also be multiple inactive connections - disregard those.
5. Note which conn-s are active.
6. Disconnect the cable on one of the computers. Once you do that, the wired connection should change to show that it's disconnected.
7. Select the wired connection and go into properties
8. On the "Network" tab select "Internet Protocol Version 4" and go into "Properties"
9. Switch the radial button to "Use the following IP address:", it tells computer that you will set everything manually.
FORK: At this point you need some information form your Router/Internet connection. If you know it, go to step 10. If you don't know it, press windows button, in the search field type "cmd", press Enter. This is your Command Prompt allowing you to access everything faster by typing stuff.

Type "ipconfig /all", Enter, scroll to the paragraph saying "Wireless LAN adapter"(this is your active wireless connection) and note the following lines:
- - IPv4 Address
- - Subnet Mask
- - Default Gateway
- - DNS Servers

10. Enter all noted information into the appropriate fields in the manual IP setup and press OK, disregard(Press OK) any warnings.
11. Press OK again to save and get out of Connection properties.
12. Now you need to create a Network Bridge. Select both the inactive Wired connection and the Wireless one, right click them and select "Create Network Bridge". What it does is it creates a "seamless" connection between 2 networks. Wait while Win7 creates and configures the bridge.

Debian Config

13. Plug the disconnected cable back in. So now you've connected Debian to the internet through Win7, and if it works right away then enjoy it! But MOST probably your Debian computer just doesn't know how to use this connection (mine didn't), so we have to set it up manually.

14. Go to your Network Connections (located in System > Preferences)
15. In the "Wired" tab you will see a connection that looks like "eth0", press Edit.
16. Go to "IPv4 Settings" tab
17. Select "Manual" in the "Method"
18. In the Addresses box, click on the Address and type in an available IP, that isn't being used in your Wi-Fi WAN. Usually your WAN network Addresses would be like this one 192.168.1.101 - make sure your Address is AT LEAST 192.168.1.102, as apparently .101 is being silently reserved for the bridge/crossover communication.
19. For Netmask use Subnet Mask value from step 9,
20. For Gateway value use Default Gateway value from step 9,
21. DNS Servers for DNS Servers.

All this info your computer will use to connect to your router and consequently to the internet through Win7. Because, you see, even though the connection is bridged, your Debian system still thinks it's in it's own little LAN and has no idea about your Gateway/IP setups/etc in your wireless network.

22. Press Apply and you should be able to connect to the internets right away!


P.S. Any questions/comments can be left in the comments section.

1 comment:

Unknown said...

Wow it works very well. I'm looking for this solution over the web for almost 2 days and now I found it. It works on my windows 7 laptop and windows 7 desktop..

Thank you so much man. It helps me a lot. You're a life savior.