26 C
Texas
Mel K
LInux Guru and Technical Writer

How to use the Link-Local Address of IPv6

I switched interest in trying IPv6 at home since my ISP provides the option to switch to IPv6. all my services and tests now are now bese on IPv6. In this small article i will show how to use IPv6 in your Environments.

in my examle i have two centos 7 machines  with IPv4 and ipv6 enabled

machine 1:

[root@rhce1 ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
 inet 192.168.65.133 netmask 255.255.255.0 broadcast 192.168.65.255
 inet6 fe80::8505:a707:7a1a:65f9 prefixlen 64 scopeid 0x20<link>
 ether 00:0c:29:1e:89:e2 txqueuelen 1000 (Ethernet)
 RX packets 4792 bytes 417242 (407.4 KiB)
 RX errors 0 dropped 0 overruns 0 frame 0
 TX packets 5042 bytes 2850268 (2.7 MiB)
 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
 ether 00:0c:29:1e:89:ec txqueuelen 1000 (Ethernet)
 RX packets 251 bytes 25178 (24.5 KiB)
 RX errors 0 dropped 0 overruns 0 frame 0
 TX packets 52 bytes 4250 (4.1 KiB)
 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
 ether 00:0c:29:1e:89:ec txqueuelen 1000 (Ethernet)
 RX packets 53 bytes 4734 (4.6 KiB)
 RX errors 0 dropped 0 overruns 0 frame 0
 TX packets 0 bytes 0 (0.0 B)
 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
 inet 127.0.0.1 netmask 255.0.0.0
 inet6 ::1 prefixlen 128 scopeid 0x10<host>
 loop txqueuelen 1 (Local Loopback)
 RX packets 0 bytes 0 (0.0 B)
 RX errors 0 dropped 0 overruns 0 frame 0
 TX packets 0 bytes 0 (0.0 B)
 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

team0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
 inet 192.168.65.199 netmask 255.255.255.0 broadcast 192.168.65.255
 inet6 fe80::9e6d:e33c:c69f:8ae6 prefixlen 64 scopeid 0x20<link>
 ether 00:0c:29:1e:89:ec txqueuelen 1000 (Ethernet)
 RX packets 47 bytes 3400 (3.3 KiB)
 RX errors 0 dropped 0 overruns 0 frame 0
 TX packets 36 bytes 2864 (2.7 KiB)
 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

machine2

- Advertisement -
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
 inet 192.168.65.131 netmask 255.255.255.0 broadcast 192.168.65.255
 inet6 fe80::6a46:67bf:c4d8:d352 prefixlen 64 scopeid 0x20<link>
 ether 00:0c:29:35:9c:ac txqueuelen 1000 (Ethernet)
 RX packets 19648 bytes 24708664 (23.5 MiB)
 RX errors 0 dropped 0 overruns 0 frame 0
 TX packets 6305 bytes 523916 (511.6 KiB)
 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
 inet 127.0.0.1 netmask 255.0.0.0
 inet6 ::1 prefixlen 128 scopeid 0x10<host>
 loop txqueuelen 1 (Local Loopback)
 RX packets 4 bytes 416 (416.0 B)
 RX errors 0 dropped 0 overruns 0 frame 0
 TX packets 4 bytes 416 (416.0 B)
 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Ping:

The command ping is normally used for Ipv4 Ip addresses . For IPv6 there is another command called ping6

lets Try to ping from machine 1 to machine 2 :

machine1>#ping6 ping6 fe80::6a46:67bf:c4d8:d352

[root@rhce1 ~]# ping6 fe80::6a46:67bf:c4d8:d352
connect: Invalid argument
[root@rhce1 ~]#

Dont panic.  for ping6 you have to mention witch device you want to use :

[root@rhce1 ~]# ping6 -I eth0 fe80::6a46:67bf:c4d8:d352
PING fe80::6a46:67bf:c4d8:d352(fe80::6a46:67bf:c4d8:d352) from fe80::8505:a707:7a1a:65f9%eth0 eth0: 56 data bytes
64 bytes from fe80::6a46:67bf:c4d8:d352%eth0: icmp_seq=1 ttl=64 time=0.404 ms
64 bytes from fe80::6a46:67bf:c4d8:d352%eth0: icmp_seq=2 ttl=64 time=0.844 ms
64 bytes from fe80::6a46:67bf:c4d8:d352%eth0: icmp_seq=3 ttl=64 time=0.818 ms
64 bytes from fe80::6a46:67bf:c4d8:d352%eth0: icmp_seq=4 ttl=64 time=0.812 ms
64 bytes from fe80::6a46:67bf:c4d8:d352%eth0: icmp_seq=5 ttl=64 time=0.841 ms
^C
--- fe80::6a46:67bf:c4d8:d352 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4014ms
rtt min/avg/max/mdev = 0.404/0.743/0.844/0.173 ms
[root@rhce1 ~]#

SSH

How to connect to ssh server via IPv6

Lets try to connect from machine1 to machine2

ssh  IPv6%device

[root@rhce1 ~]# ssh fe80::6a46:67bf:c4d8:d352%eth0
The authenticity of host 'fe80::6a46:67bf:c4d8:d352%eth0 (fe80::6a46:67bf:c4d8:d352%eth0)' can't be established.
ECDSA key fingerprint is SHA256:VGMuXxxtpktML210BoxvwgK6OIrCD028Xl7ncZw4y5M.
ECDSA key fingerprint is MD5:51:56:ba:f7:45:26:1e:20:23:b5:52:11:5f:65:3b:56.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'fe80::6a46:67bf:c4d8:d352%eth0' (ECDSA) to the list of known hosts.
root@fe80::6a46:67bf:c4d8:d352%eth0's password:
Last login: Wed Feb 7 14:06:12 2018 from 192.168.65.1

Netstat

You can use this command  to see what  are services listening on tcp6

From another machine you can use telnet to check if services listening

with telnet  Ipv6%DEVICE  port:

[root@rhce1 ~]# telnet fe80::6a46:67bf:c4d8:d352%eth0 22
Trying fe80::6a46:67bf:c4d8:d352%eth0...
Connected to fe80::6a46:67bf:c4d8:d352%eth0.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.4

Please enjoy this small artilce and let us know if you need  any help.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article