Benutzer-Werkzeuge

Webseiten-Werkzeuge


knowledge_base:linux:staticip

IP configuration

Debian

/etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
 
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
        address 192.168.21.2/24
        gateway 192.168.21.1
iface eth0 inet6 static
        address fd18:76a0:3427:201::2/64
iface eth0 inet6 auto

IPv6: token or DHCP

/etc/network/interfaces
iface eth0 inet6 auto #SLAAC
    pre-up /sbin/ip token set ::48 dev eth0 #configure static token with changing prefix
 
iface eth1 inet6 dhcp #DHCPv6

1)

IPv6: EUI-64

/etc/sysctl.conf
net.ipv6.conf.default.addr_gen_mode = 0
net.ipv6.conf.eth0.addr_gen_mode = 0

DHCPv4 DUID identifier

ifupdown sends dhclient -i Flag (use DHCPv6 DUID for v4) by default now. To revert backt to MAC-Address set following item in dhclient.conf:2)

/etc/dhcp/dhclient.conf
send dhcp-client-identifier = hardware;

or this option in /etc/network/interface:3)

/etc/network/interfaces
iface eth0 inet dhcp
    client no

Disable v6 completely

/etc/sysctl.conf
net.ipv6.conf.eth0.disable_ipv6 = 1 #replace eth0 with desired interface or all

Ubuntu 18.04

/etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
 
 
network:
    ethernets:
        eth0:
            dhcp4: no
            addresses:
            - 192.168.25.40/24
            - 2001:6b0:1234:1470::40/64
            gateway4: 192.168.25.1
            gateway6: 2001:6b0:1234:1470::1
    version: 2
sudo netplan apply

IPv6 Token

not persistent

sudo ip token set ::27 dev eth0

persistent

add token addr and fe80 with that number

/etc/network/interfaces
iface eth0 inet6 auto
        pre-up /sbin/ip token set ::40 dev eth0
        up /sbin/ip -6 addr add fe80::40/64 dev eth0

Mit ip addr

sudo ip addr add 2003:59:6034::26:4/64 dev eth1
sudo ip route add ::/0 via 2003:59:6034::1 dev eth1

Token in /etc/network/interfaces

/app/www/public/data/pages/knowledge_base/linux/staticip.txt · Zuletzt geändert: 2023/09/06 14:56 von julian.lemmerich