Difference between revisions of "Bering-uClibc 7.x - User Guide - IPv6 Networking - External Network Connections"

From bering-uClibc
Jump to: navigation, search
(Step 2: Declare the ppp and pppoe modules)
 
Line 1: Line 1:
 
{| summary="Navigation header" width="100%"
 
{| summary="Navigation header" width="100%"
! colspan="3" align="center" | [[Bering-uClibc 7.x - User Guide - IPv4 Networking - External Network Connections|IPv4 Networking - External Network Connections]]
+
! colspan="3" align="center" | [[Bering-uClibc 7.x - User Guide - IPv6 Networking - External Network Connections|IPv6 Networking - External Network Connections]]
 
|-
 
|-
 
| width="20%" align="left"  |  
 
| width="20%" align="left"  |  
 
! width="60%" align="center" | [[Bering-uClibc 7.x - User Guide]]
 
! width="60%" align="center" | [[Bering-uClibc 7.x - User Guide]]
| width="20%" align="right"  | [[Bering-uClibc 7.x - User Guide - IPv4 Networking - Internal Network Connections|Next]]
+
| width="20%" align="right"  | [[Bering-uClibc 7.x - User Guide - IPv6 Networking - Configure Shorewall6|Next]]
 
|}
 
|}
 
----
 
----
  
  
==Ethernet (e.g. Cable Modem)==
+
==Native IPv6==
 +
===Ethernet (e.g. Cable Modem or ISP-supplied ADSL Router)===
 +
If you are fortunate enough to be using [[Bering-uClibc]] as a router / firewall with an ISP who provides a native IPv6 connection, or you are using [[Bering-uClibc]] as a client (rather than a router) on an IPv6-enabled network then external IPv6 networking will work on [[Bering-uClibc]] Release 5.2 onwards.
 +
(A relatively recent version of dhcpcd is required to enable DHCPv6 support, and 5.2 will be the first release to incorporate a suitable version.)
  
===Objectives===
+
By default, file <code class=filename>/etc/dhcpcd.conf</code> is set for IPv4-only DHCP behaviour and the configuration file entry <tt>ipv4only</tt> needs to be commented-out (for dual-stack IPv4 & IPv6) or replaced with <tt>ipv6only</tt> if DHCPv4 is not required.
We assume here that you want to connect your LEAF router to the Internet via an Ethernet connection attached to the "first" Ethernet port on the LEAF machine (i.e. the port that Linux knows as <tt>eth0</tt>).
+
  
Such connections are often used in conjunction with Cable Modems.
+
Take care to configure Shorewall6 (assuming you are using it) to enable DHCP on the external interface, specifying <tt>dhcp</tt> in file <code class=filename>/etc/shorewall6/interfaces</code>.
  
The configuration required is different for DHCP versus Static IP addresses.
+
There are a significant number of configurable options for DHCPv6 in file <code class=filename>/etc/dhcpcd.conf</code>, for example if you wish to configure RFC 3633 IPv6 address Prefix Delegation. See the dhcpcd documentation for further details.
  
===DHCP IP Address===
+
===PPPoE===
====Packages====
+
Using IPv6 with a PPPoE connection requires a combination of multiple tools.
The standard [[Bering-uClibc 7.x]] disk Images ship with the <code class="filename">dhcpcd.lrp</code> (DHCP Client Daemon) Package included in the <tt>LRP</tt> list within <code class="filename">leaf.cfg</code>, so no action is required to load this Package.
+
With IPv4 the PPP Link Control Protocol (LCP) takes care of communicating the IPv4 address, the details of DNS servers etc. to the PPP client but the IPv6 Control Protocol (IPV6CP) described in RFC 2472 will only configure a Link-Local IPv6 address for the PPP client.
<code class="filename">dhcpcd.lrp</code> replaces <code class="filename">pump.lrp</code> which was used for previous [[Bering-uClibc]] releases.
+
An alternative mechanism (typically DHCPv6) needs to be used to communicate the other details so it is necessary to run a DHCPv6 client like dhcpcd or dibbler-client on the PPP link and to configure this for IPv6 only to stop it interfering with the IPv4 settings which are typically set using LCP.
 +
