Author Topic: IPv6 on CentOS 6 with autostart on boot  (Read 8010 times)

0 Members and 1 Guest are viewing this topic.

Offline
***
IPv6 on CentOS 6 with autostart on boot
« on: August 16, 2017, 07:50:28 PM »
Hello people,
Here I`m going to give you a how to make an IPv6 Configuration for your CentOS 6 with an auto start script.
First of all you will need an account in TunnelBroker.net. Once you make an account and login to it, go to Create Regular Tunnel. On the first line write down the public IP address of your CentOS 6 machine. On Available Tunnel Servers:
Code: [Select]
ping -c 5 <tunnel server IP> one by one and find the best one for you and select it. Than press Create tunnel. Go back on the Main Page and select your tunnel. Copy the IPv6 address from Client IPv6 Address:
Go to /etc/init.d/ and run
Code: [Select]
nano -w ipv6.
Paste inside this code and replace with your Client IPv6 Address:

Code: [Select]
#!/bin/bash

start(){
        echo "Starting ipv6 ..."
        ifconfig sit0 up
        ifconfig sit0 inet6 tunnel ::216.66.87.14
        ifconfig sit1 up
        ifconfig sit1 inet6 add Client IPv6 Address::2/64
        ifconfig sit1 inet6 add Client IPv6 Address::3/64
        ifconfig sit1 inet6 add Client IPv6 Address::4/64
        ifconfig sit1 inet6 add Client IPv6 Address::5/64
        route -A inet6 add ::/0 dev sit1
}

stop(){
        echo "Stopping ipv6 ..."
        ifconfig sit0 down
        ifconfig sit1 down
}

restart(){
        echo "Restarting ipv6 ..."
        stop
        sleep 5
        stop
        sleep 5
        start
}
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  *)
        echo "Usage: ipv6 {start|stop|restart}"
        exit 1
esac

exit 0

You can continue adding IPv6 addresses after ifconfig sit1 inet6 add Client IPv6 Address::5/64 as much as you want until you follow the rules for the IPv6.
Example of the Client IPv6 Address:
Code: [Select]
2001:470:1d1c:28ed::2/64Close your file with Ctrl+X and press Y to save it.
Execute the following commands:
Code: [Select]
chmod 755 ipv6          --> Change the permissions of the file to be executable
chkconfig ipv6 on        --> Adding the file to system start
service ipv6 start        --> Starting the IPv6 on your system
ping6 -c5 ipv6.google.com     --> Test your IPv6 configuration
When you reboot your system or it get rebooted by any reason the script will start alone and you don`t need to add everything by hand one by one. I wrote this script for me because I got angry after every reboot of the developing machine to add every time the IPv6 stuff again and again.
You don`t need to reboot your server to start the IPv6.
One more thing:
Login with root to your CWP6.admin panel, go to Services Config, Services Monitor and select the ipv6 to be watched for stopping. Click save and you`re done. Have fun with your new IPv6.
(Don`t be greedy to take /64 and /48 unless you finish the IPs from /64 which is close to unbelievable. In /64 you have 18,446,744,073,709,551,616 IP addresses, so unless you`re the ISP which is giving 2,635,249,153 IPs per customer (and you have all 7,000,000,000 people on the earth as customers) you are not able to finish the /64).  ;D That`s it. Have fun.
« Last Edit: August 16, 2017, 07:57:14 PM by darkness »
UNIX is a very simple OS, but you have to be a GENIUS to understand it ...