Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
IPv6 startup script support
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
wfaulk
n00b
n00b


Joined: 08 Jun 2002
Posts: 9

PostPosted: Tue Jun 11, 2002 7:44 pm    Post subject: IPv6 startup script support Reply with quote

I've noticed that the Gentoo startup scripts don't really allow for assigning an IPv6 address to an interface that also has an IPv4 address because it only calls ifconfig once for each interface. (This would seem to go for other protocols as well, but IPv6 is what I'm interested in right now.) Keep in mind that IPv6 addresses are not configured as aliases (that is, eth0:0, etc.), but are on the same level as IPv4 addresses.

Is there any planned support for this or should we roll our own additional startup scripts?
_________________
Bitt
Back to top
View user's profile Send private message
masikh
n00b
n00b


Joined: 27 May 2003
Posts: 17

PostPosted: Thu Oct 09, 2003 7:05 pm    Post subject: A nice begin I guess. Reply with quote

I worked on a Gentoo script for setting up a IPv6 tunnel.

This file = /etc/init.d/IPv6_Tunnel
Code:

#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later

# Last modification: 09-10-2003 by Robert Nagtegaal (robert@vslcatena.nl)
#
# - Made my script a Gentoo runscript.
# - Added tunnel up check.
#
# - To-Do:
#
# - Make it possible to administer multiple tunnels via one script or.
#   maybe something like the net.eth(x) scripts.
#
###

depend() {
        need net
}
      

start() {
  ebegin "Starting IPv6 Tunnel"

# Test if we really got IPv6 support in the kernel. If not present,
# this script tries to load the kernel module else it bails out with a
# warning.
#
###

  if ! [ -f /proc/net/if_inet6 ]
    then echo "ERROR: No IPv6 support in you kernel. Trying to load kernel module." 1>&2; modprobe ipv6;
  fi
  if ! [ -f /proc/net/if_inet6 ]
    then echo "ERROR: No IPv6 support. Sorry I can't continue." 1>&2; exit 1;
  fi

# Test if tunnel is not already up
#
###

  up=`(set \`"/sbin/ifconfig" | grep "${Interface_remote_OPTS}"\`;echo $1)` 1>&2
  if [ "$up" = "${Interface_remote_OPTS}" ]
    then echo "ERROR: Tunnel already up using: ${Interface_remote_OPTS}" 1>&2; exit 1;
  fi

# Setting up the tunnel.
#
###

  /sbin/ifconfig ${Interface_local_OPTS} tunnel ::${PoP_IPv4_OPTS} mtu 1280 up && \
  /sbin/ifconfig ${Interface_remote_OPTS} add ${Loc_IPv6_OPTS} mtu 1280  up && \
  /sbin/route -A inet6 add ${Not_local_OPTS} gw ${PoP_IPv6_OPTS} dev sit1 && \
  echo "Tunnel to ${BROKER_OPTS} establised." || \
  { echo "ERROR: Failed to establise a tunnel to ${BROKER_OPTS}." 1>&2; $0 stop; exit 1; }

  eend $?
}
stop() {
  ebegin "Stopping IPv6 Tunnel"

# Bringing the tunnel down.
#
###

  /sbin/ifconfig ${Interface_remote_OPTS} down
  /sbin/ifconfig ${Interface_local_OPTS} down && \
  echo "IPv6 tunnel deleted." || \
  { echo "ERROR: Failed to bring IPv6 tunnel with ${Interface_remote_OPTS} down." 1>&2; exit 1; }
  eend $?
}

restart() {
  ebegin "Gracefully restarting IPv6 Tunnel"
  stop
  start
  eend $?
}


This file = /etc/conf.d/IPv6_Tunnel

Code:

BROKER_OPTS="YOUR BROKER"         # Name of your broker (cosmetic purpose)

Loc_IPv4_OPTS="a.b.c.d"         # Local IPv4 address.
PoP_IPv4_OPTS="a.b.c.d"         # PoP's IPv4 address.

Loc_IPv6_OPTS="a::b::c::d"      # Local IPv6 endpoint address.
PoP_IPv6_OPTS="a::b::c::d"      # PoP's IPv6 endpoint address.
Not_local_OPTS="2000::/3"      # Needed (got a name but forgot;)

Interface_local_OPTS="sit0"      # which sit devices to use
Interface_remote_OPTS="sit1"               

MTU_OPTS="1280"            # Tunnel's MTU size


Can anybody please make an ebuild from it and send it to robert@vslcatena.nl I will then submit it to bugs.gentoo.org as a new package. Many thanks...

Robert Nagtegaal
_________________
Remember: While root can do most anything, there are cer-
tain privileges only a wife can grand.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum