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:
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
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
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
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