• Welcome to Hurricane Electric's IPv6 Tunnel Broker Forums.


Welcome to Hurricane Electric's Tunnelbroker.net forums!

Main Menu

Setting up ip ranges?

Started by KHobbits, February 03, 2009, 10:02:21 PM

Previous topic - Next topic


Hi, I'm currently using he tunnels to access IRC, through a BNC, and to connect through ipv6 I have the BNC execute these commands through a script on start. I don't think this is the best way to do things, for one thing having 20 lines to add 20 IP's and or modprobe&ip/iface actual method I'm using.  Ideally I would like the config to run on boot without having to require sbnc to run the script.

I'm running ubuntu server.

What I have sbnc run:

sudo modprobe ipv6
sudo ip tunnel add he-ipv6 mode sit remote local ttl 255
sudo ip link set he-ipv6 up
sudo ip addr add 2001:470:1f06:9d7::2/64 dev he-ipv6
sudo ip route add ::/0 dev he-ipv6
sudo ip -f inet6 addr
sudo /sbin/ip -6 addr add 2001:0470:1f07:09d7:0000:0000:1337:1 dev he-ipv6
sudo /sbin/ip -6 addr add 2001:0470:1f07:09d7:0000:0000:1337:2 dev he-ipv6
sudo /sbin/ip -6 addr add 2001:0470:1f07:09d7:0000:0000:1337:20 dev he-ipv6


With Debian and Ubuntu you can configure network interfaces via the file /etc/network/interfaces. (See 'man interfaces'). You'll probably want to add the following lines to the file:

auto he-ipv6
iface he-ipv6 inet6 v4tunnel
  address 2001:470:1f06:9d7::2
  netmask 64
  ttl 255
  gateway 2001:470:1f06:9d7::1
  up /path/to/script/which/adds/addtional/ipv6/addresses

This should take care of your actual tunnel and set the default route. (Please note that I never tried the 'gateway' parameter with IPv6 myself)

The script which is executed once the interface is up, only needs to contain a few lines:

for i in $(seq 1 20) ; do
  ip -6 addr add 2001:0470:1f07:09d7:0000:0000:1337:$i dev he-ipv6

Regarding the ipv6 module: I never had to load it myself. If it is necessary on your machine, just add it to the file /etc/modules.


This seems to add the interface but the script doesn't run or at least it doesn't work, if I try and run it from command line I get 'cannot find device "he-ipv6"'


Hmm .. the error message would indicate that the device is indeed not up.

Maybe you could post the output of a few commands:

ifup -n -v he-ipv6
ip -6 addr show dev he-ipv6
ip -6 route show dev he-ipv6
ip tunnel show he-ipv6

And just to be sure: Can you confirm that you get the 'cannot find device' line 20 times when running the script? (Because it should be displayed either twenty or zero times)

If the device is not up as I suspect, you can use the commands "ifdown -v he-ipv6" and "ifup -v he-ipv6" to test the configuration in /etc/network/interfaces.
(Without the '-n' parameter the commands will modify the state of the interface)


hmm, I kinda needed it back up, so I added an up script to the eth0 that basically ran the same commands sbnc did using your loop, it works.

I can confirm there was 20 errors.  I could run the commands if you wish but as I ran the old set of commands in the up script I don't know if it would help.

If I intend to reboot the server anytime soon I will remove the script and dump the output of those commands in here