上QQ阅读APP看书,第一时间看更新
SSHing to an IPv6 address
IPv6 addresses look a lot more imposing than they really are, and it's advisable that you get to grips with them sooner rather than later (even if people have been predicting the dominance of IPv6 for over a decade now).
For this example, we're going to find the IPv6 address of centos2 and connect to that.
First, connect to centos2 and run the ip a command:
[vagrant@centos2 ~]$ ip a
<SNIP>
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:56:c5:a7 brd ff:ff:ff:ff:ff:ff
inet 192.168.33.11/24 brd 192.168.33.255 scope global noprefixroute eth1
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe56:c5a7/64 scope link
valid_lft forever preferred_lft forever
I've highlighted the IPv6 address in the preceding code.
Back on centos1, let's connect using IPv6:
[vagrant@centos1 ~]$ ssh fe80::a00:27ff:fe56:c5a7%eth1
Enter passphrase for key '/home/vagrant/.ssh/id_rsa':
Last login: Wed Aug 8 11:44:34 2018 from 192.168.33.10
[vagrant@centos2 ~]$
Note that we've had to specify the network interface on the end of our command. This is only necessary in the case of link-local addresses, and shouldn't be necessary for global IPv6 addresses.
A comparison to link-local addresses in the IPv6 world are subnets in the IPv4 world, that is, link-local devices are those that can see each other on a local network, via their link-local addresses (which themselves are generated based on factors like the MAC address of the interface that the address is on). They should always have the link-local prefix ( FE80::/10).