Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with OpenID
Advertise on LowEndTalk.com

In this Discussion

IPv6 dhclient auto-configuration script (Online.net)

IPv6 dhclient auto-configuration script (Online.net)

NyrNyr Member
edited January 2015 in Providers

A friend created this and I think it's pretty handy and clean for those of us with multiple servers at Online:


ipv6-dhclient-script

Simple IPv6 configuration script for Debian (Ubuntu...) and RedHat (CentOS, Fedora...) based distros, mainly for Online.net servers but valid for any network that provides IPv6 access through prefix delegation i.e. the static address is configured by the client and an identifier (DUID) is sent to the DHCP server in order to get functional routes.

Servers provided by Online.net won't come with IPv6 enabled by default so this makes things a bit easier specially when owning multiple servers and IPv6 needs to be enabled by hand in each one.

The script has been successfully tested under:

  • Ubuntu Server 14.04
  • Debian 7.0
  • CentOS 7.0

Just run the script and follow the instructions:

$ bash ipv6-dhclient-script.sh

You can also pass parameters straight away:

$ bash ipv6-dhclient-script.sh <interface> <address block> <subnet> <duid>


https://github.com/outime/ipv6-dhclient-script

Comments

  • I love you.

    This signature wasted 121 bytes of your data allocation.

    https://nixstats.com/report/56b53d6465689e44598b4567

  • @0xdragon said: I love you.

    Thanked by 1davidgestiondbi
  • Can anyone test with RHEL 6?

    Different.

  • Does this work with the 2EUR "Dedibox kidéchire" ?

    I can't figure out how to get an address block.

    SonicBoxes.com - VPS Tips, Tricks & Tutorials
    6UA.net Various tools, screenshots, password gen, looking glass, etc..

  • ShadeShade Member
    edited January 2015

    @nunim said: Does this work with the 2EUR "Dedibox kidéchire" ?

    I can't figure out how to get an address block.

    Yes

    Hey there... nothing to see here

  • NyrNyr Member

    @nunim said: I can't figure out how to get an address block.

    You can request it from the console.

  • Do you actually get the whole /48 or just one IP address?

    Combating spammers/trolls/crawlers/fraudsters? Try free Proxy / VPN / Bad IP Detection || You can find my other useful scripts on GitHub or contact me on Twitter

  • black said: Do you actually get the whole /48 or just one IP address?

    The entire /48 can be used if you wish. It can be broken into /56 and /64 allocations too though for use across multiple servers.

  • blackblack Member
    edited January 2015

    @kcaj said: The entire /48 can be used if you wish. It can be broken into /56 and /64 allocations too though for use across multiple servers.

    If you try to add more IPs one by one, by doing something like

     /sbin/ifconfig eth0 inet6 add IPV6IPHERE

    They'll turn off your server after the ~6000th request for packet flood.

    Combating spammers/trolls/crawlers/fraudsters? Try free Proxy / VPN / Bad IP Detection || You can find my other useful scripts on GitHub or contact me on Twitter

  • black said: They'll turn off your server after the ~6000th request for packet flood.

    I see, but there is no restriction on what can be used in the /48 etc.

  • @black said: They'll turn off your server after the ~6000th request for packet flood.

    What if you rate limit it?

    This signature wasted 121 bytes of your data allocation.

    https://nixstats.com/report/56b53d6465689e44598b4567

  • 0xdragon said: What if you rate limit it?

    When I tested it I waited for 0.4s per request.

    Combating spammers/trolls/crawlers/fraudsters? Try free Proxy / VPN / Bad IP Detection || You can find my other useful scripts on GitHub or contact me on Twitter

  • Script author here, couldn't share by myself since LET sign up was broken (not anymore) so thanks to Nyr.

    Recently one guy reported that it kind of worked with Proxmox and OVZ, check this issue out for instructions: https://github.com/outime/ipv6-dhclient-script/issues/1

    Thanked by 1souvarine
  • bash ipv6-dhclient-script.sh <interface> 
    
    <
    
    address block> <subnet> <duid>                                    
    

    duid ?!

    what is the that? will you give us example plz

  • @soda said:

    duid ?!

    what is the that? will you give us example plz

    After requesting your IPv6 block under Server->Network configuration, you should find your block and the associated DUID in there. It's recommended that you subnet the main /48 into different /56 for each server. Note that every /56 will have a different DUID.

    Thanked by 1soda
  • nunimnunim Member

    Thanks for the script, worked great for me. I'd suggest having the script assign at least a single IPv6 address by default.

    I wrote a short blog post on the script with an example for people who aren't sure what information to enter:

    https://www.sonicboxes.com/online-net-ipv6-script/

    SonicBoxes.com - VPS Tips, Tricks & Tutorials
    6UA.net Various tools, screenshots, password gen, looking glass, etc..

    Thanked by 2shivoham outime
  • DeanDean Member

    Your DUID is your password for assigning IPv6 to your server; i'd black it out if I were you :)

  • @nunim besides what the guy above me says, you have this in your instructions:

    wget www.sonicboxes.com/scripts/ipv6_dhclient_online_net.sh chmod 755 deluge_webui.sh ./ipv6_dhclient_online_net.sh <interface> <address block> <subnet> <duid>

    I recommend the following:

    Thanks for the post!

  • I caused a dhcp flood the last time I tried configuring ipv6 with dhclient on my dedibox. is this script likely to cause dhcp flood? shall I filter out egress in any way? I'm wary of annoying online.net staff again.

  • @souvarine said: I caused a dhcp flood the last time I tried configuring ipv6 with dhclient on my dedibox. is this script likely to cause dhcp flood? shall I filter out egress in any way? I'm wary of annoying online.net staff again.

    I missed this post, sorry. IIRC it'd only cause flooding if for example your DUID is incorrect since it'll keep trying.

    Thanked by 1souvarine
  • rm_rm_ Member
    edited August 2015

    souvarine said: shall I filter out egress in any way?

    Not sure about dhclient, but the WIDE DHCPv6 client sometimes goes crazy on its own: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765453
    So yes in any case filtering would not hurt. With WIDE I now use:

    ip6tables -A OUTPUT -p udp --dport 547 -m limit --limit 10/min  --limit-burst 5 -j ACCEPT
    ip6tables -A OUTPUT -p udp --dport 547 -j DROP
    Thanked by 2howardsl2 souvarine
  • Someone complained about the default interface being incorrect when using CentOS. Since the interface name was hardcoded, it's true that it might not fit in some setups. I've updated the script to offer a more suitable default interface if none is specified in the arguments.

    Just posting this in case someone else had this issue.

  • ipv6-dhclient-script.sh: line 4: syntax error near unexpected token newline' ipv6-dhclient-script.sh: line 4:<!DOCTYPE html>'

  • Hello, if someone can help.

    I have kidechire and I'm trying to configure ipv6. I'm running Ubuntu 15.10 x64

    I tried with their support page https://documentation.online.net/en/serveur-dedie/reseau/ipv6-prefix

    I get Client Critical Fatal error during CfgMgr initialization.

    I tried with https://version6.ru/en/online.net-wide-dhcpv6

    When starting it exists with error 1.

    I tried with https://github.com/outime/ipv6-dhclient-script

    I got error eth0 is not found.

    Tried even this https://tech.tiq.cc/2015/10/how-to-enable-ipv6-on-online-net-servers-using-dhclient-on-ubuntu-14-04/

    same error eth0 not found.

    Can anyone give me advice how to add ipv6 to existing or new interface?

    There are 2 interfaces, enp2s0 and enp3s0, but I don't know what is enp3s0.

    Ifconfig output

    enp2s0 Link encap:Ethernet HWaddr c8:0a:a9:xx:xx:xx inet addr:195.154.xx.xx Bcast:195.154.xx.xx Mask:255.255.255.0 inet6 addr: fe80::ca0a:a9ff:fef1:a6d9/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:550360 errors:0 dropped:0 overruns:0 frame:0 TX packets:730668 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:118344582 (118.3 MB) TX bytes:1009066158 (1.0 GB) Interrupt:30 Memory:feae0000-feb00000

    Anybody have an idea how to fix it?

  • Thanks for the script! I used to use the dibbler client.

    Had to run it twice for it to work, on first run I got failed for some reason (after second time I had duplicates in the config).

    Also I managed to kill connectivity for a sec cause I am dumb \o/

    Thanked by 1outime
  • @nunim said: I wrote a short blog post on the script with an example for people who aren't sure what information to enter:

    It may not have been your intention but it's not nice to steal someone else's script. It's available and probably maintained at the location in the first post.

    Thanked by 1outime
  • I'm still having "fun" with IPv6. Dedi is kidechire, distro is Ubuntu 15.10 x64.

    I'm running ipv6-dhclient-script https://github.com/outime/ipv6-dhclient-script

    This is my ipv6 network info

    This is output of script.

    WARNING: Network will restart at the end of this script so any existing connections will be dropped!
    Interface where IPv6 will be enabled: enp3s0
    You have the following IPv6 addreses configured for enp3s0:
    
    Continue? [Y/n]: Y
    Your IPv6 block address (e.g. 2001:bb8:3e23:200::): 2001:xxxx:xxx1::
    Subnet for your block (e.g. if it's /56, input 56): 48
    Associated DUID (e.g. 00:03:00:00:34:b0:0c:47:4a:0e): 00:03:00:01:56:7a:xx:xx:xx:xx
    Working...
    net.ipv6.conf.enp3s0.autoconf = 0
    ifdown: interface enp3s0 not configured
    Failed to bring up enp3s0.
    Testing IPv6 connectivity...
    connect: Network is unreachable
    Something went wrong :(
    

    This is what ifconfig enp3s0 returns

    enp3s0    Link encap:Ethernet  HWaddr c8:0a:a9:f1:xx:xx
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
              Interrupt:34 Memory:febe0000-fec00000
    

    Any help will be appreciated.

  • heyzzxheyzzx Member
    edited January 2016

    wget www.sonicboxes.com/scripts/ipv6_dhclient_online_net.sh

    chmod 755 ipv6_dhclient_online_net.sh

    bash ipv6_dhclient_online_net.sh interface address block subnet duid

    example:

    bash ipv6-dhclient-script.sh eth0 2001:0bc7:5555:101:: 64 00:04:01:07:c7:b8:2f:13:d5:a8

    test:

    ping6 ipv6.google.com

    centos7.2 of Online.net is running perfect.

    Add to my hw7.net , thanks to the original author

    Thanked by 1outime
  • Can we uninstall this script without reinstalling the entire OS?

    I had to reformat my kide a couple of times due to networking and again, last time I assigned my entire /48 to the kide.

    outime said: Script author here, couldn't share by myself since LET sign up was broken (not anymore) so thanks to Nyr.

    Recently one guy reported that it kind of worked with Proxmox and OVZ, check this issue out for instructions: https://github.com/outime/ipv6-dhclient-script/issues/1

    Go give Vultr(referral) a try. | GNU/Linux http://debian.org

  • Long time not checking this post... please open up issues in GitHub and I'll check them more often :)

    @GM2015 said: Can we uninstall this script without reinstalling the entire OS?

    I had to reformat my kide a couple of times due to networking and again, last time I assigned my entire /48 to the kide.

    There's no uninstall option but if you just want to change that you can edit either /etc/network/interfaces (Debian) or /etc/systemd/system/ipv6-dhclient.service (CentOS and the like) and assign the correct range.

    @sipe said: I'm still having "fun" with IPv6. Dedi is kidechire, distro is Ubuntu 15.10 x64.

    Sorry, I haven't tested it outside LTS and I don't plan to give much support since if you decide to go for Ubuntu in a server you should IMHO stick to LTS. Of course if you find out the problem and send a PR to the repo I'll be glad to accept it and give proper credit.

    @heyzzx said: ipv6-dhclient-script.sh: line 4: syntax error near unexpected token newline' ipv6-dhclient-script.sh: line 4:<!DOCTYPE html>'

    You have probably downloaded this (wrong) instead of this (correct).

    Thanked by 2GM2015 sipe
  • GM2015GM2015 Member
    edited January 2016

    Thanks! I've just found my brain-remnants after a few days and dared to looked inside the files.

    This /etc/network/interfaces and /etc/dhcp/dhclient6.conf will need to be updated I guess with the new address and "netmask" as a /56 range, and the appropriate duid in /etc/dhcp/dhclient6.conf.

    if it doesn't work, it's either rescue mode or reinstall!

    For some reason, the server didn't like me restarting the networking service and had to reboot it. Not sure if it's entirely stupid to that(probably it is), but it causes no issue on my laptop.

    After the reboot, I got the proper /56 assigned. Hooray. Now I just wish I knew how I could assign /64-s where I want.

    outime said: There's no uninstall option but if you just want to change that you can edit either /etc/network/interfaces (Debian) or /etc/systemd/system/ipv6-dhclient.service (CentOS and the like) and assign the correct range.

    Go give Vultr(referral) a try. | GNU/Linux http://debian.org

  • Latest commits add support for Debian 8 (also under Proxmox VE thanks to a recent PR) :)

  • Has anyone got this working on Debian 8 .

    I have changed options ipv6 disable=1 to options ipv6 disable=0 in /etc/modprobe.d/local.conf

    And added ipv6 to /etc/modules

  • elgselgs Member

    @outime it seems the gateway is not assigned to the IPv6 addresses. How did you find the gateway address? Thanks.

  • sinsin Member
    edited July 2016

    Just incase this helps anyone out...

    On Ubuntu 16.04 I had to add net.ipv6.conf.yourinterfacenamehere.accept_dad = 0

    to /etc/sysctl.conf to get IPv6 working properly on my Dedibox SC 2016. https://www.agwa.name/blog/post/beware_the_ipv6_dad_race_condition

    Online.net put up a new guide for their IPv6 and have a systemd service config you can use

    Get your cheap domains at Namesilo! Use promocode: NEWDOMAIN1 for $1 off your purchase.

    Thanked by 1elgs
  • elgselgs Member

    @sin before you added it to /etc/sysctl.conf, what was the problem? My problem now is that the gateway information is not assigned.

  • sinsin Member

    @elgs said: @sin before you added it to /etc/sysctl.conf, what was the problem? My problem now is that the gateway information is not assigned.

    When my server would boot up the ipv6 address wouldn't bind to the interface because everything was coming up to fast and in Ubuntu 16.04 (and maybe Debian 8?) the interface gets locked so ipv6 can't bind to it. When I disabled DAD then ipv6 could bind to the interface and I was good to go.

    I originally followed Online.net's new systemd ipv6 tutorial but dhclient.service would always show as "degraded" so I ended up doing it by making a dhclient6.conf and adding ipv6 to /etc/network/interfaces.

    I used this guide: https://forum.online.net/index.php?/topic/4729-howto-ipv6-using-dhclient-for-ubuntu/

    Get your cheap domains at Namesilo! Use promocode: NEWDOMAIN1 for $1 off your purchase.

    Thanked by 1elgs
  • outimeoutime Member
    edited August 2016

    I've just added CentOS 6 support as some people asked for it. It works very well with the latest CentOS 6 provided by Online.net.

    I'll check how it goes again with fresh Ubuntu 16.04 & Debian 8 setups to see if I can find any issues.

    Update: Tested Ubuntu 16.04 and worked right away, at least with my kidéchiré. Debian 8 goes next.

    Update 2: Debian 8 works as well, so the script should be working for all cases as expected.

  • How do you get this to run on boot?

  • sinsin Member

    I'm having an issue where after a few days ipv6 stops working and I have to restart the network/or reboot for it to come back up/work again.

    Get your cheap domains at Namesilo! Use promocode: NEWDOMAIN1 for $1 off your purchase.

Sign In or Register to comment.