Software & AppsOperating SystemLinux

How To Network Two Ubuntu Computers with Ethernet

Ubuntu 8

In this article, we’ll explore how to network two Ubuntu computers using an Ethernet cable. This can be particularly useful for sharing files, printers, or even an Internet connection between two computers. We’ll cover three main methods: using a switch, hub, or crossover cable; using the NetworkManager GUI; and using the command line (nmcli).

Quick Answer

To network two Ubuntu computers with Ethernet, you can use a switch, hub, or crossover cable, manually assign IP addresses, and edit network settings. Alternatively, you can use the NetworkManager GUI to connect the computers and share the connection. Lastly, you can use the command line tool nmcli to add a new Ethernet connection and test the connection.

Networking with a Switch, Hub, or Crossover Cable

This method involves physically connecting the two computers using a switch, hub, or crossover cable. Here are the steps:

  1. Connect the Computers: Connect the two computers using your chosen device. If you’re using a crossover cable, make sure that your hardware supports it. Most modern computers can use a standard Ethernet cable.
  2. Assign IP Addresses: You’ll need to manually assign IP addresses in the same range on both computers. For example, you could use 192.168.1.1 on one computer and 192.168.1.2 on the other.
  3. Edit Network Settings: In Ubuntu, right-click on the network manager applet, then go to “Edit Connections.” Add a new wired connection. Set the method to manual and add the IP address, netmask (usually 255.255.255.0 for a small local network), and gateway (the IP address of the other computer).
  4. Test the Connection: You can test the connection by using the ping command followed by the IP address of the other computer. For example, ping 192.168.1.2.

Networking with the NetworkManager GUI

The NetworkManager GUI provides a user-friendly way to network two computers. Here’s how:

  1. Connect the Computers: Connect the two computers using an Ethernet cable.
  2. Edit Network Settings: On one of the computers, click on the network indicator and select “Edit Connections.” Choose the Ethernet connection and click “Edit.”
  3. Share the Connection: In the IPv4 tab, change the method to “Shared to other computers.” This will allow the second computer to get assigned an IP address from the server and have access to the internet.

Networking with the Command Line (nmcli)

For those who prefer using the command line, nmcli provides a powerful tool for networking. Here’s how:

  1. Connect the Computers: Connect the two computers with an Ethernet cable.
  2. Identify the Ethernet Interface: Determine the Ethernet interface of each computer using the ip addr command. This will display a list of network interfaces along with their IP addresses.
  3. Add a New Connection: Use the nmcli command to add a new Ethernet connection with a specific IP address on each computer. The command would look something like this: nmcli con add type ethernet con-name Connection1 ifname eth0 ip4 192.168.1.1/24. Here, con-name specifies the name of the connection, ifname specifies the interface name, and ip4 specifies the IP address and netmask.
  4. Test the Connection: As before, you can test the connection by pinging the IP address of the other computer.

In conclusion, networking two Ubuntu computers with an Ethernet cable can be accomplished in several ways, each with its own advantages. Whether you prefer a physical device like a switch or hub, the user-friendly NetworkManager GUI, or the powerful command line tool nmcli, Ubuntu provides the tools you need to get connected.

Can I network two Ubuntu computers using a regular Ethernet cable?

Yes, most modern computers can use a standard Ethernet cable for networking. However, if you’re using a crossover cable, make sure that your hardware supports it.

How do I assign IP addresses to the two Ubuntu computers?

You’ll need to manually assign IP addresses in the same range on both computers. For example, you could use 192.168.1.1 on one computer and 192.168.1.2 on the other.

Leave a Comment

Your email address will not be published. Required fields are marked *