Connect via an Ethernet Cable

Posted on Fri 29 November 2019 in study

Hardware Part

Connect 2 computers with an Ethernet cable.

I used a CAT-7. After plugging in on both sides, only one side's blinking lights were on, though it worked well for communication anyway.

Software Part

Set up static IP addresses under one same subnet.

Shortly after cable plugged in, both sides got IP and route table automatically thanks to APIPA.

On computer A:

$ ip a s enp0s25
...
inet 169.254.156.34/16 brd 169.254.255.255 scope global noprefixroute enp0s25
  valid_lft forever ptrferred_lft forever
...

$ ip r
169.254.0.0/16 dev enp0s25 scope link src 169.254.156.34 metric 203
...

On computer B:

$ ip a s enp2s0
...
inet 169.254.153.19/16 brd 169.254.255.255 scope global noprefixroute enp2s0
  valid_lft forever ptrferred_lft forever
...

$ ip r
default dev enp2s0 scope link src 169.254.153.19 metric 202
169.254.0.0/16 dev enp2s0 scope link src 169.254.153.19 metric 202

Configure IP and routing by ifconfig, ip, route, etc.

Check connection by arping, ping, etc.

Sidenotes

If more than one interface is on, use -I to specify one for (ar)ping.

If interface specification is wanted for ssh, maybe use -b param. (see here)

If bi-directional arping works but ping fails, check route table setup.