Hurricane Electric's IPv6 Tunnel Broker Forums

Advanced search  

News:

Welcome to Hurricane Electric's Tunnelbroker.net forums!

Author Topic: Setting up ip ranges?  (Read 6594 times)

KHobbits

  • Newbie
  • *
  • Posts: 3
Setting up ip ranges?
« on: February 03, 2009, 10:02:21 PM »

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 209.51.161.14 local 207.192.75.169 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
Logged

kristiankrohn

  • Newbie
  • *
  • Posts: 31
Re: Setting up ip ranges?
« Reply #1 on: February 04, 2009, 07:52:45 AM »

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:

Code: [Select]
auto he-ipv6
iface he-ipv6 inet6 v4tunnel
  address 2001:470:1f06:9d7::2
  netmask 64
  endpoint 209.51.161.14
  local 207.192.75.169
  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:

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

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.
Logged

KHobbits

  • Newbie
  • *
  • Posts: 3
Re: Setting up ip ranges?
« Reply #2 on: February 11, 2009, 09:49:26 AM »

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"'
Logged

kristiankrohn

  • Newbie
  • *
  • Posts: 31
Re: Setting up ip ranges?
« Reply #3 on: February 11, 2009, 10:14:12 AM »

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

Maybe you could post the output of a few commands:
Code: [Select]
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)

Logged

KHobbits

  • Newbie
  • *
  • Posts: 3
Re: Setting up ip ranges?
« Reply #4 on: February 11, 2009, 10:38:24 AM »

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
Logged