(It's then also necessary to use a further tool like dnsmasq or radvd to communicate Router Advertisement details to internal networks, if you are running an IPv6 router.)
  
====Interfaces File====
+
====PPP Configuration====
The standard [[Bering-uClibc 7.x]] disk Images also ship with <code class="filename">/etc/network/interfaces</code> configured to run DHCP on the External interface.
+
The following assumes an already-working IPv4 PPPoE configuration.
The relevant lines in this file are as follows and again no action is required:
+
As long as your PPP provider supports IPv6 and IPV6CP, the minimal requirement is to switch on IPV6CP support in pppd by adding the following line to file <code class=filename>/etc/ppp/options</code>:
  # Option 1.1 (default): eth0 / dynamic IP from dhcpcd
+
+ipv6
auto eth0
+
Without this you will get error messages like the following in file <code class=filename>/var/log/ppp.log</code>:
iface eth0 inet dhcp
+
  Unsupported protocol 'IPv6 Control Protocol' (0x8057) received
  
====DNS====
+
Unlike IPv4, bringing up an IPv6 PPP connection does '''not''' create a default route automatically.
'''Warning:''' The connection to upstream DNS servers will '''NOT''' work unless the configuration is changed as described below.
+
This can be done by creating a script which runs whenever an IPv6 PPP connection is established.
 +
Assuming that Package <code class="filename">pppscrpt.lrp</code> has been loaded, create a script called e.g. <code class="filename">/etc/ppp/ipv6-up.d/10-defaultroute</code> containing the following:
 +
#!/bin/sh
 +
/sbin/ip -6 route '''add''' default via ${PPP_REMOTE} dev ${PPP_IFACE}
 +
and another called e.g. <code class="filename">/etc/ppp/ipv6-down.d/90-defaultroute</code> containing:
 +
#!/bin/sh
 +
/sbin/ip -6 route '''del''' default via ${PPP_REMOTE} dev ${PPP_IFACE}
 +
which should ensure that default routes are created and removed automatically, as required.
  
<code class="filename">dhcpcd.lrp</code> will obtain the IP addresses for upstream DNS servers as long as these are specified by your ISP as part of the DHCP lease.
+
====DHCPCD Configuration====
The DNS server details are written to file <code class="filename">/etc/dhcpc/resolv.conf</code> but by default this is '''NOT''' referenced by the DNS server running on the LEAF router.
+
The following assumes that dhcpcd is not being used for other purposes (in particular not for IPv4) and that you want to grab a block of IPv6 addresses via Prefix Delegation to assign to other networks connected to a router.
  
Follow the instructions on the [[Bering-uClibc 7.x - User Guide - IPv4 Networking - Configure Dnsmasq#Using dnsmasq with dhcpcd|dnsmasq]] page in order to have <code class="filename">dnsmasq.lrp</code> (which implements the local DNS server) reference the upstream DNS servers obtained by <code class="filename">dhcpcd.lrp</code>.
+
Edit <code class="filename">/etc/dhcpcd.conf</code> to read something like the following:
  
'''Question:''' Should we include this configuration setting as part of the default [[Bering-uClibc 7.x]] configuration?
+
  # Turn off IPv4 support
 
+
  ipv6only
'''New Question:''' Should we rather use the more standard <code class="filename">/etc/resolv.conf</code> by changing <code class="filename">upstream_resolv_conf_dir="/etc/dhcpcd"</code> to <code class="filename">upstream_resolv_conf_dir="/etc"</code> in <code class="filename">/libexec/dhcpcd-hooks/20-resolv.conf</code>, this way we don't have to modify [[Bering-uClibc 7.x - User Guide - IPv4 Networking - Configure Dnsmasq#Using dnsmasq with dhcpcd|dnsmasq]] at all.
+
 
+
===Static IP Address===
+
====Packages====
+
When using a static IP address which has been issued by your ISP there is no need for <code class="filename">dhcpcd.lrp</code> and this should be removed from the <tt>LRP</tt> list within <code class="filename">leaf.cfg</code>.
+
 
+
====Interfaces File====
+
File <code class="filename">/etc/network/interfaces</code> needs to be edited to comment out the default (<tt>Option 1.1</tt>) block of lines and un-comment the <tt>Option 1.2</tt> block of lines which relate to a static IP address.
+
The un-commented lines need to be edited to match the details provided by your ISP. For reference, the structure of the <tt>Option 1.2</tt> block (with the relevant lines un-commented) is as follows:
+
  # Option 1.2: eth0 / Fixed IP (assumed to be 1.2.3.4 on a /24 network).
+
#              (broadcast/gateway optional)
+
auto eth0
+
iface eth0 inet static 
+
        address 1.2.3.4
+
        netmask 255.255.255.0
+
        broadcast 1.2.3.255
+
        gateway 1.2.3.1
+
 
+
====DNS====
+
When you have a static IP address your ISP will normally also provide details of the DNS server(s) to be used.
+
The relevant IP address(es) should be added to <code class="filename">/etc/resolv.conf</code>.
+
Dnsmasq refers to this file by default.
+
 
+
See [[Bering-uClibc 7.x - User Guide - IPv4 Networking - Internal Network Connections#resolv.conf_.28.2Fetc.2Fresolv.conf.29|this page]] for details of the <code class="filename">/etc/resolv.conf</code> file syntax.
+
 
+
 
+
==PPPoE==
+
 
+
===Objectives===
+
We assume here that you want to connect your LEAF router to the Internet via an ADSL PPPoE connection. What is described here corresponds to section 3.2.3 of the [http://en.tldp.org/HOWTO/DSL-HOWTO/configure.html DSL How-To] document. Your ADSL modem is supposed to be connected to eth0, while the traffic to your internal network goes through eth1.
+
 
+
The [http://en.tldp.org/HOWTO/PPP-HOWTO/index.html PPP-Howto] and the [http://en.tldp.org/HOWTO/DSL-HOWTO/index.html DSL-Howto] are two useful references for this section.
+
 
+
===Step 1: Declare the pppoe package===
+
The pppoe Package (and ppp which pppoe requires) are provided on the Bering-uClibc Images, but are not activated by default.
+
 
+
Boot a Bering-uClibc Image. Once the LEAF menu appears get access to the linux shell by (q)uitting the menu. Edit the <code class="filename">leaf.cfg</code> file and '''replace''' the <code class="filename">dhcpcd</code> entry by <code class="filename">pppoe</code> in the list of Packages to be loaded at boot. Check
+
[[Bering-uClibc 7.x - User Guide - Basic Configuration - LEAF Packages#Configuring_leaf.cfg|LEAF Packages]] to learn how to do that.
+
The ppp.lrp Package is also required (and should be present on the disk) but gets loaded automatically and does not need to be specified in <code class="filename">leaf.cfg</code>.
+
 
+
For IPv4, the PPP negotiation includes the same sort of information that would be obtained using DHCP - DNS servers, netmask, gateway etc. - which is why there is no requirement for a DHCP client (like dhcpcd) when using PPP.
+
If you happen to be using IPv6 via PPPoE you will find that you need to use DHCPv6 ''in addition to'' PPP for full configuration.
+
See [[Bering-uClibc 7.x - User_Guide - IPv6 Networking - External Network Connections|this page]] for more details.
+
 
+
===Step 2: Declare the ppp and pppoe modules===
+
In order to have a PPPoE connection working, you need to have ppp and pppoe support enabled through the appropriate kernel modules.
+
You also need to make sure the driver(s) module(s) of your network card(s) has been loaded.
+
All the modules which are necessary for a PPPoE connection are provided on the standard Bering-uClibc Images. You just need to "declare" them since they are not loaded by default. As far as your network cards are concerned, the most popular driver modules are provided in <code class="filename">/lib/modules</code> but you might need to add the one corresponding to your own hardware from the Bering-uClibc <code class="filename">modules.tgz</code> on your boot media. Refer to the Bering-uClibc [[Bering-uClibc 7.x - User Guide - Basic Configuration - Basic System Configuration|Basic System Configuration]] to learn how to do that.
+
 
+
To declare your modules, go to the '''LEAF configuration menu''' and choose '''Packages configuration''', then '''modules'''. Enter 1) '''kernel modules to load at boot''' to edit the <code class="filename">/etc/modules</code> file and uncomment the line that relates to a PPPoE connection:
+
 
+
  # Modules needed for PPP/PPPOE connection                 
+
pppoe
+
 
+
'''Important:''' The <code class="filename">/etc/modules</code> file provided in the [[Bering-uClibc]] distro is already setup with the entry commented out. Just remove the leading # sign to activate  the corresponding module.
+
 
+
===Step 3: Configure ppp===
+
In the normal situation, you won't have to do anything here, the ppp is preconfigured for the standard situation.
+
 
+
Connection with your ISP will be handled by PPP. The [http://en.tldp.org/HOWTO/PPP-HOWTO/index.html PPP Howto] document will give you very detailed information about this protocol and how to set-up its numerous parameters.
+
 
+
Please refer to the [[Bering-uClibc 7.x - User Guide - IPv4 Networking - External Network Connections#Serial_Modem|Serial Modem]] section of this user's guide to learn how to configure your ppp package.
+
 
+
The default options provided with the <code class="filename">ppp.lrp</code> should work and if you are not familiar with ppp leave them at first. After you get a connection you can "fine tune" your setup.
+
 
+
===Step 4: Configure pppoe===
+
Through the LEAF Package configuration menu choose pppoe. The following menu will appear:
+
 
+
                        pppoe configuration files
+
 
   
 
   
        1) DSL pppd options
+
# Generate an RFC 4361-compliant DHCP Unique IDentifier, or read it from /etc/dhcpcd.duid
 +
duid
 
   
 
   
  q) quit
+
  # Turn on Rapid Commit support
  ----------------------------------------------------------------------------
+
  option rapid_commit
        Selection:
+
 
+
Entry 1) allows you to adjust the parameter of your ppp connection through the <code class="filename">/etc/ppp/peers/dsl-provider</code> file. The most important argument is the <span class="emphasis">''name''</span> parameter which defines your login name.
+
 
+
Replace the field following the user statement in the <code class="filename">/etc/ppp/peers/dsl-provider</code> [ "login@isp.com" ] by the login name provided by your ISP.
+
 
+
  <nowiki> # Configuration file for PPP, using PPP over Ethernet
+
  # to connect to a DSL provider.
+
#
+
plugin /usr/lib/pppd/rp-pppoe.so
+
 
+
# MUST CHANGE: Uncomment the following line, replacing the user@provider.net
+
# by the DSL user name given to your by your DSL provider.
+
# (There should be a matching entry in /etc/ppp/pap-secrets with the password.)
+
name "eric12345@foobar.com"
+
 
+
(...)
+
</nowiki>
+
 
+
Through the LEAF packages configuration menu get access to ppp configuration. The following menu will show-up
+
 
+
                        ppp configuration files
+
 
   
 
   
        1) ISP pppd options
+
# Request details of DNS Servers
        2) ISP login script
+
option domain_name_servers
        3) System wide pppd options
+
        4) chap secret
+
        5) pap secret
+
 
   
 
   
  q) quit
+
  # A ServerID is required by RFC2131
  ----------------------------------------------------------------------------
+
  require dhcp_server_identifier
        Selection:
+
 
+
Entry 5) allows you to edit the <code class="filename">/etc/ppp/pap-secrets</code>. Enter in this file the login and password provided by your ISP. Your login name must '''exactly''' match the one given in the previous <code class="filename">/etc/ppp/peers/dsl-provider</code> file. If you have special characters in secret or username, you should put them in quotes
+
 
+
  <nowiki> # This is a pap-secrets file
+
#
+
#papname * papsecret
+
"eric12345@foobar.com" * "secretfoo"
+
</nowiki>
+
 
+
If you want to authenticate using CHAP, add the same entry to the CHAP item instead.
+
 
+
===Step 5: Configure your interfaces file===
+
Through the LEAF configuration menu type 1 to access to the network configuration menu and 1 again to edit your <code class="filename">/etc/network/interfaces</code> file. Enter the following information:
+
 
+
  auto lo ppp0 eth1
+
 
   
 
   
  iface lo inet loopback
+
  # We provide a hook script to lookup the hostname if not set by the DHCP
 +
# server, but we should not run it by default
 +
nohook hostname
 
   
 
   
iface ppp0 inet ppp
 
        pre-up ip link set eth0 up
 
        provider dsl-provider eth0
 
 
   
 
   
  iface eth1 inet static
+
  # Only operate on the listed interfaces
    address 192.168.1.254
+
  allowinterfaces ppp0 eth1 eth2
    netmask 255.255.255.0
+
    broadcast 192.168.1.255
+
 
+
In this <code class="filename">/etc/network/interfaces</code> file the lo, ppp0 and eth1 interfaces are brought up automatically when the <span class="emphasis">''ifup -a''</span> statement is executed at boot time by the <code class="filename">/etc/init.d/networking</code> script.
+
 
+
The "iface ppp0 inet ppp" says:
+
 
+
* Execute the "ip link set eth0 up" command BEFORE ppp0 is activated (pre-up statement)
+
* Execute the <code class="filename">/sbin/pon dsl-provider eth0</code> script to establish the PPPoE connection. The <code class="filename">dsl-provider</code> file used as input by <code class="filename">/sbin/pon</code> is provided in the pppoe.lrp package.
+
 
+
The "iface eth1 inet static" defines the internal address of the router.
+
 
+
===Step 6: Configure Shorewall===
+
Through the LEAF packages configuration menu, choose shorwall and check the three following files:
+
 
+
A) The <code class="filename">interfaces</code> file (entry 4) defines your interfaces. Here connection to the net goes through ppp0. So we must set:
+
 
+
<nowiki> (...)
+
#ZONE  INTERFACE      OPTIONS
+
net    ppp0            routefilter
+
loc    eth1           dhcp
+
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE
+
</nowiki>
+
 
+
B) The <code class="filename">masq</code> file (entry 8). With a PPPoE setup it should look like:
+
 
+
<nowiki> (...)
+
#INTERFACE:DEST        SOURCE
+
ppp0                    192.168.1.0/24
+
#LAST LINE -- ADD YOUR ENTRIES ABOVE THIS LINE -- DO NOT REMOVE
+
</nowiki>
+
 
+
C) You may also need to edit the <code class="filename">config</code> file (entry 11) to adjust the CLAMPMSS variable to "yes":
+
 
+
<nowiki> (...)
+
# Set this variable to "Yes" or "yes" if you want the TCP "Clamp MSS to PMTU"
+
# option. This option is most commonly required when your internet
+
# interface is some variant of PPP (PPTP or PPPoE). Your kernel must
+
#
+
# If left blank, or set to "No" or "no", the option is not enabled.
+
#
+
CLAMPMSS="yes"
+
(...)
+
</nowiki>
+
 
+
===Step 7: Configure dnsmasq===
+
This step is optional, but if IP addresses for DNS servers are supplied by your ISP as part of the PPP negotiation these will be written to file <code class="filename">/etc/ppp/resolv.conf</code>.
+
 
+
Follow the instructions on the [[Bering-uClibc 7.x - User Guide - IPv4 Networking - Configure Dnsmasq#Using dnsmasq with ppp/pppoe|dnsmasq]] page in order to have <code class="filename">dnsmasq.lrp</code> (which implements the local DNS server) reference the upstream DNS servers obtained by PPPoE.
+
 
+
===Step 8: Configure up/down scripts===
+
Another optional step, but if you wish to configure custom actions when PPP (including PPPoE) connections are brought up or taken down there is a useful Package called <code class="filename">pppscrpt.lrp</code> which creates a structure of files and directories under <code class="filename">/etc/ppp/</code> which can be used to add custom action scripts.
+
 
+
Any files created in or under directory <code class="filename">/etc/ppp/</code> are automatically backed up when the [[Bering-uClibc]] configuration is saved (thanks to a setting which is part of <code class="filename">ppp.lrp</code>) so it is not essential to add <code class="filename">pppscrpt.lrp</code> to <code class="filename">leaf.cfg</code>; simply load it interactively using e.g.
+
# apkg -i /mnt/pppscrpt.lrp
+
Note however that empty directories are '''not''' backed-up so those will disappear on a reboot, but can be re-created by re-loading the Package.
+
 
+
For example, to run a command whenever a PPP (IPv4) connection is established, create a script in directory <code class="filename">/etc/ppp/ip-up.d/</code>
+
 
+
===Step 9: Save the changes===
+
To save the changes, start <span class="command">lrcfg</span>. The added modules will be saved to moddb with the command "<span class="command">'''m'''</span>) Backup modules". The configuration changes are saved with "<span class="command">'''s'''</span>) Save config".
+
 
+
===Step 10: Reboot...===
+
Your modem connection should be established automatically. Type <span class="emphasis">''plog''</span> to check the login sequence with your ISP. If there is no output check the various logs in <code class="filename">/var/log/</code> to get a clue on potential problems.
+
 
+
===An example: a PPPoE connection with a two PCMCIA cards setup===
+
C. Hostelet is using an old laptop as a Bering-uClibc router. His hardware configuration consists of one HP Omnibook 3000 laptop (Pentium 233Mhz, 144MB Ram, CD-Rom drive module, no floppy, no HDD), one Xircom CEM56 Modem/ethernet PCMCIA card and one 3Com 3C589 PCMCIA card. The connection to the net is provided through the first PCMCIA card connected to an Alcatel SpeedTouch Home ethernet modem which gives him access to France Telecom "Netissimo" ADSL service. The connection to the local network is done trough the second PCMCIA card.
+
 
+
Here is his <code class="filename">/etc/network/interfaces</code> file:
+
 
+
auto lo
+
 
   
 
   
  iface lo inet loopback
+
  # Turn off IPv6 Router Solicitation globally (so it can be turned back on selectively for individual interfaces)
 +
noipv6rs
 
   
 
   
  iface eth0 inet static
+
  # Subsequent lines apply only to interface ppp0
    address 10.0.0.1
+
interface ppp0
    netmask 255.255.255.0
+
    # Turn IPv6 Router Solicitation back on for this interface
    broadcast 10.0.0.255
+
    ipv6rs
    up pon dsl-provider eth0
+
    up shorewall restart
+
    down shorewall stop
+
    down poff
+
 
   
 
   
iface eth1 inet static
+
    # Request an address using DHCPv6 for interface ppp0, using iaid 1
    address 192.168.1.254
+
    ia_na 1
    netmask 255.255.255.0
+
    broadcast 192.168.1.255
+
    up /etc/init.d/dnscache restart
+
    down /etc/init.d/dnscache stop
+
 
+
Only lo is brought up automatically at boot time. eth0 and eth1 are brought up by the PCMCIA cardmgr program which calls the <code class="filename">/etc/pcmcia/network</code> script.
+
 
+
The connection with the Alcatel speedtouch modem is done through the eth0 interface at address 10.0.0.1
+
 
+
Once the eth0 interface is up the pppd daemon is called by the pon script. Shorewall must then be restarted since eth0 was not available at boot time.
+
 
+
Once the eth1 interface is up we restart dnscache which could not start at boot time since eth1 was not available.
+
 
+
==PPTP/PPPoA==
+
 
+
===Objectives===
+
We assume here that you want to connect your LEAF router to the Internet via an Alcatel SpeedTouch home ADSL modem which supports both PPPoE and PPPoA connections. The PPPoE connection is covered in another section. For the PPPoA connection, we assume that your modem is connected to a dedicated NIC as eth0 and will communicate with your router through the pptp protocol. What is described here corresponds to section 3.2.5 of the [http://en.tldp.org/HOWTO/DSL-HOWTO/configure.html DSL How-To] document. The traffic to your internal network goes through eth0 while access to the Internet via PPPoA goes through ppp0.
+
 
+
The [http://en.tldp.org/HOWTO/PPP-HOWTO/index.html PPP-Howto], the [http://pptpclient.sourceforge.net/ PPTP-Client] project and the [http://en.tldp.org/HOWTO/DSL-HOWTO/index.html DSL-  Howto] are useful references for this section.
+
 
+
Thanks to Eric de Thouars, who suggested the required adjustment to Shorewall for this setup to work properly.
+
 
+
===Step 1: Declare the ppp and the pptp packages===
+
Boot a Bering-uClibc Image. Once the LEAF menu appears get access to the linux shell by (<span class="command">'''q'''</span>)uitting the menu. Mount the boot media and edit the <code  class="filename">leaf.cfg</code> file. <span class="emphasis">''Replace''</span> the dhcpcd entry by ppp,pptp in the list of packages to be loaded at boot. Check
+
[[Bering-uClibc 4.x - User Guide - Basic Configuration - LEAF Packages#Configuring_leaf.cfg|LEAF Packages]] to learn how to do that.
+
Your <code class="filename">leaf.cfg</code> file will then look like (adjust to your tastes):
+
 
+
LRP="root,etc,local,modules,iptables,ppp,pptp,keyboard,shorwall,ulogd,dnsmasq"
+
 
+
'''Important:''' The line ("root ... dnsmasq") must be typed as a single one in <code class="filename">leaf.cfg</code>
+
 
+
The ppp and pptp package (<code class="filename">pptp.lrp</code>) are provided on the standard Bering-uClibc Images.
+
 
+
===Step 2: Declare the ppp modules===
+
In order to have a PPTP/PPPoA connection working, you need to have ppp support enabled through the appropriate kernel modules. You also need to make shure the driver(s) module(s) of your network card(s) has been loaded.
+
 
+
All the modules which are necessary for a PPTP/PPPoA connection are provided on the standard Bering-uClibc Images. You just need to "declare" them since they are not loaded by default. As far as your network cards are concerned, the most popular driver modules are provided in <code class="filename">/lib/modules</code> but you might need to add the one corresponding to your own hardware from the Bering-uClibc <code class="filename">modules.tgz</code> on your boot media. Refer to the Bering-uClibc [[Bering-uClibc 7.x - User Guide - Basic Configuration - Basic System Configuration|Basic System Configuration]] to learn how to do that.
+
 
+
To declare your modules, go to the LEAF Packages configuration menu and choose modules. Enter 1) to edit the <code class="filename">/etc/modules</code> file and enter the following information:
+
 
+
<nowiki>
+
 
+
# Modules needed for PPTP/PPPoA connection
+
slhc
+
n_hdlc
+
ppp_generic
+
ppp_async
+
 
+
# Masquerading 'helper' modules
+
ip_conntrack_ftp
+
ip_conntrack_irc
+
ip_nat_ftp
+
ip_nat_irc</nowiki>
+
 
+
'''Important:''' The <code class="filename">/etc/modules</code> file provided in the Bering-uClibc distro is already setup with those entries commented out. Just remove the leading # sign to activate the corresponding module.
+
 
+
===Step 3: Configure ppp===
+
Connection with your ISP will be handled by PPP. The [http://en.tldp.org/HOWTO/PPP-HOWTO/index.html PPP Howto] document will give you very detailed information about this protocol and how to set-up its numerous parameters.
+
 
+
Through the LEAF packages configuration menu get access to ppp configuration. The following menu will show-up:
+
 
+
                        ppp configuration files
+
 
   
 
   
        1) ISP pppd options
+
    # Request a block of IPv6 addresses using DHCPv6 Prefix Delegation via ppp0 (using iaid 2) and
        2) ISP login script
+
     # allocate a portion of the allocated address range to eth1 (which has sla_id 1) and another portion to eth2 (which has sla_id 2)
        3) System wide pppd options
+
     ia_pd 2 eth1/1 eth2/2
        4) chap secret
+
        5) pap secret
+
+
  q) quit
+
  ----------------------------------------------------------------------------
+
        Selection:
+
 
+
Enter 1) and 2) and empty out the corresponding files completely.
+
 
+
Enter 3) allows you to adjust the parameter of your ppp connection through the <code class="filename">/etc/ppp/options</code> file. This file must contain:
+
 
+
debug
+
name "ISPUserID"
+
noauth
+
noipdefault
+
defaultroute
+
 
+
Edit either the CHAP (Entry 4) or PAP (Entry 5) option to set up how your system authenticates.
+
 
+
For PAP authentication, choose the PAP option and add a line saying "&lt;ISPUserID&gt; * &lt;ISPUserPassword&gt; to the bottom of the file. &lt;ISPUserID&gt; is the same entry that you  made in Entry 3) - the "System wide pppd options" file. The &lt;ISPUserPassword&gt; entry is self-explanatory. The "*" can be replaced with the IP address or name of the server you are  dialling into if you know it. Usually, an asterisk is sufficient.
+
 
+
If you want to authenticate using CHAP, add the same entry to the CHAP item instead.
+
 
+
===Step 4: Configure your interfaces file===
+
Through the LEAF configuration menu type 1 to access to the network configuration menu and 1 again to edit your <code class="filename">/etc/network/interfaces</code> file. Enter the following information:
+
 
+
auto lo eth0 eth1
+
+
iface lo inet loopback
+
+
iface eth0 inet static
+
    address 10.0.0.1
+
    netmask 255.255.255.0
+
    broadcast 10.0.0.255
+
    up pptp 10.0.0.138
+
+
iface eth1 inet static
+
    address 192.168.1.254
+
    masklen 255.255.255.0
+
    broadcast 192.168.1.255
+
 
+
In this <code class="filename">/etc/network/interfaces</code> file the lo, eth0 and eth1 interfaces are brought up automatically when the <span class="emphasis">''ifup -a''</span> statement is executed at boot time by the <code class="filename">/etc/init.d/networking</code> script.
+
 
+
The "iface eth0 inet static" section defines the external address of the router and says:
+
* Bring up eth0 at address 10.0.0.1
+
* Execute the <code class="filename">pptp 10.0.0.138</code> command once eth0 is up to establish the PPTP/PPPoA connection.
+
The "iface eth1 inet static" defines the internal address of the router.
+
 
+
===Step 5: Configure Shorewall===
+
Through the LEAF packages configuration menu, choose shorwall and check the three following files:
+
 
+
A) The <code class="filename">interfaces</code> file (entry 3) defines your interfaces. Here connection to the net goes through ppp0. So we must set:
+
 
+
<nowiki> (...)
+
#ZONE  INTERFACE      BROADCAST      OPTIONS
+
net    ppp0            -              routefilter
+
adsl    eth0            10.0.0.255
+
loc    eth1            detect          routestopped
+
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE</nowiki>
+
 
+
'''Warning:''' Do not forget the "-" under the BROADCAST heading for the net/ppp0 entry.
+
 
+
B) Add the following line to <code class="filename">/etc/shorewall/policy</code>. Now the policy for traffic between the firewall and the adsl zone is set to ACCEPT:
+
 
+
<nowiki> (...)
+
fw     adsl    ACCEPT</nowiki>
+
 
+
C) The <code class="filename">masq</code> file (entry 8). With a dial-up modem setup it should look like:
+
 
+
<nowiki> (...)
+
#INTERFACE              SUBNET
+
ppp0                    eth1
+
#LAST LINE -- ADD YOUR ENTRIES ABOVE THIS LINE -- DO NOT REMOVE</nowiki>
+
 
+
D) You may also need to edit the <code class="filename">config</code> file (entry 12) to adjust the CLAMPMSS variable to "yes":
+
 
+
<nowiki> (...)
+
# Set this variable to "Yes" or "yes" if you want the TCP "Clamp MSS to PMTU"
+
# option. This option is most commonly required when your internet
+
# interface is some variant of PPP (PPTP or PPPoE). Your kernel must
+
#
+
# If left blank, or set to "No" or "no", the option is not enabled.
+
#
+
CLAMPMSS="yes"
+
(...)</nowiki>
+
 
+
===Step 7: Save the changes===
+
To save the changes, start <span class="command">lrcfg</span>. The added modules will be saved to moddb with the command "<span class="command">'''m'''</span>) Backup modules". The configuration changes are saved with "<span class="command">'''s'''</span>) Save config".
+
 
+
===Step 8: Reboot...===
+
Your modem connection should be established automatically. Type <span class="emphasis">''plog''</span> to check the login sequence with your ISP. If there is no output check the logs in <code class="filename">/var/log/</code> to get a clue on potential problems.
+
 
+
 
+
==PPPoA==
+
 
+
===Objectives===
+
We assume here that you want to connect your LEAF router to the Internet via PPPoA. The [http://leaf.sourceforge.net/doc/guide/bucu-pppoe3.html PPPoE connection] is covered in another section of this user's guide. So is the [http://leaf.sourceforge.net/doc/guide/bucu-pppoa3.html PPTP/PPPoA connection]. What is described here corresponds to section 3.2.4 of the [http://en.tldp.org/HOWTO/DSL-HOWTO/configure.html DSL How-To] document. The traffic to your internal network goes through eth0 while access to the Internet via PPPoA goes through ppp0.
+
 
+
The [http://en.tldp.org/HOWTO/PPP-HOWTO/index.html PPP-Howto] and the [http://en.tldp.org/HOWTO/DSL-HOWTO/index.html DSL-Howto] are two useful references for this section.
+
 
+
===Step 1: Declare the pppoatm package===
+
In order to be able to get connected through PPPoA you will need to load the <code class="filename">pppoatm.lrp</code> package together with <code class="filename">ppp.lrp</code>.
+
 
+
Boot your Bering-uClibc Image. Once the LEAF menu appears get access to the linux shell by (q)uitting the menu. Edit the <code class="filename">leaf.cfg</code> file and '''replace''' the dhcpcd entry by pppoatm in the list of Packages to be loaded at boot. Check
+
[[Bering-uClibc 7.x - User Guide - Basic Configuration - LEAF Packages#Configuring_leaf.cfg|LEAF Packages]] to learn how to do that.
+
 
+
The <code class="filename">pppoatm.lrp</code> Package is available on your Bering-uClibc Image.
+
 
+
===Step 2: Declare the ppp and pppoatm modules===
+
In order to have a PPPoA connection working, you need to have both ppp and pppoatm support enabled through the appropriate kernel modules. You also need to declare the driver(s) module(s) of your network card(s). You also need to make shure the driver(s) module(s) of your network card(s) has been loaded.
+
 
+
All the modules which are necessary for ppp support are provided on the standard Bering-uClibc Images. You just need to "declare" them since they are not loaded by default.
+
As far as the pppoatm module and ATM drivers are concerned, you need to add them from the Bering-uClibc <code class="filename">modules.tgz</code> on your boot media. Refer to the Bering-uClibc [[Bering-uClibc 7.x - User Guide - Basic Configuration - Basic System Configuration|Basic System Configuration]] to learn how to do that.
+
 
+
To declare your modules, go to the LEAF Packages configuration menu and choose modules. Enter 1) to edit the <code class="filename">/etc/modules</code> file and enter the following information:
+
 
+
<nowiki>
+
# Modules needed for PPP connection
+
slhc
+
ppp_generic
+
 
+
# PPPOA support
+
pppoatm
+
 
+
# ATM-PCI "st" drivers
+
ambassador
+
 
+
# Masquerading 'helper' modules
+
ip_conntrack_ftp
+
ip_conntrack_irc
+
ip_nat_ftp
+
ip_nat_irc
+
</nowiki>
+
 
+
===Step 3: Configure pppoatm===
+
Connection with your ISP will be handled by PPP. The [http://en.tldp.org/HOWTO/PPP-HOWTO/index.html PPP Howto] document will give you very detailed information about this protocol and how to set-up its numerous parameters.
+
 
+
Through the LEAF packages configuration menu get access to pppoatm configuration. The following menu will show-up:
+
                        pppoatm configuration files
+
+
        1) DSL pppd options
+
+
  q) quit
+
  ----------------------------------------------------------------------------
+
        Selection:
+
 
+
Enter 1) and adjust the corresponding <code class="filename">/etc/ppp/peers/dsl-provider</code> file:
+
<nowiki> #
+
# Adjust here VP/VC - depends on country &amp; ISP
+
# UK/BT: 0.38 - US/BE/FR: 8.35
+
#
+
plugin /usr/lib/pppd/pppoatm.so 0.38
+
#
+
# If chap or pap identification uncomment the #name "ISPUserID" line
+
# and replace ISPUserID with your ISP user name
+
# There should be a matching entry in /etc/ppp/pap-secrets or chap-secrets
+
#
+
#name "ISPUserID"
+
lock
+
noipdefault
+
noauth
+
defaultroute
+
hide-password
+
lcp-echo-interval 20
+
lcp-echo-failure 3
+
maxfail 0
+
persist
+
</nowiki>
+
 
+
The most important parameters in this file are the VP.VC combination which depends on your country and/or your ISP and the name parameter.
+
 
+
Through the LEAF packages configuration menu get access to ppp configuration. The following menu will show-up:
+
 
+
                        ppp configuration files
+
+
        1) ISP pppd options
+
        2) ISP login script
+
        3) System wide pppd options
+
        4) chap secret
+
        5) pap secret
+
+
  q) quit
+
  ----------------------------------------------------------------------------
+
        Selection:
+
 
+
Edit either the CHAP (Entry 4) or PAP (Entry 5) option to set up how your system authenticates. If you edit chap, replace #ISPUserID and ISPUserPassword with the relevant information.
+
 
+
<nowiki> # Secrets for authentication using CHAP
+
# client        server  secret                  IP addresses
+
#ISPUserID     *      ISPUserPassword
+
</nowiki>
+
 
+
ISPUserID must exactly match the entry that you made for the name parameter in pppoatm Entry 1) "DSL pppd options" file. The "*" can be replaced with the IP address or name of the server you are dialling into if you know it. Usually, an asterisk is sufficient.
+
 
+
If you want to authenticate using PAP, add the same entry to the PAP item instead.
+
 
+
===Step 4: Configure your interfaces file===
+
Through the LEAF configuration menu type 1 to access to the network configuration menu and 1 again to edit your <code class="filename">/etc/network/interfaces</code> file. Enter the following information:
+
 
+
auto lo ppp0 eth0
+
 
+
iface lo inet loopback
+
 
+
iface ppp0 inet ppp
+
    provider dsl-provider
+
 
+
iface eth0 inet static
+
    address 192.168.1.254
+
    netmask 255.255.255.0
+
    broadcast 192.168.1.255
+
 
+
In this <code class="filename">/etc/network/interfaces</code> file the lo, ppp0 and eth0 interfaces are brought up automatically when the <span class="emphasis">''ifup -a''</span> statement is executed at boot time by the <code class="filename">/etc/init.d/networking</code> script.
+
 
+
The "iface ppp0 inet ppp" section defines the external address of the router and activates the <code class="filename">pon</code> script
+
 
+
The "iface eth0 inet static" defines the internal address of the router.
+
 
+
===Step 5: Configure Shorewall===
+
Through the LEAF packages configuration menu, choose shorwall and check the three following files:
+
 
+
A) The <code class="filename">interfaces</code> file (entry 3) defines your interfaces. Here connection to the net goes through ppp0. So we must set:
+
 
+
<nowiki> (...)
+
#ZONE  INTERFACE      BROADCAST      OPTIONS
+
net    ppp0            -
+
loc    eth0            detect          routestopped
+
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE
+
</nowiki>
+
 
+
'''Warning:''' Do not forget the "-" under the BROADCAST heading for the net/ppp0 entry.
+
 
+
B) The <code class="filename">masq</code> file (entry 8). It should look like:
+
 
+
<nowiki> (...)
+
#INTERFACE              SUBNET
+
ppp0                    eth0
+
#LAST LINE -- ADD YOUR ENTRIES ABOVE THIS LINE -- DO NOT REMOVE
+
</nowiki>
+
 
+
===Step 7: Save the changes===
+
To save the changes, start <span class="command">lrcfg</span>. The added modules will be saved to moddb with the command "<span class="command">'''m'''</span>) Backup modules". The configuration changes are saved with "<span class="command">'''s'''</span>) Save config".
+
 
+
===Step 8: Reboot...===
+
Your PPPoA connection should be established automatically. Type <span class="emphasis">''plog''</span> to check the login sequence with your ISP. If there is no output check the various  logs in <code class="filename">/var/log/</code> to get a clue on potential problems.
+
 
+
 
+
==Serial Modem==
+
 
+
===Objectives===
+
We assume here that you can only get connected to internet through a serial modem connection and that you want to share that connection with other (internal) computers in your home or office. What follows describes the configuration of this dial-up modem router. Your external interface (to the internet) will be ppp0, your internal interface (to your internal network) is assumed to be done through an Ethernet network card (eth0).
+
 
+
The [http://en.tldp.org/HOWTO/PPP-HOWTO/index.html PPP-Howto] is a useful reference for this section.
+
 
+
Bering-uClibc comes with two ppp daemons, one with filter support and one without. The <code class="filename">ppp-filter.lrp</code> Package can be used for demand-dialing mode and needs the <code class="filename">libpcap.lrp</code> Package. Before using the filter version, the package needs to be renamed to <code class="filename">ppp.lrp</code>.
+
 
+
The ppp source is version 2.4.4 and supports ipv6, mschapv2, mppe and optional pppoe, pppoatm or pppol2p with plugins
+
 
+
===Step 1: Declare the ppp package===
+
Boot your Bering-uClibc Image. Once the LEAF menu appears get access to the linux shell by (q)uitting the menu. Edit the <code class="filename">leaf.cfg</code> file and replace the  dhcpcd entry by ppp in the list of packages to be loaded at boot. Check
+
[[Bering-uClibc 7.x - User Guide - Basic Configuration - LEAF Packages#Configuring_leaf.cfg|LEAF Packages]] to learn how to do that.
+
 
+
===Step 2: Declare the ppp modules===
+
In order to have a modem dialup connection working, you need to have ppp support enabled through the appropriate kernel modules.
+
 
+
To configure your modules, go to the LEAF Packages configuration menu and choose modules. Enter 1) to edit the <code class="filename">/etc/modules</code> file and enter the following information:
+
 
+
# Modules needed for PPP connection
+
slhc
+
ppp_generic
+
ppp_async
+
ppp_deflate
+
+
# Masquerading 'helper' modules
+
ip_conntrack_ftp
+
ip_conntrack_irc
+
ip_nat_ftp
+
ip_nat_irc
+
 
+
===Step 3: Configure ppp===
+
Connection with your ISP will be handled by PPP. The [http://en.tldp.org/HOWTO/PPP-HOWTO/index.html PPP How-to] document will give you very detailed information about this protocol and how to set-up the numerous parameters.
+
 
+
Through the LEAF packages configuration menu get access to ppp configuration. The following menu will show-up:
+
 
+
                        ppp configuration files
+
+
        1) ISP pppd options
+
        2) ISP login script
+
        3) System wide pppd options
+
        4) chap secret
+
        5) pap secret
+
+
  q) quit
+
  ----------------------------------------------------------------------------
+
        Selection:
+
 
+
Entry 1) allows you to adjust the parameter of your ppp connection through the <code class="filename">/etc/ppp/peers/provider</code> file. The most important argument is the <span class="emphasis">''ttySx''</span> parameter which defines the serial port to which your modem is connected.
+
 
+
'''Tip:''' Look at your <code class="filename">/var/log/syslog</code> file after booting Bering-uClibc. It will give you the list of the serial ports recognized by your linux kernel.
+
 
+
A working <code class="filename">/etc/ppp/peers/provider</code> file for a Compuserve connection could look like:
+
 
+
# ISP pppd options file
+
# What follows is OK for Compuserve
+
#
+
noauth
+
debug          # log transaction to /var/log/messages
+
/dev/ttyS0      # (ttyS0=com1, ttyS1=com2, ...)
+
115200          # baud  rate
+
modem
+
crtscts        # use hardware flow control
+
asyncmap 0
+
defaultroute    # ppp becomes default route to the internet
+
noipdefault
+
lock            # don't let other processes besides PPP use the device
+
connect "/usr/sbin/chat -v -f /etc/chatscripts/provider"
+
 
+
If you plan to dial into a Windows RAS server or a server that uses PAP or CHAP authentication, you need to add a line to this file. Just above the "connect" command, on a line of its own, add:
+
 
+
name your_ISP_login
+
connect "/usr/sbin/chat -v -f /etc/chatscripts/provider"
+
 
+
You need this because ppp has to masquerade the firewall as you when using PAP or CHAP authentication.
+
 
+
Entry 2) allows you to adjust the communication script which will handle the connection with your ISP. This script is stored in the <code class="filename">/etc/chatscripts/provider</code>
+
 
+
A working script for a Compuserve connection could look like:
+
 
+
# ISP login script
+
# What follows is OK for Compuserve
+
# Adjust to your taste
+
ABORT "BUSY"
+
ABORT "NO CARRIER"
+
ABORT "VOICE"
+
ABORT "NO DIALTONE"
+
ABORT "NO ANSWER"
+
"" ATZ
+
# ISP telephone number: 124567890
+
OK ATDT1234567890#
+
CONNECT ''
+
Name: CIS
+
# With compuserve your_login_account=12345,6789
+
ID: your_login_account/go:pppconnect
+
Password: your_password
+
PPP
+
 
+
If you are not using Compuserve you should also delete all of the lines below the &lt;CONNECT ''&gt; line. A few - very few - ISPs require the final "PPP" line these days.
+
 
+
Edit Entry 3) - /etc/ppp/options "System-wide pppd options" if you want the system to demand dial and to drop the line if idle for a preset time. To do this, change "persist" to "demand" and add another line below "demand" that says "idle 600", where 600 is the number of seconds the system should wait before dropping hanging up if there is no network traffic.
+
 
+
Edit either the PAP (Entry 4) or CHAP (Entry 5) option to set up how your system authenticates. For PAP authentication, choose the PAP option and add a line giving your ISP login and password. Your ISP login must be the same entry as the one provided after the name entry in your ISP pppd options file. If you want to authenticate using CHAP, add the same entry to the CHAP item instead.
+
 
+
<nowiki># pppd: pap-secrets
+
# Secrets for authentication using PAP
+
# client        server  secret                  IP addresses
+
your_ISP_login    *    your_password</nowiki>
+
 
+
The "*" can be replaced with the IP address or name of the server you are dialling into if you know it. Usually, an asterisk is sufficient.
+
 
+
'''Important:''' If you do not know if your ISP is using PAP or CHAP authentication just provide the information on both pap-secrets and chap-secrets files. They have exactly the same structure.
+
 
+
===Step 4: Configure your interfaces file===
+
 
+
Through the LEAF configuration menu type 1 to access to the network configuration menu and 1 again to edit your <code class="filename">/etc/network/interfaces</code> file. Enter the following information:
+
 
+
auto lo ppp0 eth0
+
+
iface lo inet loopback
+
+
iface ppp0 inet ppp
+
        provider provider
+
+
iface eth0 inet static
+
        address 192.168.1.254
+
        netmask 255.255.255.0
+
        broadcast 192.168.1.255
+
 
+
The "auto" statement declares all the interfaces that will be automatically set up at boot time. This job will be carried out by the "ifup -a" statement in the <code class="filename">/etc/init.d/networking</code> script.
+
 
+
The syntax of "iface" statements is explained in the Bering-uClibc's User Guide.
+
 
+
===Step 5: Configure Shorewall===
+
Through the LEAF packages configuration menu, choose shorwall and check the two following files:
+
  
A) The <code class="filename">interfaces</code> file (entry 3) defines your interfaces. Here connection to the net goes through ppp0 and the connection to the internal network through  eth0. So we must set:
+
IAID stands for Interface Association IDentifier and is a unique way to identify each Interface on a Host (in conjunction with the DUID).
 +
SLA_ID stands for Site-Level Aggregation IDentifier and is a unique way to identify each separate subnet at a site (in conjunction with the DUID).
  
<nowiki>(...)
+
By configuring Router Solicitation on ppp0, this ''should'' mean that Router Advertisement packets are requested and - once received - used to configure routing on the ppp0 interface. However there are differences of opinion about whether it is correct to send RA packets on a PPP link, so some ISPs don't, and hence it is best to configure a default route a described in the PPP section above.
#ZONE  INTERFACE      BROADCAST      OPTIONS
+
net    ppp0           -
+
loc    eth0            detect          routestopped
+
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE</nowiki>
+
  
'''Warning:''' Do not forget the "-" under the BROADCAST heading for the net/ppp0 entry
+
It is of course necessary to start and stop dhcpcd when the PPP interface is brought up and taken down, which can be achieved using further scripts in the <code class="filename">/etc/ppp/ipv6-up.d/</code> and <code class="filename">/etc/ppp/ipv6-down.d/</code> directories.
  
B) The <code class="filename">masq</code> file (entry 7). With a dial-up modem setup it should look like:
+
====DNSMASQ Configuration====
 +
The final link in the chain is to have a Router Advertisement daemon tell clients connected to the various internal networks about the allocated address ranges.
 +
Either dnsmasq or radvd can be used to do this. Assuming you already have dnsmasq running for other reasons (IPv4 DHCP, DNS etc.) that is normally the best choice.
  
<nowiki>(...)
+
Simply add lines like the following to <code class="filename">/etc/dnsmasq.conf</code>:
  #INTERFACE              SUBNET
+
  # Do stateless DHCP, SLAAC, and generate DNS names for SLAAC addresses from DHCPv4 leases
  ppp0                    eth0
+
  dhcp-range = ::1,constructor:eth1, ra-stateless, ra-names, 4h
  #LAST LINE -- ADD YOUR ENTRIES ABOVE THIS LINE -- DO NOT REMOVE</nowiki>
+
  dhcp-range = ::1,constructor:eth2, ra-stateless, ra-names, 4h
 +
The "constructor" syntax means that dnsmasq looks at the addresses assigned to the specified interface (by dhcpcd) and advertises routing based on those.
  
===Step 6: Make the connection persistent (optional)===
+
==Tunnel from IPv6 Tunnelbroker==
If you want to make your connection persistent, i.e. redial automatically your ISP when your line drops down, do the following:
+
===SixXS===
 +
====AICCU Package====
 +
If you use [http://www.sixxs.net/ SixXS] as your IPv6 tunnelbroker, you will probably want to install the <code class="filename">aiccu.lrp</code> Package, which provides AICCU, the Automatic IPv6 Connectivity Client Utility.
  
Go back to the option 1) of the ppp configuration file menu to edit the <code class="filename">/etc/ppp/peers/provider</code> file and add the following options after the "baud rate" entry:
+
AICCU makes it easy for users to get IPv6 connectivity. After having requested an account, tunnel and optionally a subnet, AICCU can be used to automatically configure the tunnel. AICCU supports TIC (Tunnel Information & Control protocol), which it uses for retrieving the tunnel configuration information, AYIYA, which allows tunnels to be created even behind firewalls and NAT's.
  
  (...)
