IPv6 - configuration Debian 11 (bullseye) and secondary IP addresses

  • Hi @all,


    Good morning.


    Is there someone who would like to share an working Debian 11 (bullseye) IPv6 configuration with additional IP addresses. In Ubuntu with netplan it's quite easy, but in Debian (11) I have some issues.

    Would be appreciated if someone could share an working configuration.


    I took also a look at: https://www.netcup-wiki.de/wik…sse_konfigurieren#IPv6%7C

    but looks like, it's a litte bit outdated (not working in my situation).


    My config tryings so far, but after an reboot it's not working anymore:


    # This file describes the network interfaces available on your system

    # and how to activate them. For more information, see interfaces(5).


    source /etc/network/interfaces.d/*


    # The loopback network interface

    auto lo

    iface lo inet loopback


    #iface eth0:1 inet6 static

    #address 2a03:4000:6a:3c1::1

    #netmask 64

    #gateway fe80::1


    #IPV6 networking

    iface ens3 inet6 static

    address 2a03:4000:6a:3c1::1

    netmask 64

    gateway fe80::1


    #iface eth0:1 inet6 static

    # address 2a03:4000:6a:3c1::2

    # netmask 64

    # gateway fe80::1


    #auto eth0:0

    #iface eth0:0 inet6 static

    # address 2a03:4000:6a:3c1::1/64

    # address 2a03:4000:6a:3c1::2/64

    # gateway fe80::1

    # post-up route add -A inet6 default gw fe80::1%eth0:0 || true

    # pre-down route del -A inet6 default gw fe80::1%eth0:0 || true


    #Start IPv6 secondary additional IP configuration


    #up ip -6 addr add 2a03:4000:6a:3c1::2/64 dev ens3

    #up /sbin/ifconfig ens3 inet6 static add 2a03:4000:6a:3c1::2/64

    #up /sbin/ifconfig ens3 inet6 static add 2a03:4000:6a:3c1::3/64

    #up /sbin/ifconfig ens3 inet6 static add 2a03:4000:6a:3c1::1337/64



    #iface eth0:0 inet6 static

    #address 2a03:4000:6a:3c1:2:2:2:2

    #address 2a03:4000:6a:3c1::3

    #address 2a03:4000:6a:3c1::1337

    #address 2a03:4000:6a:3c1::1338

    #netmask 64

    #gateway fe80::1


    #iface ens3 inet6 static

    # address 2a03:4000:6a:3c1::2

    # netmask 64

    # up ip -6 route add 2a03:4000:6a:3c1::2 via fe80::1 || true


    Some actions when it works:


    root@gate /etc/network # /etc/init.d/networking restart

    Restarting networking (via systemctl): networking.service.

    root@gate /etc/network # sudo ifdown ens3 && ifup ens3

    ifdown: interface ens3 not configured

    Waiting for DAD... Done

    root@gate /etc/network # ping6 http://www.unet.nl

    PING http://www.unet.nl(purpureus.unet.nl (2a02:120:320:851::49)) 56 data bytes

    64 bytes from purpureus.unet.nl (2a02:120:320:851::49): icmp_seq=2 ttl=57 time=203 ms

    64 bytes from purpureus.unet.nl (2a02:120:320:851::49): icmp_seq=3 ttl=57 time=25.6 ms

    64 bytes from purpureus.unet.nl (2a02:120:320:851::49): icmp_seq=4 ttl=57 time=25.6 ms


    PS I'm using an vps-server, new type: G10s.


    Grtz,

    MekMek

  • is there a reason you dont have

    Code
    auto ens3

    in your config? other than that your (single ip) config looks fine to me.

    also there are some recommended kernel settings you should run.


    Code
        net.ipv6.conf.default.accept_ra=0
        net.ipv6.conf.default.autoconf=0
        net.ipv6.conf.all.accept_ra=0
        net.ipv6.conf.all.autoconf=0
        net.ipv6.conf.ens3.accept_ra=0
        net.ipv6.conf.ens3.autoconf=0
  • Hi Etwas,


    Thanks for your reply!. I did add this extra to the config:


    /etc/network/interfaces


    Code
    # The loopback network interface
    auto lo
    iface lo inet loopback
    auto ens3


    I have the following info in the:

    file: sysctl.conf


    Code
    net.ipv6.conf.default.accept_ra=0
    net.ipv6.conf.default.autoconf=0
    net.ipv6.conf.all.accept_ra=0
    net.ipv6.conf.all.autoconf=0
    net.ipv6.conf.ens3.accept_ra=0
    net.ipv6.conf.ens3.autoconf=0


    ip a output:


    route -n output


    Code
    root@gate /etc/network # route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         89.58.56.1      0.0.0.0         UG    100    0        0 ens3
    89.58.56.0      0.0.0.0         255.255.252.0   U     100    0        0 ens3


    I did several tests with add extra secondary IP's but ony the first one works:

    but after a reboot it's not working for some reason.


    Grtz,

    MekMek






  • Working example from one of my netcup VPS with Debian 11:


    + mentioned sysctl config :)


    Important: This snippet is for a 2nd IPv6 address from the same subnet. If you've ordered another IPv6 subnet, the required config is a little bit different!

    "Wer nur noch Enten sieht, hat die Kontrolle über seine Server verloren." (Netzentenfund)

    Edited 4 times, last by KB19 ().

  • I had no time to have a closer look, but in your config you commented following part.

    Have you tried uncommenting it, but leave the gateway commented? (and changed eth0:1 to ens3)


    Code
    iface ens3 inet6 static
     address 2a03:4000:6a:3c1::2
     netmask 64
    # gateway fe80::1
  • since you used your real ips, here is a simple config that should work fine.

    you could maybe try this first and then go from there.


  • Working example from one of my netcup VPS with Debian 11:


    + mentioned sysctl config :)


    Important: This snippet is for a 2nd IPv6 address from the same subnet. If you've ordered another IPv6 subnet, the required config is a little bit different!

    Hi KB,


    Great, looks like this did the trick: ;)


    #IPv4 /32 section in the /22 range

    allow-hotplug ens3

    iface ens3 inet static

    address 89.58.56.189/22

    gateway 89.58.56.1

    post-up ip -4 addr add 89.58.56.189/32 dev $IFACE

    pre-down ip -4 addr del 89.58.56.189/32 dev $IFACE


    #IPV6 primary IP

    iface ens3 inet6 static

    address 2a03:4000:6a:3c1::1/64

    gateway fe80::1

    dad-attempts 0

    accept_ra 0

    post-up ip -6 addr add 2a03:4000:6a:3c1::1/128 dev $IFACE preferred_lft 0

    pre-down ip -6 addr del 2a03:4000:6a:3c1::1/128 dev $IFACE


    #IPv6 secondary IP etc etc.

    iface ens3 inet6 static

    address 2a03:4000:6a:3c1::2/64

    gateway fe80::1

    dad-attempts 0

    accept_ra 0

    post-up ip -6 addr add 2a03:4000:6a:3c1::2/128 dev $IFACE preferred_lft 0

    pre-down ip -6 addr del 2a03:4000:6a:3c1::2/128 dev $IFACE


    But the second IP on the same way is not working, is there a shortage how I can add this, I did this for the second IP-address (same network adapter):


    #IPv4 secondary IP etc etc.

    iface ens3 inet6 static

    address 2a03:4000:6a:3c1::2/64

    gateway fe80::1

    dad-attempts 0

    accept_ra 0

    post-up ip -6 addr add 2a03:4000:6a:3c1::2/128 dev $IFACE preferred_lft 0

    pre-down ip -6 addr del 2a03:4000:6a:3c1::2/128 dev $IFACE


    Firtst IP (works):


    root@gate /etc/network # ping6 2a03:4000:6a:3c1::1

    PING 2a03:4000:6a:3c1::1(2a03:4000:6a:3c1::1) 56 data bytes

    64 bytes from 2a03:4000:6a:3c1::1: icmp_seq=1 ttl=64 time=0.017 ms

    64 bytes from 2a03:4000:6a:3c1::1: icmp_seq=2 ttl=64 time=0.040 ms

    64 bytes from 2a03:4000:6a:3c1::1: icmp_seq=3 ttl=64 time=0.052 ms


    Second IP (not working):


    root@gate /etc/network # ping6 2a03:4000:6a:3c1::2

    PING 2a03:4000:6a:3c1::2(2a03:4000:6a:3c1::2) 56 data bytes

    From 2a03:4000:6a:3c1::1 icmp_seq=1 Destination unreachable: Address unreachable

    From 2a03:4000:6a:3c1::1 icmp_seq=2 Destination unreachable: Address unreachable

    From 2a03:4000:6a:3c1::1 icmp_seq=3 Destination unreachable: Address unreachable

    From 2a03:4000:6a:3c1::1 icmp_seq=4 Destination unreachable: Address unreachable

    From 2a03:4000:6a:3c1::1 icmp_seq=5 Destination unreachable: Address unreachable

    From 2a03:4000:6a:3c1::1 icmp_seq=6 Destination unreachable: Address unreachable


    Looks like I'm close in the good direction :)


    GRtz,

    MekMek

  • I had no time to have a closer look, but in your config you commented following part.

    Have you tried uncommenting it, but leave the gateway commented? (and changed eth0:1 to ens3)


    Code
    iface ens3 inet6 static
     address 2a03:4000:6a:3c1::2
     netmask 64
    # gateway fe80::1

    Yes did this, but no IPv6 connectivity when I did this :(

  • It's not possible to define an interface multiple times. Your last config is clearly invalid.


    Ok, try this:


    "Wer nur noch Enten sieht, hat die Kontrolle über seine Server verloren." (Netzentenfund)

    Edited once, last by KB19 ().

  • It's not possible to define an interface multiple times

    works with ipv6, just tried here with debian 12.

    so this sould work for mrmekmek


  • works with ipv6, just tried here with debian 12.

    so this sould work for mrmekmek



    Hi Etwas,


    Yes great this fixed my problem!


    Good to know this works also smoothly on Debian 12.


    Network config: /etc/network/interfaces


    Output: root@gate /etc/network # ip a


    etc etc.


    Many thanks for your help, will be really appreciated.


    Have good weekend Etwas!


    Grtz,

    Mek

  • I had no time to have a closer look, but in your config you commented following part.

    Have you tried uncommenting it, but leave the gateway commented? (and changed eth0:1 to ens3)


    Code
    iface ens3 inet6 static
     address 2a03:4000:6a:3c1::2
     netmask 64
    # gateway fe80::1

    Hi Andy,


    Thanks for contributing, will be really appreciated. Problem solved. Thanks for the help @all


    Grtz,

    MekMek.