Volem veure les estadístiques de paquets amb iproute2. De sempre s’ha utilitzat ifconfig però amb iproute2 es pot fer de la forma següent:
Article interessant https://wiki.archlinux.org/title/IPv6
ip -s link show he-ipv6
6: he-ipv6@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1480 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/sit 192.168.1.1 peer 192.168.1.2
RX: bytes packets errors dropped overrun mcast
330353900 465900 0 0 0 0
TX: bytes packets errors dropped carrier collsns
73840575 582079 0 0 0 0
Preferència IPv4 sobre IPv6
Editar el fitxer /etc/gai.conf i descomentar aquest línia
precedence ::ffff:0:0/96 100
DESCOBRIMENT DE VEÍNS LINK LOCAL (multicast ff02::1)
ping ff02::1%enp3s0
ip -6 neigh
DESCOBRIMENT DE VEÍNS ROUTER (multicast ff02::2)
ping -c 3 -6 ff02::2%enp3s0
PING ff02::2%enp3s0(ff02::2%enp3s0) 56 data bytes
64 bytes from fe80::a60:6eff:feda:9d68%enp3s0: icmp_seq=1 ttl=64 time=0.040 ms
64 bytes from fe80::d8de:4bff:fe22:641%enp3s0: icmp_seq=1 ttl=64 time=0.386 ms
64 bytes from fe80::6e3b:6bff:fe5d:c974%enp3s0: icmp_seq=1 ttl=64 time=0.444 ms
64 bytes from fe80::feec:daff:fea6:5396%enp3s0: icmp_seq=1 ttl=64 time=0.444 ms
64 bytes from fe80::a60:6eff:feda:9d68%enp3s0: icmp_seq=2 ttl=64 time=0.039 ms
64 bytes from fe80::d8de:4bff:fe22:641%enp3s0: icmp_seq=2 ttl=64 time=0.439 ms
64 bytes from fe80::6e3b:6bff:fe5d:c974%enp3s0: icmp_seq=2 ttl=64 time=0.485 ms
64 bytes from fe80::feec:daff:fea6:5396%enp3s0: icmp_seq=2 ttl=64 time=0.516 ms
64 bytes from fe80::a60:6eff:feda:9d68%enp3s0: icmp_seq=3 ttl=64 time=0.033 ms
--- ff02::2%enp3s0 ping statistics ---
3 packets transmitted, 3 received, +6 duplicates, 0% packet loss, time 2051ms
rtt min/avg/max/mdev = 0.033/0.314/0.516/0.198 ms
# si volem que contesti amb la seva ip publica
ping -c 3 -I 2a03:4460:1206:dc00::101 ff02::2%enp3s0
PING ff02::2%enp3s0(ff02::2%enp3s0) from 2a03:4460:1206:dc00::101 : 56 data bytes
64 bytes from 2a03:4460:1206:dc00::101: icmp_seq=1 ttl=64 time=0.044 ms
64 bytes from 2a03:4460:1206:dc01:feec:daff:fea6:5396: icmp_seq=1 ttl=64 time=0.410 ms
64 bytes from 2a03:4460:1206:dc00::101: icmp_seq=2 ttl=64 time=0.042 ms
64 bytes from 2a03:4460:1206:dc01:feec:daff:fea6:5396: icmp_seq=2 ttl=64 time=0.468 ms
64 bytes from 2a03:4460:1206:dc00::101: icmp_seq=3 ttl=64 time=0.041 ms
--- ff02::2%enp3s0 ping statistics ---
3 packets transmitted, 3 received, +2 duplicates, 0% packet loss, time 2042ms
rtt min/avg/max/mdev = 0.041/0.201/0.468/0.195 ms
TCPDUMP
tcpdump -v ip6
DNSMASQ DHCP Server
enable-ra
dhcp-range=eth0,2000:570:c901:1::8c,2000:570:c901:1::ff,ra-only,64,1h
dhcp-option=option6:dns-server,[2000:570:c901:1::1]
dhcp-host=05:1e:c2:01:18:75,192.168.0.3,2000:570:c901:1::3,host3
dhcp-host=05:aa:14:90:00:40,192.168.0.4,2000:570:c901:1::4,host4
dhcp-host=05:60:6e:da:9d:68,192.168.0.5,2000:570:c901:1::5,host5
DNSMASQ DHCP LEASES
cat /var/lib/misc/dnsmasq.leases
1568978878 1859820904 2000:570:c901:1::4 host4 00:04:fe:d1:e7:8c:1c:ce:82:f1:27:8d:96:65:1a:91:4d:f4
COM FER PING LINK LOCAL
Cal posar % i l’interficie
pping -6 fe80::1%enp3s0
PING fe80::1%enp3s0(fe80::1%enp3s0) 56 data bytes
64 bytes from fe80::1%enp3s0: icmp_seq=1 ttl=64 time=0.699 ms
64 bytes from fe80::1%enp3s0: icmp_seq=2 ttl=64 time=0.538 ms
--- fe80::1%enp3s0 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4096ms
rtt min/avg/max/mdev = 0.547/0.569/0.633/0.032 ms
Exemple de configuració del router sense assignació automàtica
Exemples de configuració de xarxa
LinuxMint
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto enp3s0
#iface enp3s0 inet dhcp
# hwaddress ether 08:60:6e:da:9d:68
#iface enp3s0 inet6 dhcp
# hwaddress ether 08:60:6e:da:9d:68
iface enp3s0 inet static
hwaddress ether 08:60:6e:da:9d:68
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameserver 192.168.0.1
dns-search local.net
iface enp3s0 inet6 static
hwaddress ether 08:60:6e:da:9d:68
address 2001:470:69e2:1::100
netmask 64
dns-nameserver 2001:470:69e2:1::1
dns-search local.net
gateway 2001:470:69e2:1::1
#ip -6 route add default via fe80::1 dev enp3s0
#Configuració client exemple com a client de la configuració del router exemple
iface enp3s0 inet6 static
hwaddress ether 08:60:6e:da:9d:68
address 2a03:xxxx:xxxx:xxxx::xxx
netmask 64
gateway fe80::1
dns-nameserver 2001:4860:4860::8888 2001:4860:4860::8844
Raspbian GNU/Linux 9 (stretch)
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto eth0
iface eth0 inet static
address 192.168.0.48
netmask 255.255.255.0
gateway 192.168.0.1
iface eth0 inet6 static
address 2001:470:69e2:0001::48
netmask 64
gateway 2001:470:69e2:1::1
Raspbian GNU/Linux 10 (buster)
cat /etc/dhcpcd.conf
interface eth0
static ip_address=192.168.0.10/24
static ip6_address=2001:470:69e2:0001::48/64
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1
Ubuntu 22.04 (Jammy Jellyfish)
cat /etc/netplan/00-network.yml
network:
ethernets:
enp0s3:
#dhcp4: true
accept-ra: no
addresses:
- "2001:470:69e2:1::188/64"
routes:
- to: default
via: "2001:470:69e2:1::1"
nameservers:
addresses: [8.8.8.8, "2001:470:69e2:1::1"]
mkdir -p /etc/systemd/resolved.conf.d; echo -e "[Resolve]\nDNSStubListenerExtra=[::1]:53" >/etc/systemd/resolved.conf.d/localipv6.conf
Exemple de configuració del sysctl.conf per evitar la configuracions dinàmiques
net.ipv6.conf.all.use_tempaddr=0
net.ipv6.conf.default.use_tempaddr=0
net.ipv6.conf.all.accept_dad = 0
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.all.autoconf=0
net.ipv6.conf.default.autoconf=0
net.ipv6.conf.enp3s0.autoconf=0
net.ipv6.conf.all.accept_ra_pinfo = 0