Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: IPv6 on Ubuntu 9.10?

  1. #11
    Join Date
    Jan 2010
    Beans
    473

    Re: IPv6 on Ubuntu 9.10?

    It's working fine with a random Unique Local Address (see RFC4193).

  2. #12
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,481

    Re: IPv6 on Ubuntu 9.10?

    Quote Originally Posted by Skaperen View Post
    It's working fine with a random Unique Local Address (see RFC4193).
    Did you activate RFC4193 IPv6 addresses on Ubuntu? If so, how?

  3. #13
    Join Date
    Jan 2010
    Beans
    473

    Re: IPv6 on Ubuntu 9.10?

    Quote Originally Posted by sanderj View Post
    Did you activate RFC4193 IPv6 addresses on Ubuntu? If so, how?
    Yes, I did. I wrote a couple scripts. One went in /etc/init.d and had /etc/rc[0-6].d symlinks to make it run very early, before any network daemons. That script ran the other, which was placed in /etc/network. In addition to configuring various IP aliases (v4 or v6), it also configures an RFC4193 Unique Local Address using a pre-determined and coded ULA prefix set in an environment variable named "ULA", and the following wide line of code:
    Code:
    ifconfig | awk '{if(substr($0,1,1)!=" ")i=$1;if($1=="inet6"&&$2=="addr:"&&substr($3,1,6)=="fe80::"&&$4=="Scope:Link")printf "ifconfig %s add %s:%s\n",i,ENVIRON["ULA"],substr($3,7);}' | sh
    I should recode this so the ULA prefix is obtained from a specific file like maybe "/etc/network/inet6_ula_prefix" and go from there. Then I can give away my script.

  4. #14
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,481

    Re: IPv6 on Ubuntu 9.10?

    Cool! Here's the output on my system (without actually running it through /bin/sh):

    Code:
    sander@quirinius:~$ ifconfig | awk '{if(substr($0,1,1)!=" ")i=$1;if($1=="inet6"&&$2=="addr:"&&substr($3,1,6)=="fe80::"&&$4=="Scope:Link")printf "ifconfig %s add %s:%s\n",i,ENVIRON["ULA"],substr($3,7);}'
    ifconfig teredo add :ffff:ffff:ffff/64
    ifconfig wlan1 add :224:2cff:fe6a:54ab/64
    sander@quirinius:~$
    (I've not defined ULA)

    Let me check: you want to use IPv6 locally, but not the fe80:addresses, right?
    If you want to assign local addresses so that you don't have to specify the interface, you could also run 'radvd' on one system, with the RFC4193 prefix.


    BTW: did you follow my advice on activating zeroconf with IPv6? That's very handy.

  5. #15
    Join Date
    Jan 2010
    Beans
    473

    Re: IPv6 on Ubuntu 9.10?

    Well, I did want to use the fe80::/64 addresses. But they were not being handled in the expected way via applications like ping and ssh. When it was pointed out that ping6 worked, but needed the interface designation, I realized that assumptions were being made about the fe80 addresses that could be problematic for ordinary usage. So I chose to use the fc00:/7 (or more specifically the fd00:/8 part of it) addresses.

    This might be better, since we may be installing routers at some point. I wanted to be sure everything would work autonomously first (which is why I first tried the link-local addresses). Later I might do router announcements (thanks for the reference to "radvd" ... didn't know that was there) to test that aspect to be sure everything handles it so it all works when a real router might do IPv6.

    I generated an RFC4193 prefix via sha256 and registered it with http://www.sixxs.net/tools/grh/ula/

    I did not follow your advice that referred to miredo, because at this point in time, I do not have an interest in reaching the outside IPv6 world. I'm only doing setups so that I can test that all our internal network components and servers can do IPv6 for when that might be needed (which might be a VPN to a client before the public net).

    Here is the script I'm using now:
    Code:
    #!/bin/bash
    #---------------------------------------------------------------------------------------------------
    # file:         /etc/network/aliases-up
    # purpose:      Configure alias IP addresses for all interfaces
    # reads:        /etc/network/aliases is a sequence of ipv4alias or ipv6alias commands
    #               /etc/network/inet6_ula_prefix is 10 hexadecimal digits only
    #               /etc/network/inet6_ula_subnet is 1-4 hexadecimal digits only
    #---------------------------------------------------------------------------------------------------
    # license:      GPLv2
    # author:       Phil Howard
    # email:        echo cGhpbC5kLmhvd2FyZEBnbWFpbC5jb20K | mimencode -u
    #---------------------------------------------------------------------------------------------------
    
    #-----------------------------------------------------------------------------
    # Add an IPv4 alias address to a specified interface.
    #-----------------------------------------------------------------------------
    # We should be able to just do "ifconfig <iface> add" but it does not work
    # reliably for IPv4.
    #-----------------------------------------------------------------------------
    ipv4alias() {
            iface="${1}"
            shift
            addrp="${1}"
            shift
            ifopt=( "$@" )
    
            #------------------------------------------------------------------
            # Split address/prefix.
            #------------------------------------------------------------------
            addr=$( dirname "${addrp}" )
            pref=$( basename "${addrp}" )
    
            #------------------------------------------------------------------
            # If a prefix length is not given, make a default assumption.
            #------------------------------------------------------------------
            if [[ "${addr}" = "." ]] ; then
                    addr="${pref}"
                    case "x${addr}" in
                            ( x10.* | x44.* )                                       pref=8 ;;
                            ( x172.1[6-9].* | x172.2[0-9].* | x172.3[01].* )        pref=16 ;;
                            ( x192.168.* )                                          pref=24 ;;
                            ( * )
                                    echo "Bad IPv4 alias needs a prefix length: '${addrp}'" 1>&2
                                    return 1
                                    ;;
                    esac
            fi
    
            #------------------------------------------------------------------
            # Translate a prefix to a netmask.
            #------------------------------------------------------------------
            case "x${pref}" in
                    ( x30 ) netmask=255.255.255.252 ;;
                    ( x29 ) netmask=255.255.255.248 ;;
                    ( x28 ) netmask=255.255.255.240 ;;
                    ( x27 ) netmask=255.255.255.224 ;;
                    ( x26 ) netmask=255.255.255.192 ;;
                    ( x25 ) netmask=255.255.255.128 ;;
                    ( x24 ) netmask=255.255.255.0   ;;
                    ( x23 ) netmask=255.255.254.0   ;;
                    ( x22 ) netmask=255.255.252.0   ;;
                    ( x21 ) netmask=255.255.248.0   ;;
                    ( x20 ) netmask=255.255.240.0   ;;
                    ( x19 ) netmask=255.255.224.0   ;;
                    ( x18 ) netmask=255.255.192.0   ;;
                    ( x17 ) netmask=255.255.128.0   ;;
                    ( x16 ) netmask=255.255.0.0     ;;
                    ( x15 ) netmask=255.254.0.0     ;;
                    ( x14 ) netmask=255.252.0.0     ;;
                    ( x13 ) netmask=255.248.0.0     ;;
                    ( x12 ) netmask=255.240.0.0     ;;
                    ( x11 ) netmask=255.224.0.0     ;;
                    ( x10 ) netmask=255.192.0.0     ;;
                    ( x9 )  netmask=255.128.0.0     ;;
                    ( x8 )  netmask=255.0.0.0       ;;
                    ( * )   echo "Unusable IPv4 CIDR subnet prefix length '${pref}' in '${addrp}'" 1>&2 ; return 1 ;;
            esac
    
            #------------------------------------------------------------------
            # Do this with sequenced secondary interfaces.
            #------------------------------------------------------------------
            eval 'num=${num'"${iface}"'}'
            cmd=( ifconfig "${iface}:${num}" "${addr}" netmask "${netmask}" "${ifopt[@]}" )
            echo "Configuring IPv4 address on ${iface} as ${addrp} with" "${cmd[@]}"
            "${cmd[@]}"
            cs=$?
            eval 'num'"${iface}"'=$((num+1))'
            return $cs
    }
    
    #-----------------------------------------------------------------------------
    # Add an IPv6 alias address to a specified interface.
    #-----------------------------------------------------------------------------
    # We can do "ifconfig <iface> add" with IPv6.
    #-----------------------------------------------------------------------------
    ipv6alias() {
            iface="${1}"
            shift
            addrp="${1}"
            shift
            ifopt=( "$@" )
            cmd=( ifconfig "${iface}" add "${addrp}" "${ifopt[@]}" )
            echo "Configuring IPv6 address on ${iface} as ${addrp} with" "${cmd[@]}"
            "${cmd[@]}"
            return $?
    }
    
    #-----------------------------------------------------------------------------
    # Initialize sequence counter variables for each physical interface.
    #-----------------------------------------------------------------------------
    ifaces=( $( ifconfig -a | awk '{if(substr($0,1,1)!=" ")print $1;}' | fgrep -v : ) )
    for iface in "${ifaces[@]}" ; do
            eval 'num'"${iface}"'=0'
    done
    
    #-----------------------------------------------------------------------------
    # Generate IPv6 Unique Local Address (RFC 4193) for this host.
    #-----------------------------------------------------------------------------
    if [[ -f /etc/network/inet6_ula_prefix && -r /etc/network/inet6_ula_prefix ]] ; then
            prefix=$( cat /etc/network/inet6_ula_prefix )
            subnet='0000'
            if [[ -f /etc/network/inet6_ula_subnet && -r /etc/network/inet6_ula_subnet ]] ; then
                    subnet=$( cat /etc/network/inet6_ula_subnet )
            fi
            export ULA="${prefix:0:2}:${prefix:2:4}:${prefix:6:4}:${subnet}"
            ifconfig | awk '{if(substr($0,1,1)!=" ")i=$1;if($1=="inet6"&&$2=="addr:"&&substr($3,1,6)=="fe80::"&&$4=="Scope:Link")printf "ifconfig %s add fd%s:%s\n",i,ENVIRON["ULA"],substr($3,7);}' | sh
    fi
    
    #-----------------------------------------------------------------------------
    # Process the aliases file, which makes calls to ipv4alias or ipv6alias.
    #-----------------------------------------------------------------------------
    if [[ -f /etc/network/aliases && -r /etc/network/aliases ]] ; then
            source /etc/network/aliases
    fi
    It also does my IP aliasing.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •