How To Connect Two Ubuntu Computers Via Lan Cable

How do I connect two computers with Ubuntu?

To connect two computer’s with a LAN cable in ubuntu “you’ll need a crossover network cable and have to do a few manual things in network connection settings.

How to Connect Two Ubuntu Machines Via Lan Cable?

You will need to manually assign an IP address in the same range. The following steps assume you are using the standard Unity interface. Repeat these steps for each computer machine.

  • Click the Network indicator on the Unity panel (top right).
  • From the drop-down, select Edit Connections…
connecting-ubuntu-machines-via-direct-lan-cable-configuration
Click on Add
  • In the Network Connections dialog box, click the Add button.
  • When prompted to choose a connection type, choose Ethernet, and click the Create… button.
click-create-after-selecting-ethernet-on-ubuntu-networking
Choose Connection Type
  • Name your connection “Lan A” to differentiate from a typical Ethernet connection.
ename-lan-connection-network-connect-two-ubuntu-computers-via-lan-step-3
Renaming Ethernet Connection
  • Switch to the IPv4 Settings tab.
swithc-to-ipv4-tab-and-change-automatic-to-manual-ip-addressing
Choose Manual Addressing
  • Change the Method to Manual.
  • Click the Add button to add an IP address.
configure-netmask-gateway-ip-addressing
Giving Manual Addressing To “Machine A”

Do the same process above to “Machine B” & edit the IP last one digit as shown below in examples:

  • Example settings for Machine #A:
    • Address: 192.168.0.11
    • Netmask: 255.255.255.0
    • Gateway: 192.168.0.1
  • Example settings for Machine #B:
    • Address: 192.168.0.22
    • Netmask: 255.255.255.0
    • Gateway: 192.168.0.1

The addresses 192.168.0.11 and 192.168.0.22 cannot talk to each other if you use the subnet 255.255.255.0. Notice the third octet (number) of your IP addresses is different, in the answer you linked to they are the same.

After Giving settings to both machines, you need to check if they are pinging each other. Open the terminal in Machine A and give the command “ping 192.168.0.22“, and you’ll see the successful connection between “Machine A” & “Machine B”. Now next step is to share files between them.

How To Share Files Between Two Ubuntu Machines Via Lan Cable?

To share files on any network you’ll need a file-sharing software “samba“, you have to install samba manually. It’s not come in any version of ubuntu Pre-Installed.

  1. Open Terminal by pressing keys “CTRL+ALT+T”.
  2. Enter the command below
sudo apt install samba
enter-sudo-password-for-user
Install Command For Samba
  • 3. Then type the password for the user and hit enter.
samba-package-information-to-be-install
Installing Samba

After completing this samba will be successfully installed on your machine. Do the same steps on both machines. Now time to create a username and password for file transmission and bypass in samba file sharing.

How to Create Samba Username And Password?

Enter the following commands on both machines under different conditions. Choose two usernames for both machines, like for “Machine A” username is “mac1” and for “Machine B” username is “mac2“. But here I am using hpoo61 for my computer machine.

  • 1. Open Terminal by pressing keys “CTRL+ALT+T”.
  • 2. enter the command below
sudo smbpasswd -a "username"

Here I am using “hp0061” as my username. you can replace it with your own.

creating-user-in-samba-environment
  • 3. Enter a new password for user “hp0061” And then retype your password again & press enter.
password-set-successfully-for-samba-user
Username & Password Created Successfully

After creating a username and password for the samba file sharing tool, now it’s time to share files from one ubuntu machine to another ubuntu machine.

Share & Transfer Files between 2 Ubuntu Computers.

How can I transfer data from one laptop to another using a LAN cable in Ubuntu?

First, you have to choose a folder or directory of which you want to share files to another machine. Open that folder and do the following steps:

  • 1. Click Right-Click and Open “Properties” of that folder.
samba-file-properties-local-share-tab-in-ubunut
Samba Folder Share Properties
  • 2. Go to the “Local Network Share” tab
  • 3. Click & Check to the “Share this folder” & enter share name of the folder.
  • 4. Click & Check to the “Allow others to create and delete files in this folder“.
  • 5. Now click “Create Share
sharing-the-folder-to-local-network-via-lan-connection-samba-sharing-service
Creating Share
  • 6. Now click “Add the permissions automatically”.
adding-automatic-permissions-by-nautilus-to-samba-share-folder
Add Permissions To Samba Share

The file share is successfully created you can modify these settings later anytime.

samba-folder-share-created-ubuntu-local-network-share

Now if the folder share is created on “Machine A” you can access that folder from “Machine B” with the following steps given below. And if you want to access the data from “Machine B” To “Machine A” so you have to create the folder share from Machine B with the same steps given above.

  • 1. Go to “Files
  • 2. Click on “Connect to server
  • 3. Enter the IP Address of Machine you want to connect “smb://____/”
smb://ip-address/
connect-to-server-ubuntu-samba-share-with-local-ip-address
Connecting Local IP Samba Share
  • 4. Now click “Connect
entering-username-password-with-workgruop-samba-share-in-ubuntu
Connecting As User
  • 5. Enter the Username, Domain and Password & then click “Connect“.

Here you have to enter the Username and Password of the Computer Machine that you want to connect to. For example, if you are trying to access “Machine B” files from “Machine A” then you have to enter the Username & Password of Machine B”

folder-sharing-success-ubuntu-local-area-network-with-lan-cable
Network Share Success

Here’s the “Connect Two Ubuntu Computers Via Lan” Connection Successfully Established & File Sharing Access from one Computer Machine To Another Computer Machine Via Lan Cable In Ubuntu Linux.

Also, check related to this:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.