Configure network interface for direct connection

7,803

Solution 1

The solution is to configure both sides as a static connection.

On the headless side in /etc/network/interfaces put:

auto eth0
iface eth0 inet static
    address 192.168.1.100
    gateway 192.168.1.254
    netmask 255.255.255.0

On the Ubuntu desktop side, configure a static connection in the network-manager, but with a different address (in the same network range).

Solution 2

To connect two ethernet LAN card interfaces together, at least one of them must support Auto-MDIX, or you will need a cross-over ethernet cable. This is a special cable which connects the "TRANSMIT" lines of one LAN card interface to the "RECEIVE" lines of the other and vice versa. However if at least one of the two cards supports Auto-MDIX, then the cross-over function will be taken care of automatically.

If you care about the exact hardware, here is what wikipedia says about ethernet crossover cables

If the cable (or the Auto-MDIX) is not the problem then configure static addresses and appropriate netmasks and try to ping each other's ip addresses to confirm the link works. As there is (probably) no DNS service running you will need to refer to each computer by its ip address.

Share:
7,803

Related videos on Youtube

Alex
Author by

Alex

Updated on September 18, 2022

Comments

  • Alex
    Alex over 1 year

    I need to connect two Ubuntu machines directly via ethernet (i.e., no switch or router between them).

    One of them is running Ubuntu Desktop, so I am happy to use the network manager for that. The other one is using Ubuntu Core, so the configuration will need to be done in /etc/network/interfaces.

    What is the appropriate configuration on each side?

    • Alex
      Alex about 10 years
      This wasn't working for me because I had an error in my static IP configuration.
    • web.learner
      web.learner about 10 years
      What is "this"?
    • Alex
      Alex about 10 years
      Sorry. The direct connection using static IP addresses was not working, but only because I had en error in my configuration. The approach of setting static IP addresses on both sides was the correct approach.
  • Alex
    Alex about 10 years
    I believe the cards are capable of operating without a cross-over cable, as it has been done before with these machines.