Usually we struggle through the process of making login in the Raspberry Pi using ssh
or other similar tools. But we can make the process more pleasent.
Once your Raspberry Pi is connected to a network it gets an IPv4 address and an IPv6 address, that is based on the NIC's MAC address. The good thing about this is that the IPv6 address doesn't change even if the network has a DHCP service.
That being said, let's discover our IPv6 address. You only need to login once using IPv4 or using a monitor (HDMI or VGA). Open a terminal and type:
ifconfig
You will see something like:
eth0 Link encap:Ethernet HWaddr 00:1C:C0:AE:B5:E6
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::21c:c0ff:feae:b5e6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:41620 errors:0 dropped:0 overruns:0 frame:0
TX packets:40231 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:21601203 (20.6 MiB) TX bytes:6145876 (5.8 MiB)
Interrupt:21 Base address:0xe000
As you can see your IPv4 would look like 192.168.0.1
and your IPv6 would be fe80::21c:c0ff:feae:b5e6
(notice the line that starts with inet6 addr
).
So, with this information you can login using the ssh
command with the following syntax:
ssh -6 pi@fe80::21c:c0ff:feae:b5e6%eth0
This approach seems more complicated, but the IPv6 address is defined as the link local
, and, as it is based on the MAC address, unless you change it yourself, this will always work regardless of your IPv4 address.