Debian - Connect 2 hosts over Ethernet

If you want to transfer data between 2 hosts, then you can connect both with a standard Ethernet network cable, just connect the cable between the network ports.

Then manually set IP:s on the interfaces.

Install ifconfig: apt-get install net-tools

On both hosts make sure Network Manager does not try to manage the devices:
nmcli device set eth0 managed false

To turn on again replace false with true

If you need to make these changes permanent, then change /etc/interfaces.

Then on the first host:
ifconfig eth0 192.168.2.1

And on the second host:
ifconfig eth0 192.168.2.2

You can now try to ping one host from the other, for example:
ping 192.168.2.2

Another useful tool to check status like link speed is ethtool:
ethtool eth0

References:
https://unix.stackexchange.com/questions/73928/telling-network-manager-to-temporarily-ignore-a-network-device


Share Internet over the cable


Then follow this:
https://askubuntu.com/questions/50194/sharing-internet-between-network-interfaces

1. Make sure that both connections are managed by Network manager:
nmcli device set eth0 managed true

On the host that has the connection to share:
2. Click on the network icon in the panel, and select Edit connections
3. In the dialog that appears, select the wired interface connected to the other host and click Edit.
4. In the IPv4-settings pane in the new dialog, you can select Method: "Shared with other computers".

This is a personal note. Last updated: 2023-12-25 02:04:28.



GitHub

My

GitLab

My

LinkedIn

My

Klebe.se

Don't forget to pay my friend a visit too. Joakim