10-02-2017 08:31 AM
I am trying to make my Linux RT cRIO-9064 have an IPv6 address for a project that I am working on. The address that I am trying to add to my cRIO is: fd00::4/64 I can connect to my cRIO via Putty and add my desired IPv6 address with the command /sbin/ip -6 addr add fd00::4/64 dev eth0
However, every time I power cycle my cRIO, my IPv6 address gets wiped from memory. How can I prevent this?
Would it be possible to run a script that runs the command /sbin/ip -6 addr add fd00::4/64 dev eth0 on startup or is there a file location on the cRIO that stores IPv4/IPv6 addresses and I can just add it there? If so, how?
Thanks.
Solved! Go to Solution.
10-02-2017 09:53 AM
Hi JHugh,
To directly answer the question that you asked, look into sysv init scripts (we have a handy guide here, but there are plenty of resources online for just this sort of thing).
To more directly field the spirit of the question that you're asking (getting a persistent, static ipv6 address on an interface), you're better served looking into the ifplugd scripts that run when a networking interface disappears or becomes available (including startup). The file you want to look at is /etc/ifplugd/ifplugd.action, it's a standard shell script.
A word of caution: either of these approaches can be undone when installing software through MAX.
10-02-2017 12:13 PM
Hi Brad!
Thanks for the response!
I tried to follow the tutorial that you linked, and I am receiving the error in my remote shell that "#!/bin/bash is not a file or directory" when I try to test the startup script on step 3.3 of the tutorial. What could cause this, or am I making this more complicated than it needs to be i.e. I could just call my .sh file at the end of this post directly by pasting the code somewhere?
Thanks.
My startup script is in /etc/init.d/ssj and contains the following code:
#!/bin/bash
NAME="IPv6 Startup Script"
DAEMON=/usr/bin/ipv6
ARGS=""
USER=./admin
PIDFILE=/var/run/ipv6.pid
do_start() {
/sbin/start-stop-daemon --start --pidfile $PIDFILE \
--make-pidfile --background \
--chuid $USER --exec $DAEMON $ARGS
}
do_stop() {
/sbin/start-stop-daemon --stop --pidfile $PIDFILE --verbose
}
case "$1" in
start)
echo "Starting $NAME"
do_start
;;
stop)
echo "Stopping $NAME"
do_stop
;;
restart)
echo "Restarting $NAME"
do_stop
do_start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0
My ipv6 configuration code is in /usr/bin/ipv6 and contains the following code:
#!/bin/sh
/sbin/ip -6 addr add fd00::4/64 dev eth0
10-02-2017 01:15 PM
I solved it. I updated the file on the cRIO at /etc/network/interfaces by appending the following lines of code:
auto eth0
iface eth0 inet6 static
address fd00::4
netmask 64
gateway 2607:f0d0:2001:000a:0000:0000:0000:0001
10-02-2017 02:06 PM
Hmm, my concern with your solution would be that the interface is now being managed from two different systems: ifplugd for ipv4 and busybox for ipv6. I suppose it's working since the settings are fairly orthogonal to one another.