Hurricane Electric's IPv6 Tunnel Broker Forums

General IPv6 Topics => IPv6 on Linux & BSD & Mac => Topic started by: glimberg on January 21, 2011, 12:30:40 PM

Title: Help setting up Ubuntu with multiple virtual interfaces
Post by: glimberg on January 21, 2011, 12:30:40 PM
Hi all.  Newb question here.  I hope you don't mind  ;D

I've recently delved into the world of ipv6 and have my tunnel working quite nicely on my VPS Ubuntu 10.04 server.  As with all accounts on here, I was assigned a routed /64.  The server serves up multiple domain names.  Ideally what I'd like to do is have each domain on a unique ipv6 address from my /64 block.  With ipv4, I'd create virtual interfaces such as eth0:0, eth0:1, eth0:2 each with their own IP address.  I'm lost as to how to configure this with ipv6 though.

Here are the contents of my current /etc/network/interfaces file:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address xxx.xxx.xxx.xxx
        netmask 255.255.255.0
        gateway xxx.xxx.xxx.xxx

auto hetunnel
iface hetunnel inet6 v4tunnel
        address 2001:470:1f04:xxxx::2
        netmask 64
        ttl 64
        gateway 2001:470:1f04:xxxx::1
        endpoint 72.52.104.74



What do I need to do to it in order to achieve what I'm looking to do?

Thanks in advance.

Grant
Title: Re: Help setting up Ubuntu with multiple virtual interfaces
Post by: cholzhauer on January 21, 2011, 01:30:16 PM
You just do the same here.

Are you wanting them on a different subnet or on the same subnet?
Title: Re: Help setting up Ubuntu with multiple virtual interfaces
Post by: jimb on January 21, 2011, 03:50:52 PM
Just slap as many IPv6 addresses on the eth0 interface as you need.  You can also use them on bridged guest OSes virtual nics if it's a VM host.

I think in the interfaces file you just use multiple address statements.

Manually, you'd use "ip addr add ..."
Title: Re: Help setting up Ubuntu with multiple virtual interfaces
Post by: glimberg on January 21, 2011, 05:00:07 PM
When adding the following to my /etc/network/interfaces:


auto eth0:0
iface eth0:0 inet6 static
        address 2001:470:1f05:xxxx::1
        netmask 64


I get the following error when attempting `sudo ifup eth0:0`:


SIOCSIFFLAGS: Cannot assign requested address
Failed to bring up eth0:0.


Not sure what's going on here.
Title: Re: Help setting up Ubuntu with multiple virtual interfaces
Post by: jimb on January 21, 2011, 05:15:17 PM
Don't use eth0:0.  Just use eth0.  The : subinterface thing is "obsolete".

I believe you can just put multiple address directives under each interface.
Title: Re: Help setting up Ubuntu with multiple virtual interfaces
Post by: glimberg on January 21, 2011, 09:12:42 PM
Apparently you cannot put multiple address directives under each interface.. What I had to do to get this working was the following:


auto eth0:0
iface eth0:0 inet static
address 192.168.5.22 # <-- fake IP address
netmask 255.255.255.0

iface eth0:0 inet6 static
        address 2001:470:1f05:xxxx::2/64
netmask 64

auto eth0:1
iface eth0:1 inet static
        address 192.168.44.2 # <- another fake IP address
netmask 255.255.255.0

iface eth0:1 inet6 static
        address 2001:470:1f05:xxxx::3/64
netmask 64


All of the ipv6 addresses show up under eth0 when running ifconfig now, even though they were assigned to the virtual interface in /etc/network/interfaces

A bit strange, but it works.
Title: Re: Help setting up Ubuntu with multiple virtual interfaces
Post by: centove on January 27, 2011, 08:27:30 AM
I do the following:



auto eth0
iface eth0 inet static
    address <mumble>
    ....
    up /sbin/ip -6 addr add <mumble>/64 dev eth0
    <and so on>

auto eth0:1
iface eth0:1 inet static
    address <mumble>
    up /sbin/ip -6 addr add <mumble>/64 dev eth0:1

auto he-ipv6
iface he-ipv6 inet6 v4tunnel
    endpoint <mumble>
    local <mumble>
    address <mumble>
    netmask 64
    up /sbin/ip -6 route add default dev he-ipv6
    down /sbin/ip -6 route del default dev he-ipv6