Skip to main content

Work with IPv6 on Ubuntu 16.04

IPv6 is enable in Ubuntu by default, but I have found that without experiece you can spend a lot of time to find information for IPv6 network configuration  and operation.

How to change IP address permanently

Make changes in  file /etc/network/interfaces

iface ens4 inet static
 address 192.168.0.254
 netmask 255.255.255.0
 gateway 192.168.0.1

iface ens4 inet6 static 
 address 2001:db8::254
 netmask 64
 gateway 2001:db8::1

Temporary IPv6 Address Assignment

stack@devstack# ip address add 2001:db8::254/64 dev ens4 

Temporary IPv6 Address Deletion

stack@devstack# ip address del 2001:db8::254/64 dev ens4

Verify IPv6 address configuration

stack@devstack# ip address dev ens4
3: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000


    link/ether 00:50:00:00:04:01 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.254/24 brd 192.168.0.255 scope global ens4
       valid_lft forever preferred_lft forever
    inet6 2001:db8::254/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::250:ff:fe00:401/64 scope link 
       valid_lft forever preferred_lft forever

Usefull options for command ip address show

Abbreviations: show, list, lst, ls, l
Arguments: 
dev NAME (default) --- name of the device.
scope SCOPE_VAL --- list only addresses with this scope.
to PREFIX --- list only addresses matching this prefix.
primary / secondary --- list only primary (or secondary) addresses.

Note:For the full list of arguments please check documentation for iproute2 http://www.policyrouting.org/iproute2.doc.html

stack@devstack$ ip address list dynamic
3: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:50:00:00:04:01 brd ff:ff:ff:ff:ff:ff
    inet6 2001:db8::250:ff:fe00:401/64 scope global mngtmpaddr dynamic
       valid_lft 2588545sec preferred_lft 601345sec


stack@devstack$ ip address list scope link
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:50:00:00:04:00 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::250:ff:fe00:400/64 scope link
       valid_lft forever preferred_lft forever
3: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:50:00:00:04:01 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::250:ff:fe00:401/64 scope link
       valid_lft forever preferred_lft forever

Verify IPv4 routes

command "ip route show"

stack@devstack$ ip route show
default via 192.168.122.1 dev ens3 
192.168.0.0/24 dev ens4  proto kernel  scope link  src 192.168.0.254 
192.168.122.0/24 dev ens3  proto kernel  scope link  src 192.168.122.234 

command "route -4" or "route -A inet"

stack@devstack$ route -4
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         ubuntu          0.0.0.0         UG    0      0        0 ens3
192.168.0.0     *               255.255.255.0   U     0      0        0 ens4
192.168.122.0   *               255.255.255.0   U     0      0        0 ens3

Verify IPv6 routes

command "ip -6 route show"

stack@devstack# ip -6 route show
2001:db8::/64 dev ens4  proto kernel  metric 256  pref medium
fe80::/64 dev ens4  proto kernel  metric 256  pref medium
fe80::/64 dev ens3  proto kernel  metric 256  pref medium
default via fe80::a8bb:ccff:fe00:1000 dev ens4  proto ra  metric 1024  expires 1719sec hoplimit 64 pref medium

command "route -6" or "route -A inet6"

stack@devstack$ route -6
Kernel IPv6 routing table
Destination                    Next Hop                   Flag Met Ref Use If
2001:db8::/64                  ::                         U    256 1    54 ens4
fe80::/64                      ::                         U    256 0     0 ens4
fe80::/64                      ::                         U    256 0     0 ens3
::/0                           fe80::a8bb:ccff:fe00:1000  UGDAe 1024 1    29 ens4
::/0                           ::                         !n   -1  1    86 lo
::1/128                        ::                         Un   0   2     3 lo
2001:db8::254/128              ::                         Un   0   2    55 lo
fe80::250:ff:fe00:400/128      ::                         Un   0   1     0 lo
fe80::250:ff:fe00:401/128      ::                         Un   0   2    37 lo
ff00::/8                       ::                         U    256 1    16 ens4
ff00::/8                       ::                         U    256 0     0 ens3
::/0                           ::                         !n   -1  1    86 lo

Check IPv6 connectivity

stack@devstack$ ping6 -n -c 4 s1.lab.local
PING s1.lab.local(2001:db8::1) 56 data bytes
64 bytes from 2001:db8::1: icmp_seq=1 ttl=64 time=2.52 ms
64 bytes from 2001:db8::1: icmp_seq=2 ttl=64 time=11.3 ms
64 bytes from 2001:db8::1: icmp_seq=3 ttl=64 time=3.53 ms
64 bytes from 2001:db8::1: icmp_seq=4 ttl=64 time=3.91 ms

--- s1.lab.local ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3007ms
rtt min/avg/max/mdev = 2.526/5.321/11.318/3.499 ms

stack@devstack$ traceroute -n -6 -I ipv6.google.com
traceroute to ipv6.google.com (2a00:1450:4013:c01::66), 30 hops max, 80 byte packets
 1  2a04:XXXX:1::1  11.684 ms  11.758 ms  11.753 ms
 2  2a04:XXXX:0:103::1  0.978 ms  0.980 ms  0.977 ms
 3  2001:1900:5:2:2::1939  11.640 ms  11.637 ms  11.633 ms
 4  2001:1900:104:8::8  11.629 ms  11.699 ms  11.696 ms
 5  2001:1900:5:3::276  11.692 ms  11.688 ms  11.683 ms
 6  2001:4860::1:0:abf6  11.681 ms  10.735 ms  10.721 ms
 7  2001:4860::8:0:abf1  10.705 ms  3.051 ms  3.036 ms
 8  2001:4860::8:0:8f8e  5.778 ms  5.768 ms  5.756 ms
 9  2001:4860::8:0:519f  9.570 ms  9.562 ms  9.544 ms
10  2001:4860::8:0:519e  23.371 ms  23.363 ms  12.068 ms
11  2001:4860::2:0:8652  12.659 ms  12.637 ms  12.625 ms
12  2a00:1450:4013:c01::66  12.339 ms  12.445 ms  12.426 ms

Verify IP ARP cache


You can use classical arp command
stack@devstack$ arp -a
veos1 (192.168.0.3) at 50:00:00:05:00:00 [ether] on ens4
vmx1 (192.168.0.5) at 50:00:00:07:00:00 [ether] on ens4
ubuntu (192.168.122.1) at 52:54:00:a6:11:ac [ether] on ens3
veos2 (192.168.0.4) at 50:00:00:06:00:00 [ether] on ens4
vmx2 (192.168.0.6) at 50:00:00:03:00:00 [ether] on ens4

You can also use new ip command to check ARP cache status
stack@devstack$ ip -4 neighbor show
192.168.0.3 dev ens4 lladdr 50:00:00:05:00:00 STALE
192.168.0.5 dev ens4 lladdr 50:00:00:07:00:00 STALE
192.168.122.1 dev ens3 lladdr 52:54:00:a6:11:ac REACHABLE
192.168.0.4 dev ens4 lladdr 50:00:00:06:00:00 STALE
192.168.0.6 dev ens4 lladdr 50:00:00:03:00:00 STALE

Verify IPv6 neighbor cache

stack@devstack$ ip -6 neighbor show
2001:db8::5 dev ens4  FAILED
fe80::a8bb:ccff:fe00:1000 dev ens4 lladdr aa:bb:cc:00:10:00 router STALE
2001:db8::4 dev ens4 lladdr 50:00:00:06:00:00 router STALE
2001:db8::3 dev ens4 lladdr 50:00:00:05:00:00 router STALE
2001:db8::2 dev ens4 lladdr aa:bb:cc:00:10:00 router STALE
fe80::5200:ff:fe06:0 dev ens4 lladdr 50:00:00:06:00:00 router STALE
fe80::5200:ff:fe05:0 dev ens4 lladdr 50:00:00:05:00:00 router STALE
2001:db8::1 dev ens4 lladdr 50:00:00:02:00:00 STALE
2001:db8::6 dev ens4 lladdr 50:00:00:03:00:00 router STALE

Monitoring

The ip utility allows monitoring the state of devices, addresses, and routes continuously. This option has a different format in that the command monitor is first on the command line followed by the object list.

I recommend to use it with the time stamp option '-ts'

stack@devstack$ ip -ts monitor dev ens4
[2018-08-16T11:59:13.550548] default via fe80::a8bb:ccff:fe00:1000  proto ra  metric 1024  pref medium
[2018-08-16T11:59:13.552140] prefix 2001:db8::/64 dev ens4 onlink autoconf valid 2592000 preferred 604800
[2018-08-16T11:59:29.661718] prefix 2001:db8::/64 dev ens4 onlink autoconf valid 2592000 preferred 604800
[2018-08-16T11:59:45.708877] prefix 2001:db8::/64 dev ens4 onlink autoconf valid 2592000 preferred 604800
[2018-08-16T12:00:08.506428] Deleted default via fe80::a8bb:ccff:fe00:1000  proto ra  metric 1024  expires 1777sec hoplimit 64 pref medium

Comments

Popular posts from this blog

How to replace Supermicro IPMI SSL and TLS Certificate

I decided to replace SSL and TLS Certificates at my Supermicro IPMI (Intelligent Provisioning Management Interface). Warning:     Server will restart after cirtificate update !  There are many options how to create Certificates. Here is two options. One is for Linux and the second is for Windows. Let's start with Linux. To create certificate you need OpenSSL at your Linux installation. It's included in almost all distributives. To check version of OpenSSL use this command: #openssl version OpenSSL 1.0.2g  1 Mar 2016 I suggest to use at least 2048 bit certificate. First we create private 2048 bit RSA key. The filename can be any you wish, in this example I will store private RSA key in pvt.pem. #openssl genrsa -out pvt.pem 2048 or  you can user genpkey option #openssl genpkey -algorithm RSA -out pvt.pem -pkeyopt rsa_keygen_bits:2048 Using this private RSA key I create Certificate Request #openssl req -new -key pvt.pem -out crt.pem Then I use my privat

How to configure IPMI from IPMICFG Utility

IPMICFG Overview IPMICFG is a utility for IPMI devices configuration. It is a command line tool providing IPMI commands and Supermicro proprietary OEM commands. It is designed for easy to use and no pre-installation required. Use it for basic IPMI configuration and BMC status reading and monitoring. Features:  Set up IPMI IP Address  Set up IPMI Configuration  Configure IPMI User Management  Configure IPMI FRU  Manage System Event Log (SEL)  Manage IPMI by node management (NM) protocol IPMICFG Linux version will automatically use linux built-in ipmi driver from ipmitool to access BMC. If there is no ipmi driver loaded, IPMICFG will use its internal API to access BMC. However, the performance will be slow. Note:  You should use root permission to launch IPMICFG. Here is a step to load ipmi driver. You should be type these command to activate openIPMI driver: # modprobe ipmi_msghandler # modprobe ipmi_devintf # modprobe ipmi_si  Installing IPMICFG #  un

How to Enable Console at EVE-NG

By default EVE-NG disable console access. You can use VNC to get console access to VM. By editing  GRUB_CMDLINE_LINUX  in  /etc/default/grub I've added console=tty0 console=ttyS0,115200 to enable console access using virsh console eve-ng command. GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200 net.ifnames=0 "