Originally contributed by Brian Somers <brian@FreeBSD.org>, with input from Nik Clayton <nik@FreeBSD.org>, Dirk-Willem van Gulik <Dirk.vanGulik@jrc.it>, and Peter Childs <pjchilds@imforei.apana.org.au>.
This document assumes you have the following:
An account with an Internet Service Provider (ISP) which you connect to using PPP. Further, you have a modem or other device connected to your system and configured correctly, which allows you to connect to your ISP.
The dial-up number(s) of your ISP.
Your login name and password. This can be either a regular UNIX-style login and password pair, or a PAP or CHAP login and password pair.
The IP address(es) of one or more name servers. Normally, you will be given two IP addresses by your ISP to use for this. If they have not given you at least one, then you can use the enable dns command in your ppp.conf file to tell ppp to set the name servers for you.
The following information may be supplied by your ISP, but is not completely necessary:
The IP address of your ISP's gateway. The gateway is the machine to which you will connect and will be set up as your default route. If you do not have this information, we can make one up and your ISP's PPP server will tell us the correct value when we connect.
This IP number is referred to as HISADDR by ppp.
The netmask you should use. If your ISP has not provided you with one, you can safely use 255.255.255.0.
If your ISP provides you with a static IP address and hostname, you can enter it. Otherwise, we simply let the peer assign whatever IP address it sees fit.
If you do not have any of the required information, contact your ISP and make sure they provide it to you.
앞에서 기술했듯이, ppp 는 커널의 tun장치를 사용합니다. 따라서 tun configured. tun장치는 기본GENERIC 커널에 이미 설정되어 있습니다. 그러나, 커널을 재설치 할때에는 ppp설정을 꼭 확인해야 합니다.
이것을 체크하려면, /sys/i386/conf나 /sys/pc98/conf에서 커널 설정파일을 확인합니다. 아래의 내용이 포함되어 있어야 합니다:
pseudo-device tun 1
위의 내용이 설정파일에 빠져있다면, 추가한 후 커널을 재컴파일하고 인스톨해야 합니다. GENERIC커널은 이 내용을 포함 하고 있기 때문에, 여러분이 새로운 커널을 설치하지 않거나, /sys 디렉토리가 없다면 커널을 변경할 필요가 없 습니다. 커널 설치에 대한 자세한 내용은 kernel configuration을 참조하십 시요.
아래의 명령을 통해 현재 커널에 터널장치가 몇개나 설정되어 있는지 알아볼 수 있습니다:
# ifconfig -a
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
inet 200.10.100.1 --> 203.10.100.24 netmask 0xffffffff
tun1: flags=8050<POINTOPOINT,RUNNING,MULTICAST> mtu 576
tun2: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
inet 203.10.100.1 --> 203.10.100.20 netmask 0xffffffff
tun3: flags=8010<POINTOPOINT,MULTICAST> mtu 1500Note: FreeBSD 4.0 이상의 버전에서는 이미 사용되는 몇개의 tun 장치를 볼 수 있습니다. used. This means you might not see any tun devices. If this is the case, do not worry; the device should be created dynamically when ppp attempts to use it.
위의 경우는 네개의 장치가 보이고 있고, 이중 두 개는 지금 설정 되어 사용되고 있습니다. 위의 RUNNNING플래그는 인터페이스가 어떻게 사용되고 있는가를 보여준다는 것에 주목해야 합 니다. --인터페이스가 RUNNING으로 나타나지 않았 다고 해서 문제될 것은 없습니다.
tun 장치를 지니지 않은 커널을 쓰고 있 는데, 사정에 의해 다시 만들지 못 하는 경우도 있습니다. 동적으로 코 드를 읽어들일 수만 있으면 됩니다. 더 자세한 사항은 modload(8) 와 lkm(4) 의 해당 맨페이지를 참조하십시오.
대부분의 사용자에게는 오직 하나의 tun 장치만(/dev/tun0)이 필요할 것입니다. 하나 이상 을 가지고 있다면, 즉 커널 설정파일의 pseudo-device 부분에 2이상의 숫자인 경우에는 아래 모든 부분에서 tun 대신에 사용하는 장치의 숫자로 변경해 주십시오.
tun0 장치가 제대로 설치되었는지 확인하는 가장 간단한 방법은 다시 만드는 것입니다. 이를 위해 다음의 명령을 실행 시키십시오::
# cd /dev
# ./MAKEDEV tun0커널에 16개의 터널 장치를 새로 만들려면, 다음의 명령을 실행 시키십시 오:
# cd /dev
# ./MAKEDEV tun15커널이 제대로 설정되었음을 확인하려면, 다음의 명령을 실행해 결과 를 비교합니다::
# ifconfig tun0
tun0: flags=8050<POINTOPOINT,RUNNING,MULTICAST> mut 1500RUNNING 플래그가 아직 설정되어 있지 않을 수도 있는데, 이 경우 다음과 같이 나타납니다::
# ifconfig tun0
tun0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500Remember from earlier that you might not see the device if it has not been used yet, as tun devices are created on demand in FreeBSD 4.0 and later releases.
해석기(resolver)는 IP 주소를 호스트네임(hostnames)으로, 또는 그역 으로 변환시키는 시스템의 일부입니다. 두 장소 중 한 곳에 IP주소에 호스 트네임 매핑(mapping)을 기술한 맵을 찾도록 설정할 수 있습니다. 우선 설 정할 파일은 /etc/hosts (hosts(5))입니다. 다 음으로 배포되는 데이터베이스인 DNS(도메인 네임서비스)입니다. 그 러나 DNS는 이 문서에서 다루는 범주를 벗어나기 때문에 언 급하지 않습니다.
해석기는 이름 맵핑해주는 시스템 호출(system call)의 집합체이지만, 이 정보를 어디서 찾을 것인지를 알려주어야 합니다. 이를 위해 우선 /etc/host.conf를 편집합니다. 혼동할수도 있는데 /etc/hosts.conf 라고(note the extra s) 하지 마십시오.
이 파일은 다음의 주 줄을 순서대로 포함해야만 합니다:
hosts
bind이는 우선 해석기가 파일 /etc/hosts에서 찾 아보도록 하고, 그 후 DNS에 문의토록 하는 것입니다.
이 파일은 네트워크상의 컴퓨터의 이름과 IP주소를 포함하고 있어야 합니다. 최소한 ppp를 실행시킬 컴퓨터IP주소라도 포함해야 합니다. 예 를 들어 IP주소가 10.0.0.1인 foo.bar.com이라는 컴퓨터가 있다면, with the IP address , /etc/hosts 파일은 다음을 포함해야 합니다:
127.0.0.1 localhost.bar.com localhost
127.0.0.1 localhost.bar.com.
10.0.0.1 foo.bar.com foo
10.0.0.1 foo.bar.com.첫번째줄은 현재 컴퓨터의 동의어로서 일명 localhost 라고 정의하고 있습니다. IP주소를 생각할 필요없이 이 줄에 대한 IP주소는 항상 127.0.0.1이어야 합니다. 두번째 줄은 foo.bar.com (짧게 표현한다면 foo 입니다) 에 IP주소를 10.0.0.1로 명명하고 있습니다.
혹은 ISP에서 고정 IP주소와 이름을 할당 받았다면, 10.0.0.1 이 있는 자리에 그것들을 기입 합니다.
/etc/resolv.conf 는 해석기가 어떻게 동작해야 하는지를 알려줍니다. 컴퓨터 자체가 DNS로 동작을 한다면 이 부분을 공백 으로 남겨둡니다. 보통 다음과 같이 기입합니다:
domain bar.com
nameserver x.x.x.x
nameserver y.y.y.yx.x.x.x 와 y.y.y.y 주소는 ISP에서 제공하는 것입니다. ISP에서 제공하는 대로 nameserver 줄을 추가하십시오. domain 줄은 호스트네임의 도메인 의 기본갑을 정하는 것인데, 필수사항을 아닙니다. 이 파일의 더 자세한 엔트리에 대해 것은 resolv.conf(5) 메뉴얼 페이지를 참조하시시오.
버전 2 이후의 ppp를 실행하는 경우, enable dns 명령 으로 ppp가 ISP에 네임서버 값을 확인하도록 요청 할 수 있습니다. ISP가 다른 주소를 제공하거나 /etc/resolv.conf)에 어떠한 네임서버 도 기재되어 있지 않다면, PPP는 ISP에서 다시 제공된 값으로 파일을 다시 쓰 게됩니다.
커널 수준 PPP구현에서는 사용자 ppp 와 pppd 모두 /usr/share/examples/ppp 디렉토리에 위치한 설정 파일들을 이용합니다. 제공된 설정 예제 파일은 사용자 ppp를 설정하는데 매우 유용하므로 삭제하지 않습니다.
ppp 를 설정하려면 필요에 따라 몇개의 파일을 편집해야 합니다. 편집해야 할 파일은 ISP에서 고정 IP주소를 할당하는지, 유동 IP주소를 할당하는지에 영향을 받습니다.
이제 /etc/ppp/ppp.conf라는 설정파일을 만들어야 합니다. 아마 아래의 예제와 비슷하게 될 것입니다.
Note: : 로 끝난 줄은 바로 첫 번째 열(column)에서 시작 되어야 한다는 것과, 그 밖의 줄은 빈칸이나 탭으로 들여쓰기가 되어야 한다는 점을 주의하십시오.
1 default:
2 set device /dev/cuaa0
3 set speed 115200
4 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \"\" ATE1Q0 OK-AT-OK \\dATDT\\TTIMEOUT 40 CONNECT"
5 provider:
6 set phone "(123) 456 7890"
7 set login "TIMEOUT 10 \"\" \"\" gin:--gin: foo word: bar col: ppp"
8 set timeout 300
9 set ifaddr x.x.x.x y.y.y.y 255.255.255.0 0.0.0.0
10 add default HISADDR
11 enable dns줄 번호는 넣지 마십시오.이는 단지 설명의 편의를 위함입니다.
기본 엔트리(default entry)임을 나타냅니다. 여기에 적힌 명령들은 ppp가 실행될 때 자동으로 실행됩니다.
모뎀이 연결되어 있는 장치를 명시합니다. COM1 은 /dev/cuaa0 이고, COM2 은 /dev/cuaa1입니다.
연결속도를 정합니다. 115200의 속도로 작동하지 않는다면, 대신 38400의 속도로 시도해 보십시오.
전화걸기(dial) 실행 문장. 사용자 ppp는 chat(8) 프로그램과 유사한 대기-통화(expect-send)문법을 사용합니다. 이 언어의 특징에 대해 서는 메뉴얼 페이지를 참조하십시오.
"provider"라고 명명된 ISP에 대한 엔트리를 명시합니다.
ISP의 전화번호를 기입합니다. 여러 개의 전화번호인 경우엔 분류기호로 (:) 또는 (|)를 사용해 기입합니다. 두 분류기호의 차이점은 ppp(8) 메뉴얼 페이지에 기술되어 있습니다. 요약하면, 번호를 계속 번갈아 가면서 시도하려면 (:)을 사용하고, 첫시도에는 꼭 첫번째 번호만을 사용하고 이것이 실패했을 때만 다른 번호를 이용하려 면 (|)를 사용합니다. 위의 경우처럼 항상 모두를 인용부호로 싸 주어야 합니다.
로그인 문장은 전화걸기 문장으로 chat과 비슷한 문법으로 되어 있습니다. 이 예제 문장은 로그인 세션이 다음과 같이 보이는 서비스에서 작동합니 다:
J. Random Provider
login: foo
password: bar
protocol: ppp위 예제의 내용을 여러분에게 맞게 변경하면 됩니다.
PAP 나 CHAP를 사용하는 경우 이 지점에서 로그인을 하지 않기 때문에 로그인 문장을 비워둘 수 있습니다. 더 자세한 것은 PAP 와 CHAP 인증 을 보십시오.
연결시 기본 타임아웃(timeout)을 초단위로 정합니다. 예제의 경우, 300초 후에는 자동으로 연결이 끊어집니다. 타임아웃을 설정하지 않으려면, 값을 0으로 설정해 줍니다.
인터페이스의 주소를 정합니다. 문장 x.x.x.x 는 ISP에서 제공한 IP주소로 바꾸어야 합니다. 문장 y.y.y.y는 ISP에서 게이트웨이에 명시한 IP주소로 바꾸어야 합니다. ISP에서 게이트웨이를 제공하지 않았다면, 10.0.0.2/0를 사용하십시오. "guessed" 주소를 사용해야 한다면, PPP and Dynamic IP addresses에 따라 /etc/ppp/ppp.linkup 에 엔트리를 만들었는지 확인하시시오. 만약 빠졌다면, ppp 는 -auto 혹은 -dynamic모드로 실행될 수 없습 니다.
ISP의 게이트웨이에 기본 라우트(route)를 추가합니다. 특이한 단어 HISADDR은 9번째 줄에 상술한 게이트웨이 주소로 치 환됩니다. 중요한 점을 이 줄이 9번째 줄 이후로 나와야 한다는 점입니다. 그렇게 하지 않으며 HISADDR은 초기화 되지 않습니다.
PPP가 ISP에게 네임서버 주소들이 올바른지 확인하기를 요청케합니다. ISP가 이러한 기능을 지원하면, PPP는 올바른 네임서버 엔트리로 /etc/resolv.conf를 갱신할수 있습니다.
고정 IP주소를 사용한다면, 연결하기 전에 이미 라우팅 테이블 엔트리 (routing table entry)가 올바르기 때문에 ppp.linkup 에 엔트리를 추가할 필요가 없습니다. 그러나, 연결후 프로그램을 호출하는 엔트리를 만들고자 할 수도 있는데, 이 경우는 sendmail 예제와 함께 후에 설 명하겠습니다.
설정 예제 파일은 /usr/share/examples/ppp 디렉토리 에 있습니다.
ISP에서 고정 IP주소를 제공하지 않은 경우, ppp 는 지역(local)과 원격(remote)주소를 결정할 수 있도록 설정할 수 있습니다. 이것은 IP주소를 "추측"함으로써 연결후에 IP설정 프로토콜( IP Configureation Protocol)을 사용하여 ppp가 올바로 설정되도록 함으로써 해결됩니다. ppp.conf파일의 설 정은 다음과 같은 차이가 있지만, 나머지는 PPP와 고정 IP주소와 동일합니다:
9 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0
다시 말하지만, 줄번호를 넣지 마십시오. 이는 단지 설명의 편의를 위한 것입니다. 그리고, 적어도 한 칸을 들여써야 합니다.
/문자 뒤의 숫자는 ppp가 강제하는 주소의 비트(bit)수 입니다. 상황에 맞추어 더욱 적절한 IP주소를 바랄 수도 있지만, 위의 예제만으로도 충분합니다.
마지막 인자(0.0.0.0)는 ppp가 10.0.0.1보다는 0.0.0.0를 사용해서 소통하도록 합니다. set ifaddr를 설정하기 위해 0.0.0.0 를 첫번째 인자로 사용하지 마십시오. 이는 ppp가 -auto 모드에서 초기 라우트를 설정하는 것을 막아줍니다.
버전 1.x대의 ppp를 사용하는 경우 또한/etc/ppp/ppp.linkup 에 엔트리를 제작할 필요가 있습니다. ppp.linkup은 연 결이 완료된 후에 사용됩니다. 이때, ppp는 어떤 IP주소가 정말로 사용되는지 알게됩니다. 다음의 엔트리는 존재하는 가짜 라우트를 제거하고, 올바른 것을 생성합니다:
1 provider:
2 delete ALL
3 add 0 0 HISADDR연결시 ppp는 다음의 방법으로 ppp.linkup을 살펴볼 것입니다: 첫째로 ppp.conf에서 사용된 것과 같은 표식(label) 이 있는지 찾아봅니다. 이것이 실패하면, 게이트웨이의 IP주소에 대 한 엔트리를 살펴봅니다. 이 엔트리는 4옥텟(4-octet, 8비트) IP 스타 일 표식입니다. 이것으로도 찾을 수가 없다면, MYADDR 를 찾아봅니다.
여기에서는 ppp가 얻은 tun 인터페이스에 존재하는 모든 라우트를 제거합니다(직접 라우트 엔트리 제외).
여기에서는 ppp가 HISADDR 를 가리키는 기본라우트를 추가토록 합니다. HISADDR 는 IPCP로 교류하면서 게이트웨이의 IP주소로 치환됩니다.
더 자세한 예제는 /usr/share/examples/ppp/ppp.conf.sample 과 /usr/share/examples/ppp/ppp.linkup.sample파일의 pmdemand엔트리 를 참조하십시오.
PPP 버전 2에서는 "sticky routes"를 소개하고 있습니다. MYADDR이나 HISADDR을 포함하고 있 는 모든 add나 delete 행들을 기억 해두고, MYADDR이나 HISADDR의 실제 값이 바뀌는 시점에서 라우트는 재적용됩니다. 이것은 ppp.linkup 의 반복되는 행을 제거하는데 필요합니다.
When you configure ppp to receive incoming calls on a machine connected to a LAN, you must decide if you wish to forward packets to the LAN. If you do, you should allocate the peer an IP number from your LAN's subnet, and use the command enable proxy in your /etc/ppp/ppp.conf file. You should also confirm that the /etc/rc.conf file contains the following:
gateway="YES"
Configuring FreeBSD for Dial-up Services은 getty를 이용해 회선 서비스를 사용하는 것에 대해 자세히 설명하고 있습니다.
getty의 대안은 전화회선에 맞게 디자인된 더욱 깔끔한 mgetty 입니다.
mgetty를 사용하는 잇점은 모뎀과 끊임없는 통신을 한다는 점인데, 이는 /etc/ttys 에서 포트가 닫혀져 있다면 모뎀이 전화를 받지 않게 된다는 것을 의미합니다.
mgetty의 새버전(0.99beta 이후) 또한 서버에 클라이언트가 스크립트(script-less)없이 접근하는 것을 허용하면서 PPP 스트림(stream)을 자동으로 탐지하는 것을 지원합니다.
mgetty의 더 자세한 것은 Mgetty와 AutoPPP를 참조하십시오.
ppp는 보통 사용자id 0으로 실행되어야 하지만, command must normally be run as user id 0. If however, you wish to allow ppp to run in server mode as a normal user by executing ppp as described below, that user must be given permission to run ppp by adding them to the network group in /etc/group.
You will also need to give them access to one or more sections of the configuration file using the allow command:
allow users fred mary
If this command is used in the default section, it gives the specified users access to everything.
Create a file called /etc/ppp/ppp-shell containing the following:
#!/bin/sh
IDENT=`echo $0 | sed -e 's/^.*-\(.*\)$/\1/'`
CALLEDAS="$IDENT"
TTY=`tty`
if [ x$IDENT = xdialup ]; then
IDENT=`basename $TTY`
fi
echo "PPP for $CALLEDAS on $TTY"
echo "Starting PPP for $IDENT"
exec /usr/sbin/ppp -direct $IDENTThis script should be executable. Now make a symbolic link called ppp-dialup to this script using the following commands:
# ln -s ppp-shell /etc/ppp/ppp-dialup
You should use this script as the shell for all of your dialup users. This is an example from /etc/password for a dialup PPP user with username pchilds (remember don't directly edit the password file, use vipw).
pchilds:*:1011:300:Peter Childs PPP:/home/ppp:/etc/ppp/ppp-dialup
Create a /home/ppp directory that is world readable containing the following 0 byte files:
-r--r--r-- 1 root wheel 0 May 27 02:23 .hushlogin
-r--r--r-- 1 root wheel 0 May 27 02:22 .rhostswhich prevents /etc/motd from being displayed.
Create the ppp-shell file as above and for each account with statically assigned IPs create a symbolic link to ppp-shell.
For example, if you have three dialup customers fred, sam, and mary, that you route class C networks for, you would type the following:
# ln -s /etc/ppp/ppp-shell /etc/ppp/ppp-fred
# ln -s /etc/ppp/ppp-shell /etc/ppp/ppp-sam
# ln -s /etc/ppp/ppp-shell /etc/ppp/ppp-maryEach of these users dialup accounts should have their shell set to the symbolic link created above (i.e., mary's shell should be /etc/ppp/ppp-mary).
The /etc/ppp/ppp.conf file should contain something along the lines of:
default:
set debug phase lcp chat
set timeout 0
ttyd0:
set ifaddr 203.14.100.1 203.14.100.20 255.255.255.255
enable proxy
ttyd1:
set ifaddr 203.14.100.1 203.14.100.21 255.255.255.255
enable proxyNote: The indenting is important.
The default: section is loaded for each session. For each dialup line enabled in /etc/ttys create an entry similar to the one for ttyd0: above. Each line should get a unique IP address from your pool of IP addresses for dynamic users.
Along with the contents of the sample /usr/share/examples/ppp/ppp.conf above you should add a section for each of the statically assigned dialup users. We will continue with our fred, sam, and mary example.
fred:
set ifaddr 203.14.100.1 203.14.101.1 255.255.255.255
sam:
set ifaddr 203.14.100.1 203.14.102.1 255.255.255.255
mary:
set ifaddr 203.14.100.1 203.14.103.1 255.255.255.255The file /etc/ppp/ppp.linkup should also contain routing information for each static IP user if required. The line below would add a route for the 203.14.101.0 class C via the client's ppp link.
fred:
add 203.14.101.0 netmask 255.255.255.0 HISADDR
sam:
add 203.14.102.0 netmask 255.255.255.0 HISADDR
mary:
add 203.14.103.0 netmask 255.255.255.0 HISADDRConfiguring and compiling mgetty with the AUTO_PPP option enabled allows mgetty to detect the LCP phase of PPP connections and automatically spawn off a ppp shell. However, since the default login/password sequence does not occur it is necessary to authenticate users using either PAP or CHAP.
This section assumes the user has successfully configured, compiled, and installed a version of mgetty with the AUTO_PPP option (v0.99beta or later).
Make sure your /usr/local/etc/mgetty+sendfax/login.config file has the following in it:
/AutoPPP/ - - /etc/ppp/ppp-pap-dialup
This will tell mgetty to run the ppp-pap-dialup script for detected PPP connections.
Create a file called /etc/ppp/ppp-pap-dialup containing the following (the file should be executable):
#!/bin/sh
exec /usr/sbin/ppp -direct pap$IDENTFor each dialup line enabled in /etc/ttys, create a corresponding entry in /etc/ppp/ppp.conf. This will happily co-exist with the definitions we created above.
pap:
enable pap
set ifaddr 203.14.100.1 203.14.100.20-203.14.100.40
enable proxyEach user logging in with this method will need to have a username/password in /etc/ppp/ppp.secret file, or alternatively add the following option to authenticate users via PAP from /etc/password file.
enable passwdauth
If you wish to assign some users a static IP number, you can specify the number as the third argument in /etc/ppp/ppp.secret. See /usr/share/examples/ppp/ppp.secret.sample for examples.
It is possible to configure PPP to supply DNS and NetBIOS nameserver addresses on demand.
To enable these extensions with PPP version 1.x, the following lines might be added to the relevant section of /etc/ppp/ppp.conf.
enable msext
set ns 203.14.100.1 203.14.100.2
set nbns 203.14.100.5And for PPP version 2 and above:
accept dns
set dns 203.14.100.1 203.14.100.2
set nbns 203.14.100.5This will tell the clients the primary and secondary name server addresses, and a netbios nameserver host.
In version 2 and above, if the set dns line is omitted, PPP will use the values found in /etc/resolv.conf.
Some ISPs set their system up so that the authentication part of your connection is done using either of the PAP or CHAP authentication mechanisms. If this is the case, your ISP will not give a login: prompt when you connect, but will start talking PPP immediately.
PAP is less secure than CHAP, but security is not normally an issue here as passwords, although being sent as plain text with PAP, are being transmitted down a serial line only. There's not much room for crackers to "eavesdrop".
Referring back to the PPP and Static IP addresses or PPP and Dynamic IP addresses sections, the following alterations must be made:
7 set login
...
12 set authname MyUserName
13 set authkey MyPasswordAs always, do not include the line numbers, they are just for reference in this discussion. Indentation of at least one space is required.
Your ISP will not normally require that you log into the server if you're using PAP or CHAP. You must therefore disable your "set login" string.
This line specifies your PAP/CHAP user name. You will need to insert the correct value for MyUserName.
This line specifies your PAP/CHAP password. You will need to insert the correct value for MyPassword. You may want to add an additional line, such as:
15 accept PAP
or
15 accept CHAP
to make it obvious that this is the intention, but PAP and CHAP are both accepted by default.
It is possible to talk to the ppp program while it is running in the background, but only if a suitable diagnostic port has been set up. To do this, add the following line to your configuration:
set server /var/run/ppp-tun%d DiagnosticPassword 0177
This will tell PPP to listen to the specified unix-domain socket, asking clients for the specified password before allowing access. The %d in the name is replaced with the tun device number that is in use.
Once a socket has been set up, the pppctl(8) program may be used in scripts that wish to manipulate the running program.
You now have ppp configured, but there are a few more things to do before it is ready to work. They all involve editing the /etc/rc.conf file.
Working from the top down in this file, make sure the hostname= line is set, e.g.:
hostname="foo.bar.com"
If your ISP has supplied you with a static IP address and name, it's probably best that you use this name as your host name.
Look for the network_interfaces variable. If you want to configure your system to dial your ISP on demand, make sure the tun0 device is added to the list, otherwise remove it.
network_interfaces="lo0 tun0" ifconfig_tun0=
Note: The ifconfig_tun0 variable should be empty, and a file called /etc/start_if.tun0 should be created. This file should contain the line:
ppp -auto mysystemThis script is executed at network configuration time, starting your ppp daemon in automatic mode. If you have a LAN for which this machine is a gateway, you may also wish to use the -alias switch. Refer to the manual page for further details.
Set the router program to NO with following line in your /etc/rc.conf:
router_enable="NO"
It is important that the routed daemon is not started (it is started by default), as it routed tends to delete the default routing table entries created by ppp.
It is probably worth your while ensuring that the sendmail_flags line does not include the -q option, otherwise sendmail will attempt to do a network lookup every now and then, possibly causing your machine to dial out. You may try:
sendmail_flags="-bd"
The downside of this is that you must force sendmail to re-examine the mail queue whenever the ppp link is up by typing:
# /usr/sbin/sendmail -q
You may wish to use the !bg command in ppp.linkup to do this automatically:
1 provider:
2 delete ALL
3 add 0 0 HISADDR
4 !bg sendmail -bd -q30mIf you don't like this, it is possible to set up a "dfilter" to block SMTP traffic. Refer to the sample files for further details.
Now the only thing left to do is reboot the machine.
All that is left is to reboot the machine. After rebooting, you can now either type:
# ppp
and then dial provider to start the PPP session, or, if you want ppp to establish sessions automatically when there is outbound traffic (and you have not created the start_if.tun0 script), type:
# ppp -auto provider
To recap, the following steps are necessary when setting up ppp for the first time:
Client side:
Ensure that the tun device is built into your kernel.
Ensure that the tunX device file is available in the /dev directory.
Create an entry in /etc/ppp/ppp.conf. The pmdemand example should suffice for most ISPs.
If you have a dynamic IP address, create an entry in /etc/ppp/ppp.linkup.
Update your /etc/rc.conf file.
Create a start_if.tun0 script if you require demand dialing.
Server side:
Ensure that the tun device is built into your kernel.
Ensure that the tunX device file is available in the /dev directory.
Create an entry in /etc/passwd (using the vipw(8) program).
Create a profile in this users home directory that runs ppp -direct direct-server or similar.
Create an entry in /etc/ppp/ppp.conf. The direct-server example should suffice.
Create an entry in /etc/ppp/ppp.linkup.
Update your /etc/rc.conf file.