When connecting hosts to the same link level network, they can communicate using link-local address. In IPv4, they are in the range 169.254.0.0/16, in IPv6, fe80::/10 (but the subnet ID is set to 0, so it’s only really fe80::/64). Link-local addresses are not routable: they are only valid in there specific link network.

In IPv4, local link addresses are wacky and avoided in favor of more usual IP assigned manually or by DHCP, and they are not mandatory. This means that unless you a are lucky and both hosts are setup to use local link address, you’ll need a DHCP server on the network or to assign the IP manually.

In IPv6, local link addresses are mandatory and used for other IPv6 (like DHCPv6, or the Neighbor Discovery Protocol). An host will always have a local link address, even if it also have a routable ip. The link address can be assigned manually, or automagically. In any way, an host will always have a local link address, and this is cool. Because link addresses are only unique inside there link network, they cannot by used by an host without a zone index, corresponding to the network interface to use.

TL;DR

If you connect two random devices with an ethernet cable, you have no garanties they will both have an IPv4 address to communicate, but they will both have an IPv6 address! (if the devices implement IPv6 😬).

In practice

A way to find the link local address of an host would be to ping the link-local broadcast address: ff02::1. You will need to specify the interface you want to use: ping -6 -I enp2s0 ff02::1.

Now to use the address, you need to suffix it with the network interface (zone index), on linux it can be the name of the interface, or a number (the number version is the universal representation): ssh fe80::fedc:ba98:7654:3210%enp2s0