<?xml version="1.0"?>
<!DOCTYPE webpage
  PUBLIC "-//NetBSD//DTD Website-based NetBSD Extension//EN"
    "http://www.NetBSD.org/XML/htdocs/lang/share/xml/website-netbsd.dtd" [

<!ENTITY % man-refs.ent SYSTEM "../../../share/xml/man-refs.ent"> %man-refs.ent;

]>

<webpage id="docs-network-isdn-index">
<config param="desc" value="NetBSD networking with ISDN"/>
<config param="cvstag" value="$NetBSD: index.xml,v 1.2 2007/08/02 16:20:13 kano Exp $"/>
<config param="rcsdate" value="$Date: 2007/08/02 16:20:13 $"/>

<head>
<!-- Copyright (c) 1994-2005
        The NetBSD Foundation, Inc.  ALL RIGHTS RESERVED. -->
<title>NetBSD Documentation: Steps to connect via ISDN</title>
</head>

<sect1 role="toc">

<sect2 id="isdn-steps">
<title>Steps to connect via ISDN</title>

<sect3 id="intro">
<title>Introduction</title>
<para>
NetBSD has integrated ISDN support.
The ISDN subsystem is based on the ISDN4BSD project,
but beware that some names and paths changed if you look at generic
ISDN4BSD documentation.
</para>


<para>
It is easy to connect your NetBSD system to your ISP
via ISDN. This document is a short walk-through the necessary steps,
assuming:
</para>

<itemizedlist>
  <listitem>Your NetBSD system is completely updated (including <filename>/dev</filename>
      nodes and <filename>/etc/rc.d</filename> scripts)</listitem>
  <listitem>You want to setup a simple PPP connection from your system
      to your provider.</listitem>
</itemizedlist>

<para>
There are lot of different configurations possible, if you need them,
read the man pages and have a look at the ISDN4BSD documentation
<ulink url="http://people.freebsd.org/~hm/i4b-095/i4b.html">The 
Care and Feeding of ISDN4BSD</ulink>. It describes several setups
and explains lots of debugging tricks and has background information.
</para>

<para>
There also is the <ulink url="FAQ.txt">ISDN4BSD FAQ</ulink>.
</para>
</sect3>

<sect3 id="adjust-kernel">
<title>Adjust your kernel</title>
<para>
Before you can use ISDN, you have to add support for it to your
kernel config file, create a new kernel and install it.
</para>

<para>
Have a look at <currentsrc>src/sys/arch/i386/conf/GENERIC_ISDN</currentsrc> for supported
ISDN cards on
<ulink url="../../../support/hardware/pci.html">PCI,</ulink>
<ulink url="../../../support/hardware/isa.html">ISA, ISAPNP,</ulink>
or
<ulink url="../../../support/hardware/pcmcia.html">PCMCIA</ulink>
busses (even if not running on i386), or at 
<currentsrc>src/sys/arch/amiga/conf/ISDN</currentsrc> for supported Amiga
Zorro-bus
boards.  You need to pick
the attachment for your isdn card and probably a corresponding
option too. Some drivers support a lot of very different cards
and compiling support for all this cards into the kernel increases
its size. So you can, for those drivers, select which support to
compile into it by selecting appropriate options. Additionally you
need the global ISDN devices isdn, isdnctl, and ippp. The later
needs a count; if this is your only ISDN connection, specifying
a 1 will do.
</para>
</sect3>

<sect3 id="etc-isdn">
<title>Create and populate <filename>/etc/isdn</filename></title>
<para>
You need to create the directory <filename>/etc/isdn</filename>. Look at the example files in
<filename>/usr/share/examples/isdn</filename> and copy the appropriate <filename>holidays</filename> and
<filename>isdnd.rates</filename> files (with exactly that names, the examples have
slightly different names) to <filename>/etc/isdn</filename>.
</para>    

<para>    
If, for example, you happen to live in Germany, Schleswig-Holstein, you
copy <filename>holidays.D.SH</filename> from <filename>/usr/share/examples/isdn</filename> as <filename>holidays</filename> to
<filename>/etc/isdn</filename> and <filename>isdnd.rates.D</filename> to <filename>isdnd.rates</filename>. If you, or your PTE,
does not care about holidays, an empty <filename>holidays</filename> file will be
enough. If you don't use rate base charging calculation, an empty
<filename>isdnd.rates</filename> file will be enough too.
</para>

<para>
For starters, if you just want to get it going and there are no
appropriate files for your ISDN connection, just create empty files.
</para>
</sect3>

<sect3 id="etc-isdn-isdnd.rc">
<title>Create an /etc/isdn/isdnd.rc file</title>
<para>
It is assumed you want a single connection to your ISP for now. This
will be made using the "ippp0" (ISDN ppp) device. Create an isdnd 
configuration file <filename>/etc/isdn/isdnd.rc</filename> with the following contents:
</para>

<para>
<programlisting>system
ratesfile	= /etc/isdn/isdnd.rates	# name and location of rates file
entry
name			= world  # arbitrary name for this entry
usrdevicename		= ippp
usrdeviceunit		= 0
ppp-auth-paranoid	= no
ppp-send-auth		= pap                   # maybe "chap" instead
ppp-send-name		= "MY-LOGIN-NAME"       # replace by your data
ppp-send-password	= "MY-SECRET-PASSWORD"  # replace by your password
isdncontroller  	= 0
isdnchannel		= -1
direction		= out
local-phone-dialout	= XXXXX    # your own phone number
remote-phone-dialout	= XXXXX    # number of your provider
remdial-handling	= first
dialin-reaction		= reject
dialout-type		= normal
b1protocol		= hdlc
unitlength		= 0
unitlengthsrc           = conf
idletime-outgoing	= 1000
earlyhangup		= 0
dialretries		= 5
dialrandincr		= on
recoverytime		= 2
usedown			= off
downtries		= 2
downtime		= 30</programlisting>
</para>

<para>
This variant is for a flat rate connection, if this does not apply to
you, you definitely will want to review the timing parameters later.
But let us get this working first.
</para>

<para>
The things you have to fill in in the above config file are:
</para>

<para>
<variablelist>

<varlistentry><term><emphasis>ppp-send-auth</emphasis></term>
<listitem>
  This is either "pap" or "chap". Your provider usually tells
  you, or you can use trial and error. The <ulink url="FAQ.txt">ISDN4BSD
  FAQ</ulink> shows a method to interpret debug output to find out what
  your provider expects.
</listitem></varlistentry>

<varlistentry><term><emphasis>ppp-send-name</emphasis></term>
<listitem>
  The login your provider gave you. This may have special characters
  in it (like "#"), so better put it into double-quotes.
</listitem></varlistentry>

<varlistentry><term><emphasis>ppp-send-password</emphasis></term>
<listitem>
  The password your provider gave you. Double
  quoting is a good idea, see above.
</listitem></varlistentry>

<varlistentry><term><emphasis>local-phone-dialout</emphasis></term>
<listitem>
  Your own phone number, usually without any
  prefix. This is what your computer tells the ISDN network where the
  call is coming from. Probably your provider will not care. The ISDN
  network will check this number and nuke any false ones (numbers not
  assigned to your ISDN connection).
</listitem></varlistentry>

<varlistentry><term><emphasis>remote-phone-dialout</emphasis></term>
<listitem>
  The number you want to call.
</listitem></varlistentry>
</variablelist>
</para>
</sect3>

<sect3 id="etc-ifconfig.ippp0">
<title>Create <filename>/etc/ifconfig.ippp0</filename></title>
<para>
The easiest way to configure your local network interface used to connect
to the outside world is to create an <filename>/etc/ifconfig.ippp0</filename> file with the
following content:
</para>

<para>
<programlisting>inet 0.0.0.0 0.0.0.1 link1 down</programlisting>
</para>

<para>
This configures the ippp0 interface to the following parameters:
</para>

<itemizedlist>
  <listitem>The local address is set to 0.0.0.0, which means "accept anything
      the remote side will negotiate during PPP startup".</listitem>
  <listitem>The remote address is set to 0.0.0.1, which means "accept anything
      the remote side thinks is his (the remote) IP address. If you know the
      specific address your provider uses, you may substitute that.</listitem>
  <listitem>The flag "link1" is set, which means "dial on demand".</listitem>
  <listitem>The interface is not marked "UP", as the interface configuration
      runs early during bootstrap, when the isdn daemon is not yet running.
      This prevents outgoing calls, so better not trigger them. Since the
      interface has an IP address configured, isdnd will mark it up (and
      thereby make it usable) when isdnd starts.</listitem>
</itemizedlist>
</sect3>

<sect3 id="routing">
<title>Set up routing</title>
<para>
Since we are assuming this is your only (or main) connection to the
outside world, we set up a default route via the ISDN connection.
If you have used the <filename>/etc/ifconfig.ippp0</filename> file verbatim as stated above,
you'll just have to enter this to <filename>/etc/rc.conf</filename>
</para>

<para>
<programlisting>defaultroute="0.0.0.1 -iface"</programlisting>
</para>

<para>
If you changed the remote address, you'll have to adjust it here, too.
</para>
</sect3>

<sect3 id="enableisdnd">
<title>Enable ISDN at system startup</title>
<para>
To have the ISDN management daemon run at system startup you need to add
</para>

<para>
<programlisting>isdnd=YES</programlisting>
</para>

<para>
to <filename>/etc/rc.conf</filename>.
</para>
</sect3>

<sect3 id="reboot">
<title>Reboot</title>
<para>
We are not Windows, but now you may reboot to check if everything works
as you expected.
</para>
</sect3>

<sect3 id="nonflat">
<title>Non Flatrate Connections</title>
<para>
If you configure an ISDN interface in some <filename>/etc/ifconfig.*</filename> file, but would
not like isdnd to mark this interface UP on startup, add
<programlisting>autoupdown=no</programlisting>
to the isdnd.rc config entry. You will need to set the interface up manually
later before using it in this case. Note: this is only an option, in most
cases using it will not be necessary. If the interface has <emphasis>link1</emphasis> set
(as suggested above) it will only dial on demand, which usually is exactly
the behaviour you will need.
</para>

<para>
To make your connection time out after some idle time, you need to tweak
some of the following config file entries (see &man.isdnd.rc.5; for details).
Here is an example for a bidirectional connection with asymmetric timeouts:
</para>

<programlisting>
idletime-incoming       = 120           # incoming call idle timeout (seconds)
idletime-outgoing       = 55            # outgoing call idle timeout (seconds)
earlyhangup		= 5             # disconnect 5 seconds before
                                        # next unit will be charged
ratetype                = 0             # ratesfile entry to use (index)
unitlength              = 90            # unitlength to assume (seconds)
unitlengthsrc           = aocd          # we get charging information, so
                                        # sync with that</programlisting>

</sect3>
</sect2>
</sect1>

</webpage>