+
The procedure to configure [[Bering-uClibc 7.x]] is as follows:
115200          # baud  rate
+
* Make sure you have the <tt>tun</tt> kernel Module loaded. Note that this relies on the <tt>crc32</tt> kernel Module, which should be automatically loaded in most setups anyway.
  persist
+
* Configure Shorewall to accept the SixXS tunnel traffic. Add the following to <code class="filename">/etc/shorewall/rules</code>:
  holdoff 10
+
  SixXS(ACCEPT)  fw      net
  (...)
+
* Install the <code class="filename">aiccu.lrp</code> Package and configure it using '''lrcfg'''.
 +
** Specify your own <tt>username</tt> and <tt>password</tt>.
 +
** Specify the relevant <tt>protocol</tt> and <tt>server</tt>. For example:
 +
  protocol tic
 +
  server tic.sixxs.net
 +
* Start the <tt>aiccu</tt> daemon:
 +
  svi aiccu start
 +
* Check for error messages in <code class="filename">/var/log/syslog</code>
 +
* If all is well, you should have a new network interface called "<tt>sixxs</tt>" which is effectively the IPv6 equivalent of your external IPv4 interface (e.g. <tt>eth0</tt> or <tt>ppp0</tt>).
 +
* In the event of problems you may find the "<tt>test</tt>" mode of the "<tt>aiccu</tt>" command useful for diagnosis.
  
===Step 7: Save the changes===
+
====Workaround for Fast-Changing Public IPv4 Addresses====
To save the changes, start <span class="command">lrcfg</span>. The added modules will be saved to moddb with the command "<span class="command">'''m'''</span>) Backup modules". The configuration changes are saved with "<span class="command">'''s'''</span>) Save config".
+
Although AICCU supports tunnels via non-static IPv4 addresses, we have found that tunnels via DSL-providers (like T-DSL connections in Germany), that change the IP address in an 24-hour-interval, do not work reliably.
 +
A workaround is to add the script below, named as <code class="filename">0aiccu</code>, to <code class=filename">/etc/ppp/ip-up-d</code>. It restarts <code class="filename">aiccu</code> after ppp has re-established the pppoe connection.
  
===Step 8: Reboot...===
+
#!/bin/sh
Your modem connection should be established automatically. Type <span class="emphasis">''plog''</span> to check the login sequence with your ISP. If there is no output check the logs in <code class="filename">/var/log/</code> to get a clue on potential problems.
+
  if pidof aiccu
 +
        then /etc/init.d/aiccu stop
 +
fi
 +
while  pidof aiccu ; do
 +
  sleep 15;                                                               
 +
  pidof aiccu;
 +
done
 +
/etc/init.d/aiccu start
  
'''Tip:''' If you want to be sure that your modem and/or script parameters are OK before backing up ppp.lrp, you can launch the connection manually just by typing <span class="emphasis">''pon''</span>. Use the <span class="emphasis">''plog''</span> command to see how the connection is going and <span class="emphasis">''poff''</span> to close down your ppp connection.
+
====IPv6 DNS Servers====
 +
Most IPv4 DNS servers will happily serve out IPv6 "AAAA" address records, so normally it is adequate to use IPv4 for DNS even when using IPv6 for other protocols. However, in case some sites only provide full IPv6 DNS services over IPv6 it can be useful to include some IPv6 DNS servers, usually alongside IPv4 DNS servers.
  
