Ipv6 with PPPoE on Ubuntu

From IkaWiki
Jump to: navigation, search

Introduction

Scope

This How-To explains how I installed Ipv6 over PPPoE in Ubuntu.

  • What is not covered
    • Installing Ubuntu
    • How to convert your Belgacom router to a simple modem (i'll do this later).
  • What is covered
    • Installing Ipv6 over PPPoE in Ubuntu

License

This document contains common knowledge and information freely available from internet sources.

Disclaimer

When you use this documentation you acknowledge that the scientific and technical state-of-the-art when the Software was distributed did not enable all possible uses to be tested and verified, nor for the presence of possible defects to be detected. In this respect, your attention has been drawn to the risks associated with loading, using, modifying and/or developing and reproducing the Documentation and the Software it refers to, which are reserved for experienced users.

You shall be responsible for verifying, by any or all means, the suitability of the Documentation and the Software it refers to, for its requirements, its good working order, and for ensuring that it shall not cause damage to either persons or properties.

Warranty

Because the documentation is licensed free of charge, there is no warranty to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the documentation "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the documentation and the software it refers to is with you. Should the documentation contain inaccurate, misleading, dangerous, addictive, unethical or illegal information, you assume the cost of all necessary servicing, repair or correction.

In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute the documentation, be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use of the documentation and the software it refers to (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties), even if such holder or other party has been advised of the possibility of such damages.

Credits

The information in this document is based on personal experience and information found on the internet. The following pages proved to be a great resource of information:

  1. http://askubuntu.com/questions/56890/ipv6-over-pppoe
  2. The generous people in the channel #ipv6 on irc.freenode.org
  3. Quite a bit of help from the computerclub www.tinaclub.be

Hardware

This howto assumes that:

  • eth0 is LAN
  • eth1 is WAN (ppp0)

Ipv4

PPPoE

apt-get install ppp pppoeconf
pppoeconf
#Set username and password
nano -w /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.105
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

auto dsl-provider
iface dsl-provider inet ppp
pre-up /sbin/ifconfig eth1 up # line maintained by pppoeconf
provider dsl-provider

auto eth1
iface eth1 inet manual

Dhcp

apt-get install isc-dhcp-server
nano -w /etc/dhcp/dhcpd.conf
ddns-update-style none;

option domain-name "example.org";
option domain-name-servers 8.8.8.8, 8.8.4.4;

default-lease-time 600;
max-lease-time 7200;

authoritative;

log-facility local7;

subnet 192.168.1.0 netmask 255.255.255.0 {
  interface eth0;
  range 192.168.1.50 192.168.1.70;
  option routers 192.168.1.105;
}
service isc-dhcp-server restart

Iptables

apt-get install iptables
nano -w /etc/ppp/ip-up.d/ipv4masq.bash
IPTABLES=/sbin/iptables
DEPMOD=/sbin/depmod
MODPROBE=/sbin/modprobe
EXTIF="ppp0"
INTIF="eth0"
echo "External Interface:  $EXTIF"
echo "Internal Interface:  $INTIF"

$DEPMOD -a
$MODPROBE ip_tables
$MODPROBE ip_conntrack
$MODPROBE ip_conntrack_ftp
$MODPROBE ip_conntrack_irc
$MODPROBE iptable_nat
$MODPROBE ip_nat_ftp
#$MODPROBE ip_nat_irc

echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4/ip_dynaddr

$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F

$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -j LOG

$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
nano -w /etc/ppp/ip-up
/etc/ppp/ip-up.d/ipv4masq.bash

Ipv6

PPPoE

nano -w /etc/ppp/options
#add this line at the end
+ipv6 ipv6cp-use-ipaddr

When you restart you should be able to:

ping6 www.google.com

sysctl.conf

nano -w /etc/sysctl.conf
# Uncomment the next line to enable packet forwarding for IPv6
#  Enabling this option disables Stateless Address Autoconfiguration
#  based on Router Advertisements for this host
net.ipv6.conf.all.forwarding=1
net.ipv6.conf.ppp0.accept_ra=2

You'll have to reboot for that to take effect and for the moment you will not be able to ping6 anymore.

wide-dhcpv6-client

apt-get install wide-dhcpv6-client
nano -w /etc/wide-dhcpv6/dhcp6c.conf
interface ppp0 {
    # Request Prefix Delegation on ppp0, and give the received prefix id 0
    send ia-pd 0;
};

# Use subnets from the prefix with id 0
id-assoc pd 0 {
    prefix-interface eth0 {
        # Assign subnet 1 to eth0
        sla-len 8; # <----- BELANGRIJK: 8 omdat ons klein net 64 en ons groot 56 is en dat het verschil is
        sla-id 1;
    };
};
/etc/init.d/wide-dhcpv6-client restart

radvd

apt-get install radvd
nano -w /etc/radvd.conf
interface eth0
{
    AdvSendAdvert on;
    prefix ::/64
    {
        AdvOnLink on;
        AdvAutonomous on;
        AdvRouterAddr on;
    };
RDNSS 2001:4860:4860::8888  2001:4860:4860::8844
        {
                # AdvRDNSSLifetime 3600;
        };
};
/etc/init.d/radvd restart