Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm looking for a way to directly connect my Windows 7 laptop and my headless Ubuntu 10.04 server. (Desktop edition is installed, for my own reasons.) I have a regular Ethernet cable. My problem is that I keep trying to use Windows Backup to a shared folder on Ubuntu, but the wifi connection keeps dropping intermittently for all my devices at the same time before the backup completes. I want to use the cable to connect the two computers directly, independent of whether or not they're connected to wifi. This will create a much more reliable connection, and it will allow the backup to complete without worrying about the wifi dropping.

It would be best if I could create this connection using an ad-hoc network (or similar) on Windows 7 without touching the configuration on the Ubuntu server, as the server has no input devices or displays connected to it. I mostly access it through SSH and sometimes VNC, and if the connection is lost, the only thing I can do to get it back is a hard reboot.

So the current configuration is this:

Windows 7-------wireless-----\
                              \
                               Wifi router
                              /
Ubuntu 10.04----wireless-----/

But I want it to be like this:

Windows 7-------wireless-----\
   |                          \
   |cable                      Wifi router
   |                          /
Ubuntu 10.04----wireless-----/
share|improve this question
    
What happens when you plug them in using a cross over cable? –  dbasnett Jul 5 '11 at 19:55

3 Answers 3

Most modern computers come with an ethernet adapter that has the capability to connect to another ethernet adapter without a crossover cable. This is called Auto-MDIX. Simply connect the network interface from one computer to the network interface on the other computer.

Once they're plugged in, there might be some sort of automatically-configured network setup. That may work in some cases, but not others. For fun and extra credit, let's create a new subnet for you to use just between the two computers.

First, we need to pick a "subnet" to use. It's easiest to use one different from your internal network. Let's choose 192.168.253.0/24. When you connect the two systems together, you'll need to give each system an IP address, as well as configure host names. Make sure you're configuring the wired, ethernet interface and not the wireless interface. All of this configuration can be done through the GUI.

Here's your network configuration for the Windows machine ("Use the following IP address"):

IP Address: 192.168.253.1

Subnet Mask: 255.255.255.0

Default Gateway: blank

While we're at it, don't configure DNS either, we'll do that later.

Here's your network configuration for the Ubuntu machine (Probably want to use some sort of "static" option, not sure on Ubuntu...)

IP Address: 192.168.253.2

Subnet Mask: 255.255.255.0

Default Gateway: blank

If everything's hooked up, you should be able to address each computer by their respective IP addresses. This lets you ensure that you are connecting to the wired, and not wireless interface. If you want to add hostname resolution, let's just make a change to the hosts file:

On Windows:

edit %SystemRoot%\system32\drivers\etc\hosts, notepad will do.

Add the following line:

192.168.253.2 ubuntu-wired

You can replace ubuntu-wired with whatever name you want to use for that system.

And save.

On Linux:

edit /etc/hosts, you'll need to do this as root with sudo or su.

Add the following line:

192.168.253.1 windows-wired

To test whether this works, ping each system using the name. The syntax is the same on both OSes. Open up a terminal window, and run the following:

ping HOSTNAME, where HOSTNAME is the name you used above for the opposite machine.

share|improve this answer
    
Very good post, +1 –  maxmackie Jul 7 '11 at 15:02
up vote 4 down vote accepted

Actually, I did some more poking around and found some answers myself, and it's really easy. There are two ways to do it: share the connection from Windows to Ubuntu, or from Ubuntu to Windows. Importantly, only one of these will work at a time, but doing both won't break anything. It just won't share the connection until you reverse one of them.

Windows 7 as the host

To share a wifi connection over ethernet directly to another computer from Windows 7:

  1. Open Network and Sharing Center.
  2. Right click Wireless Network Connection, click Properties.
  3. Click on the Sharing tab.
  4. Check the box next to "Allow other network users to connect through this computer's Internet connection."
  5. Click OK.
  6. Plug the Ethernet cable into both computers.

Ubuntu 10.04 as the host

To share a wifi connection over ethernet directly to another computer from Ubuntu 10.04:

  1. Right click on the Network Manager applet, click Edit Connections...
  2. In the Wired tab, click Auto eth0, then click Edit...
  3. In the IPv4 Settings tab, change Method: to Shared to other computers.
  4. Click Apply and enter your password when it asks you.
  5. Close everything and reboot.
  6. Plug the Ethernet cable into both computers.

Now both computers should have IP addresses different from those assigned by the wireless router, regardless of whether the host computer is connected to wifi. The host computer should have an IP address ending in .1, and the guest computer should have an automatically assigned address.

share|improve this answer

Actually, you don't even need a crossover cable. Modern year 2000-ish network cards can support switching without a crossover cable; it's all internal.

Just plug-em' in and go. All of the networking will be automatically handled.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.