===ppp-filter.lrp===
+
SixXS provide a recursive DNS cache service over IPv6 as detailed [http://www.sixxs.net/tools/dnscache/ on the SixXS website].
ppp-filter.lrp needs to be renamed to ppp.lrp before use and uses libpcap.lrp (which also needs to be loaded in <code class="filename">leaf.cfg</code>). The filter version can be used to specify a packet filter to be applied to data packets to determine which packets are to be regarded as link activity, and therefore reset the idle timer, or cause the link to be brought down in demand-dialing mode. The configuration (except for the filter-part) is done like the ppp package.
+
  
You can enable active filtering by setting (from the pppd man-page):
+
'''Note:''' As per the warning on the SixXS site, the AICCU utility needs to resolve the IPv4 address of <tt>tic.sixxs.net</tt> at startup, which will not be possible if your only DNS servers are only accessible via the AICCU tunnel (unless you have a static, public IPv4 address and a static tunnel).
  
<code class="computeroutput">active-filter filter-expression</code>
+
There are three separate DNS cache servers, one for each continent:
 +
* <tt>nscache.eu.sixxs.net</tt> - Europe
 +
* <tt>nscache.us.sixxs.net</tt> - United States
 +
* <tt>nscache.ap.sixxs.net</tt> - Asia Pacific
 +
An entry for the IPv6 address(es) of the relevant local resolver (found using e.g. <tt>dig AAAA nscache.eu.sixxs.net</tt> can either be added directly to <code class="filename">/etc/resolv.conf</code> or, if you are using the <tt>dhcpcd</tt> Package, it can be added to <code class="filename>/etc/resolv.conf.head</code> so that it is included at the start of the automatically-generated <code class="filename">/etc/dhcpc/resolv.conf</code> which is then typically referenced by the <tt>dnsmasq</tt> Package as described on [[Bering-uClibc 4.x - User Guide - IPv4 Networking - Configure Dnsmasq#Using dnsmasq with dhcpcd|the dnsmasq page]].
 +
An example of suitable contents for <code class="filename>/etc/resolv.conf.head</code> for a system located in Europe might be:
 +
nameserver 2001:14b8:0:3401::6
 +
nameserver 2001:7b8:3:4f:202:b3ff:fe46:bec
 +
Since the [[Bering-uClibc 4.0]] release, file <code class="filename>/etc/resolv.conf.head</code> is backed up automatically when the configuration is saved so this no longer needs to be added to the "local" Package.
  
This option is useful in conjunction with the idle option if there are packets being sent or received regularly over the link (for example, routing information packets) which would    otherwise prevent the link from ever appearing to be idle. The filter-expression syntax is as described for tcpdump, except that qualifiers which are inappropriate for a PPP link, such as ether and arp, are not permitted. Generally the filter expression should be enclosed in single-quotes to prevent whitespace in the expression from being interpreted by the shell.
+
===Hurricane Electric===
 +
TODO
  
  
Line 753: Line 163:
 
{| summary="Navigation footer" width="100%"
 
{| summary="Navigation footer" width="100%"
 
| width="40%" align="left"  |  
 
| width="40%" align="left"  |  
| width="20%" align="center" | [[Bering-uClibc 7.x - User Guide - IPv4 Networking|Up]]
+
| width="20%" align="center" | [[Bering-uClibc 7.x - User Guide - IPv6 Networking|Up]]
| width="40%" align="right"  | [[Bering-uClibc 7.x - User Guide - IPv4 Networking - Internal Network Connections|Next]]
+
| width="40%" align="right"  | [[Bering-uClibc 7.x - User Guide - IPv6 Networking - Configure Shorewall6|Next]]
 
|}
 
|}
  
 
[[Category:Bering-uClibc 7.x]]
 
[[Category:Bering-uClibc 7.x]]
 
[[Category:User Guide]]
 
[[Category:User Guide]]

Latest revision as of 19:58, 11 June 2021

IPv6 Networking - External Network Connections
Bering-uClibc 7.x - User Guide Next


Native IPv6

Ethernet (e.g. Cable Modem or ISP-supplied ADSL Router)

If you are fortunate enough to be using Bering-uClibc as a router / firewall with an ISP who provides a native IPv6 connection, or you are using Bering-uClibc as a client (rather than a router) on an IPv6-enabled network then external IPv6 networking will work on Bering-uClibc Release 5.2 onwards. (A relatively recent version of dhcpcd is required to enable DHCPv6 support, and 5.2 will be the first release to incorporate a suitable version.)

By default, file /etc/dhcpcd.conf is set for IPv4-only DHCP behaviour and the configuration file entry ipv4only needs to be commented-out (for dual-stack IPv4 & IPv6) or replaced with ipv6only if DHCPv4 is not required.

Take care to configure Shorewall6 (assuming you are using it) to enable DHCP on the external interface, specifying dhcp in file /etc/shorewall6/interfaces.

There are a significant number of configurable options for DHCPv6 in file /etc/dhcpcd.conf, for example if you wish to configure RFC 3633 IPv6 address Prefix Delegation. See the dhcpcd documentation for further details.

PPPoE

Using IPv6 with a PPPoE connection requires a combination of multiple tools. With IPv4 the PPP Link Control Protocol (LCP) takes care of communicating the IPv4 address, the details of DNS servers etc. to the PPP client but the IPv6 Control Protocol (IPV6CP) described in RFC 2472 will only configure a Link-Local IPv6 address for the PPP client. An alternative mechanism (typically DHCPv6) needs to be used to communicate the other details so it is necessary to run a DHCPv6 client like dhcpcd or dibbler-client on the PPP link and to configure this for IPv6 only to stop it interfering with the IPv4 settings which are typically set using LCP. (It's then also necessary to use a further tool like dnsmasq or radvd to communicate Router Advertisement details to internal networks, if you are running an IPv6 router.)

PPP Configuration

The following assumes an already-working IPv4 PPPoE configuration. As long as your PPP provider supports IPv6 and IPV6CP, the minimal requirement is to switch on IPV6CP support in pppd by adding the following line to file /etc/ppp/options:

+ipv6

Without this you will get error messages like the following in file /var/log/ppp.log:

Unsupported protocol 'IPv6 Control Protocol' (0x8057) received

Unlike IPv4, bringing up an IPv6 PPP connection does not create a default route automatically. This can be done by creating a script which runs whenever an IPv6 PPP connection is established. Assuming that Package pppscrpt.lrp has been loaded, create a script called e.g. /etc/ppp/ipv6-up.d/10-defaultroute containing the following:

#!/bin/sh
/sbin/ip -6 route add default via ${PPP_REMOTE} dev ${PPP_IFACE}

and another called e.g. /etc/ppp/ipv6-down.d/90-defaultroute containing:

#!/bin/sh
/sbin/ip -6 route del default via ${PPP_REMOTE} dev ${PPP_IFACE}

which should ensure that default routes are created and removed automatically, as required.

DHCPCD Configuration

The following assumes that dhcpcd is not being used for other purposes (in particular not for IPv4) and that you want to grab a block of IPv6 addresses via Prefix Delegation to assign to other networks connected to a router.

Edit /etc/dhcpcd.conf to read something like the following:

# Turn off IPv4 support
ipv6only

# Generate an RFC 4361-compliant DHCP Unique IDentifier, or read it from /etc/dhcpcd.duid
duid

# Turn on Rapid Commit support
option rapid_commit

# Request details of DNS Servers
option domain_name_servers

# A ServerID is required by RFC2131
require dhcp_server_identifier

# We provide a hook script to lookup the hostname if not set by the DHCP
# server, but we should not run it by default
nohook hostname


# Only operate on the listed interfaces
allowinterfaces ppp0 eth1 eth2

# Turn off IPv6 Router Solicitation globally (so it can be turned back on selectively for individual interfaces)
noipv6rs

# Subsequent lines apply only to interface ppp0
interface ppp0
    # Turn IPv6 Router Solicitation back on for this interface
    ipv6rs

    # Request an address using DHCPv6 for interface ppp0, using iaid 1
    ia_na 1

    # Request a block of IPv6 addresses using DHCPv6 Prefix Delegation via ppp0 (using iaid 2) and
    # allocate a portion of the allocated address range to eth1 (which has sla_id 1) and another portion to eth2 (which has sla_id 2)
    ia_pd 2 eth1/1 eth2/2

IAID stands for Interface Association IDentifier and is a unique way to identify each Interface on a Host (in conjunction with the DUID). SLA_ID stands for Site-Level Aggregation IDentifier and is a unique way to identify each separate subnet at a site (in conjunction with the DUID).

By configuring Router Solicitation on ppp0, this should mean that Router Advertisement packets are requested and - once received - used to configure routing on the ppp0 interface. However there are differences of opinion about whether it is correct to send RA packets on a PPP link, so some ISPs don't, and hence it is best to configure a default route a described in the PPP section above.

It is of course necessary to start and stop dhcpcd when the PPP interface is brought up and taken down, which can be achieved using further scripts in the /etc/ppp/ipv6-up.d/ and /etc/ppp/ipv6-down.d/ directories.

DNSMASQ Configuration

The final link in the chain is to have a Router Advertisement daemon tell clients connected to the various internal networks about the allocated address ranges. Either dnsmasq or radvd can be used to do this. Assuming you already have dnsmasq running for other reasons (IPv4 DHCP, DNS etc.) that is normally the best choice.

Simply add lines like the following to /etc/dnsmasq.conf:

# Do stateless DHCP, SLAAC, and generate DNS names for SLAAC addresses from DHCPv4 leases
dhcp-range = ::1,constructor:eth1, ra-stateless, ra-names, 4h
dhcp-range = ::1,constructor:eth2, ra-stateless, ra-names, 4h

The "constructor" syntax means that dnsmasq looks at the addresses assigned to the specified interface (by dhcpcd) and advertises routing based on those.

Tunnel from IPv6 Tunnelbroker

SixXS

AICCU Package

If you use SixXS as your IPv6 tunnelbroker, you will probably want to install the aiccu.lrp Package, which provides AICCU, the Automatic IPv6 Connectivity Client Utility.

AICCU makes it easy for users to get IPv6 connectivity. After having requested an account, tunnel and optionally a subnet, AICCU can be used to automatically configure the tunnel. AICCU supports TIC (Tunnel Information & Control protocol), which it uses for retrieving the tunnel configuration information, AYIYA, which allows tunnels to be created even behind firewalls and NAT's.

The procedure to configure Bering-uClibc 7.x is as follows:

  • Make sure you have the tun kernel Module loaded. Note that this relies on the crc32 kernel Module, which should be automatically loaded in most setups anyway.
  • Configure Shorewall to accept the SixXS tunnel traffic. Add the following to /etc/shorewall/rules:
SixXS(ACCEPT)   fw      net
  • Install the aiccu.lrp Package and configure it using lrcfg.
    • Specify your own username and password.
    • Specify the relevant protocol and server. For example:
protocol tic
server tic.sixxs.net
  • Start the aiccu daemon:
svi aiccu start
  • Check for error messages in /var/log/syslog
  • If all is well, you should have a new network interface called "sixxs" which is effectively the IPv6 equivalent of your external IPv4 interface (e.g. eth0 or ppp0).
  • In the event of problems you may find the "test" mode of the "aiccu" command useful for diagnosis.

Workaround for Fast-Changing Public IPv4 Addresses

Although AICCU supports tunnels via non-static IPv4 addresses, we have found that tunnels via DSL-providers (like T-DSL connections in Germany), that change the IP address in an 24-hour-interval, do not work reliably. A workaround is to add the script below, named as 0aiccu, to /etc/ppp/ip-up-d. It restarts aiccu after ppp has re-established the pppoe connection.

#!/bin/sh
if pidof aiccu
       then /etc/init.d/aiccu stop
fi
while  pidof aiccu ; do
  sleep 15;                                                                 
  pidof aiccu;
done
/etc/init.d/aiccu start

IPv6 DNS Servers

Most IPv4 DNS servers will happily serve out IPv6 "AAAA" address records, so normally it is adequate to use IPv4 for DNS even when using IPv6 for other protocols. However, in case some sites only provide full IPv6 DNS services over IPv6 it can be useful to include some IPv6 DNS servers, usually alongside IPv4 DNS servers.

SixXS provide a recursive DNS cache service over IPv6 as detailed on the SixXS website.

Note: As per the warning on the SixXS site, the AICCU utility needs to resolve the IPv4 address of tic.sixxs.net at startup, which will not be possible if your only DNS servers are only accessible via the AICCU tunnel (unless you have a static, public IPv4 address and a static tunnel).

There are three separate DNS cache servers, one for each continent:

  • nscache.eu.sixxs.net - Europe
  • nscache.us.sixxs.net - United States
  • nscache.ap.sixxs.net - Asia Pacific

An entry for the IPv6 address(es) of the relevant local resolver (found using e.g. dig AAAA nscache.eu.sixxs.net can either be added directly to /etc/resolv.conf or, if you are using the dhcpcd Package, it can be added to /etc/resolv.conf.head so that it is included at the start of the automatically-generated /etc/dhcpc/resolv.conf which is then typically referenced by the dnsmasq Package as described on the dnsmasq page. An example of suitable contents for /etc/resolv.conf.head for a system located in Europe might be:

nameserver 2001:14b8:0:3401::6
nameserver 2001:7b8:3:4f:202:b3ff:fe46:bec

Since the Bering-uClibc 4.0 release, file /etc/resolv.conf.head is backed up automatically when the configuration is saved so this no longer needs to be added to the "local" Package.

Hurricane Electric

TODO



Up Next