29 Maret 2006

Setup PPPoE di FreeBSD

Setup PPPoE di FreeBSD 5.4-STABLE
1. Untuk kernel options tidak ada yg spesifik untuk kebutuhan setup ini. Asalkan:
- device      ppp     # Kernel PPP
- device      tun     # Packet tunnel
Secara default (Kernel Generic) option itu mustinya sudah ada.

Dengan FreeBSD 5.X tentunya options kernel akan diload secara otomatis, kalo tidak bisa gunakan kldload(8) jadi tidak usaha attach options di kernelnya _KECUALI_ FreeBSD 4.X versi warisan, ada beberapa options yg musti diattach di kernel diantaranya netgraph(4).

2. Daemon yg digunakan adalah pppd(8) mirip dengan koneksi dialup biasa, cuma kita skg lewat ethernet aja (Ini beda secara fisik), jd tidak lewat serial com. Karena kita bekerja dengan daemon pppd(8) maka kita tentunya maen ppp.conf. Di bawah ini beberapa contohnya:
#################################################################
# PPP  Sample Configuration File
# Originally written by Toshiharu OHNO
# Simplified 5/14/1999 by wself@cdrom.com
#
# See /usr/share/examples/ppp/ for some examples
#
# $FreeBSD: src/etc/ppp/ppp.conf,v 1.8 2001/06/21 15:42:26 brian Exp $
#################################################################
default:
#set log Phase Chat LCP IPCP CCP tun command
set log Phase tun command
ISP:
set device PPPoE:rl0      # rl0 adalah eth yg terhubung ke modem langsung
# biasanya eksternal ethernet.
set authname username_anda
set authkey password_anda
set dial
set login
set cd 5
set crtscts off
#set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
add default HISADDR
set timeout 0             # 3 minute idle timer (the default)
# no idle time out, will not disconnect
enable dns                # request DNS info (for resolv.conf) 
set mru 1492
set mtu 1492
#set speed sync
enable lqr
#set lqrperiod 5
# For noisy lines, we may want to reconnect (up to 20 times) after loss
# of carrier, with 3 second delays between each attempt:
#
#set reconnect 3 20
set redial 0 0
Catatan: Perhatikan juga permission file ini karena memuat informasi username/password. Permission secara default sudah OK.
root# ls -l /etc/ppp/ppp.conf
-rw------- 1 root wheel 1133 Mar 3 23:27 /etc/ppp/ppp.conf
3. Biar auto booting edit /etc/rc.conf anda:
root# grep ppp /etc/rc.conf
# Activate user ppp auto start at boot time
ppp_enable="YES"             # Start User PPP task
ppp_mode="ddial"             # ddial, auto, background
ppp_profile="ISP"            # section in ppp.conf to exec
ppp_nat="NO"
4. Jika `everything is OK' kudu ada proses spt ini:
root# ifconfig
tun0: flags=8051 mtu 1492
        inet 0.0.0.0 --> 255.255.255.255 netmask 0xff000000
        inet 202.xxx.xxx.x --> 10.0.0.1 netmask 0xffffffff
        Opened by PID 238 
Dimana IP "202.xxx.xxx.x" adalah IP Public kita yg diassign dari ISP secara auto di server PPPoEnya (Mis: DSLAM-nya). Kita coba check juga daemon ppp yg sudah jalan:
root# ps ax | grep ppp
     238  ??  Ss    12:32.07 /usr/sbin/ppp -quiet -ddial ISP
5. Jangan lupa check juga log filenya /var/log/ppp.log:
Mar  8 01:52:14 iix-kumprang ppp[238]: tun0: Phase: deflink: Connected!
Mar  8 01:52:14 iix-kumprang ppp[238]: tun0: Phase: deflink: opening -> dial
Mar  8 01:52:14 iix-kumprang ppp[238]: tun0: Phase: deflink: dial -> carrier
Mar  8 01:52:15 iix-kumprang ppp[238]: tun0: Phase: Received NGM_PPPOE_ACNAME (hook "pppoebdg.isp.net.id")
Mar  8 01:52:15 iix-kumprang ppp[238]: tun0: Phase: Received NGM_PPPOE_SESSIONID
Mar  8 01:52:15 iix-kumprang ppp[238]: tun0: Phase: Received NGM_PPPOE_SUCCESS
Mar  8 01:52:15 iix-kumprang ppp[238]: tun0: Phase: deflink: carrier -> login
Mar  8 01:52:15 iix-kumprang ppp[238]: tun0: Phase: deflink: login -> lcp
Mar  8 01:52:25 iix-kumprang ppp[238]: tun0: Phase: bundle: Authenticate
Mar  8 01:52:25 iix-kumprang ppp[238]: tun0: Phase: deflink: his = CHAP 0x05, mine = none
Mar  8 01:52:27 iix-kumprang ppp[238]: tun0: Phase: Chap Input: CHALLENGE (21 bytes from pppoe)
Mar  8 01:52:27 iix-kumprang ppp[238]: tun0: Phase: Chap Output: RESPONSE (username_anda)
Mar  8 01:52:27 iix-kumprang ppp[238]: tun0: Phase: Chap Input: SUCCESS
Mar  8 01:52:27 iix-kumprang ppp[238]: tun0: Phase: deflink: lcp -> open
Mar  8 01:52:27 iix-kumprang ppp[238]: tun0: Phase: bundle: Network

Tidak ada komentar: