Konfigurasi FreeBSD

Bagian 5

Konfigurasi FreeBSD

 

Konfigurasi file dalam FreeBSD terdapat dalam direktory /etc, file file tersebut antara lain file konfigurasi untuk

  1. Startup File

Startup File merupakan konfigurasi utama dimana seluruh system akan dikonfigurasi secara menyeluruh dalam file ini.

  • File rc

File ini di eksekusi bersama dengan init (process control initialization) saat startup atau setelah single user. Pesan error yang keluar ditampilakan ke console oleh init, atau pada terminal console.

File ini mencatat semua konfigurasi rc-rc yang lain. Dimana rc yang lain merupakan konfigurasi system yang lebih spesifik. Ada baiknya agar /etc/rc ini tidak dirubah, kecuali untuk kebutuhan penting atau khusus.

  • File rc.diskless1 dan rc.diskless2

File rc.diskless1 merupakan BOOTP startup umum yang digunakan saat startup sistem. File ini akan melakukan rutin chek, jika ternyata boot file system tidak dapat diselesaikan maka akan masuk ke single user.

File rc.diskless2 merupakan konfigurasi file menyeluruh.

  • File rc.conf

Dalam FreeBSD 2.1.x dan sebelumnya file ini namanya /etc/sysconfig. Pada versi 3.x file ini terdapat dalam /etc/defaults/rc.conf, file ini merupakan script yang mencatat variable yang dibutuhkan untuk diubah sesuai dengan kebutuhan seluruh konfigurasi yang dipakai saat startup. Options didalamnya merupakan keterangan di enable atau di disable suatu fasilitas atau options tertentu. Didalamnya terdapat 4 bagian utama

  1. Important initial Boot-time options, yaitu options yang mengatur system saat melakukan startup.
  2. Network configuration sub-section, mengatur hal yang berkaitan dengan jaringan, didalamnya terdapat, Basic network, network daemon and NFS options, Network time service options, Network Information Service (NIS) options dan Network routing options.
  3. System console options, mengatur tampilan console, dari pengaturan font, cursor, mouse dan lain lain.
  4. Miscellaneous administrative options, mengatuur pekerjaan administratif seperti cron, printer, sendmail, quota user, dan lain lain.

Terdapat dua file rc.conf yaitu File rc.conf dalam direktori /etc/defaults merupakan konfigurasi default yang tidak perlu di ubah, sedang options rc.conf yang dapat di ubah terdapat dalam direktori /etc. Dengan ditempatkan file /etc/rc.conf maka seorang administrator lebih mudah untuk merubah system, karena hanya terdiri dari baris baris yang dibutuhkan.

Konfigurasi yang dilakukan melalui program /stand/sysinstall akan langsung tercatat dalam file /etc/rc.conf ini.

  • File rc.local

File ini secara default dalam FreeBSD 4.x release tidak ada, namun anda dapat membuatnya sendiri untuk keperluan perintah startup yang harus dipakai. Misalnya anda menjalankan apache web server sebagai berikut :

#!/bin/sh

/usr/local/apache/bin/apachectl start &&

/usr/local/sbin/mysql_safe &&

 

  • File rc.network dan rc.network6

Rc.network ini mengatur hal hal yang terkait dengan network, seperti, ip filter, hostname, dhcp, nis domain dan lainnya, tentu saja dengan referensi yang diberikan pada /etc/rc.conf dan /etc/defaults/rc.conf . rc.network6 digunakan untuk network IPv6

  • File rc.firewall dan rc.firewall6

Konfigurasi firewall dapat dilihat optionsnya dalam file ini, hanya untuk meng-enable kan firewall ini anda harus meletakkan options firewall_enable=”YES” dalam konfigurasi /etc/rc.conf. rc.firewall6 digunakan untuk network IPv6

  • File rc.shutdown

Konfigurasi ini dipakai jika system shutdown, prosesnya menghentikan init daemon atau perubahan dari multi user ke single-user.

 

 

  • File rc.suspend atau rc.resume

File ini dikonfigurasi untuk kondisi suspend atau resume, ada beberapa fungsi antara lain seperti saat interface mengalami idle dan sebagainya.

  1. Konfigurasi Terminal

Konfigurasi terminal terdapat beberapa file konfigurasi file antara lain :

  • File /etc/gettytab

Merupakan file konfigurasi pada terminal baik console, virtual terminal atau serial terminal dan pseudo terminal. File ini mengatur kecepatan transfer data (boud rate) dari terminal ke server, parity check dan juga mengatur tampilan login pada freebsd pada baris seperti berikut :

default:\

       :cb:ce:ck:lc:fd#1000:im=\r\n%s/%m (%h) (%t)\r\n\r\n:sp#1200:

 

pada baris diatas terdapat %s (Nama os), %m (processor compatible), %h (nama host ) %t (dan terminalnya) sehingga didapatkan tampilan sebagai berikut:

FreeBSD/i386 (router.umm.ac.id) (ttyp0)

 

login: sis

Password:

 

  • File /etc/ttys

Terdapat empat bagian jenis terminal dalam unix FreeBSD :

  • Console

Adalah terminal default yang digunakan hampir disemua mesin unix. Saat unix melakukan proses booting, hingga siap dipakai. Console adalah terminal utama yang dipakai proses tersebut.

  • Virtual Terminal

Merupakan pengembangan dari console. Dengan memanfaatkan alt-FX maka di komputer yang terinstall FreeBSD akan membentuk terminal tersendiri. Device virtual terminal ini adalah /dev/ttyv*

Untuk membuat virtual terminal dapat dilakukan dengan perintah dalam direktori /dev:

$ ./MAKEDEV vty12

atau

$ sh MAKEDEV vty12

$ ls ttyv*

ttyv0   ttyv2   ttyv4   ttyv6   ttyv8   ttyva

ttyv1   ttyv3   ttyv5   ttyv7   ttyv9   ttyvb

 

  • Serial

Terminal ini untuk terminal yang terhubung dengan kabel serial. Contoh seperti anda menggunakan hyperterminal di MS windows.

  • Pseudo

Terminal pseudo merupakan terminal untuk mendukung koneksi telnet, rlogin, terminal xwindows, sshd dan lain sebagainya. Terminal ini juga berpengaruh pada banyaknya user yang dapat terhubung kedalam system FreeBSD.

            File /etc/ttys :

       #

# $FreeBSD: src/etc/etc.i386/ttys,v 1.2.2.4 1999/08/29 14:19:13 peter Exp $

#       @(#)ttys        5.1 (Berkeley) 4/17/89

#

# This file specifies various information about terminals on the system.

# It is used by several different programs.  Common entries for the

# various columns include:

#

# name  The name of the terminal device.

#

# getty The program to start running on the terminal.  Typically a

#       getty program, as the name implies.  Other common entries

#       include none, when no getty is needed, and xdm, to start the

#       X Window System.

#

# type The initial terminal type for this port.  For hardwired

#      terminal lines, this will contain the type of terminal used.

#      For virtual consoles, the correct type is cons25.  Other

#      common values include network for network connections on

#      pseudo-terminals, dialup for incoming modem ports, and unknown

#      when the terminal type cannot be predetermined.

#

# status Must be on or off.  If on, init will run the getty program on

#        the specified port.  If the word “secure” appears, this tty

#        allows root login.

#

# name  getty                           type    status          comments

#

# If console is marked “insecure”, then init will ask for the root password

# when going to single-user mode.

console none                            unknown off secure

#

#ttyv0  “/usr/X11R6/bin/xdm -nodaemon”  xterm on secure

# Virtual terminals

ttyv0   “/usr/libexec/getty Pc”         cons25  on  secure

ttyv1   “/usr/libexec/getty Pc”         cons25  on  secure

ttyv2   “/usr/libexec/getty Pc”         cons25  off  secure

# Serial terminals

# The ‘dialup’ keyword identifies dialin lines to login, fingerd etc.

ttyd0   “/usr/libexec/getty std.9600”   dialup  off secure

ttyd1   “/usr/libexec/getty std.9600”   dialup  off secure

ttyd2   “/usr/libexec/getty std.9600”   dialup  off secure

ttyd3   “/usr/libexec/getty std.9600”   dialup  off secure

# Pseudo terminals

ttyp0   none                    network

ttyp1   none                    network

ttyp2   none                    network

ttyp3   none                    network

ttyp4   none                    network

ttyp5   none                    network

ttyp6   none                    network

ttyp7   none                    network

ttyp8   none                    network

ttyp9   none                    network

ttypa   none                    network

ttypb   none                    network

ttypc   none                    network

ttypd   none                    network

ttype   none                    network

ttypf   none                    network

ttypg   none                    network

ttyph   none                    network

ttypi   none                    network

ttypj   none                    network

ttypk   none                    network

ttyq0   none                    network

ttyr0   none                    network

ttys0   none                    network

ttyP0   none                    network

ttyQ0   none                    network

ttyR0   none                    network

ttyS0   none                    network

 

  1. Konfigurasi Internet Server

Internet “super-server” dalam FreeBSD disebut dengan inetd, adalah program yang dijalankan  saat boot /etc/rc. Program tersebut mendengarkan koneksi port sockets Internet. Jika koneksi ada dari salah satu sockets, maka inetd memutuskan service apa yang cocok, dan memanggil program untuk meneruskan permintaan tersebut. Server program yang cocok akan menjalankan perintah input output standart. Setelah selesai, inetd akan mendengarkan lagi di socketnya.

Inetd berada dalam direktory /usr/sbin/inetd sedang konfigurasinya terdapat di /etc/inetd.conf :

# $FreeBSD: src/etc/inetd.conf,v 1.33.2.4 1999/11/18 09:45:15 des Exp $

#

# Internet server configuration database

#

#      @(#)inetd.conf       5.4 (Berkeley) 6/30/90

#

ftp    stream tcp    nowait root   /usr/libexec/ftpd          ftpd -l

telnet stream tcp    nowait root   /usr/libexec/telnetd telnetd

shell  stream tcp    nowait root   /usr/libexec/rshd          rshd

login  stream tcp    nowait root   /usr/libexec/rlogind rlogind

finger stream tcp    nowait/3/10 nobody /usr/libexec/fingerd  fingerd -s

comsat dgram  udp    wait   tty:tty       /usr/libexec/comsat  comsat

ntalk  dgram  udp    wait   tty:tty       /usr/libexec/ntalkd  ntalkd

#pop3  stream tcp    nowait root   /usr/local/libexec/popper  popper

 

Aplikasi inetd ini dibaca saat pertama kali system unix dinyalakan. Script dijalankan di /etc/rc pada bagian :

 

# Now start up miscellaneous daemons that don’t belong anywhere else

#

echo -n starting standard daemons:

if [ “X${inetd_enable}” != X”NO” ]; then

       echo -n ‘ inetd’;    inetd ${inetd_flags}

fi

 

Dan file /etc/rc.conf atau di /etc/defaults/rc.conf pada baris :

inetd_enable=”YES”         # Run the network daemon dispatcher (or NO).

 

Secara default inetd akan membuka service untuk program :

 

# $FreeBSD: src/etc/inetd.conf,v 1.33.2.4 1999/11/18 09:45:15 des Exp $

#

# Internet server configuration database

#

#      @(#)inetd.conf       5.4 (Berkeley) 6/30/90

#

ftp    stream tcp    nowait root   /usr/libexec/ftpd          ftpd -l

telnet stream tcp    nowait root   /usr/libexec/telnetd telnetd

shell  stream tcp    nowait root   /usr/libexec/rshd          rshd

login  stream tcp    nowait root   /usr/libexec/rlogind rlogind

finger stream tcp    nowait/3/10 nobody /usr/libexec/fingerd  fingerd -s

comsat dgram  udp    wait   tty:tty       /usr/libexec/comsat  comsat

ntalk  dgram  udp    wait   tty:tty       /usr/libexec/ntalkd  ntalkd

 

Karena program tersebut telah include dalam FreeBSD dan merupakan standar umum FreeBSD sejak versi sebelumnya. Program yang lain (seperti pada /etc/inetd.conf lengkap) yang ditandai dengan tanda “#” memerlukan software tambahan yang dapat diinstall dari ports atau source langsung dari sumber.

 

  • FTP Server

Ftp Server dalam /etc/inetd.conf telah tercantum baris sebagai berikut :

 

ftp    stream tcp    nowait root   /usr/libexec/ftpd          ftpd –l

 

Ftp server sercara default dalam FreeBSD sudah terkonfigurasi, namun ftp server ini hanya khusus untuk user yang terautentifikasi, bukan untuk anonymous user. Untuk konfigurasi Anonymous ftp dapat dilakukan dengan perintah /stand/sysinstall :

 

  • Pilih Configure
  • Pilih Networking
  • Pilih Anon FTP
Anonymous FTP Configuration

 

UID:          Group:               Comment:     

14            operator             Anonymous FTP Admin      

 

       Path Configuration

       FTP Root Directory:                       

 

       /var/ftp     

 

Upload Subdirectory:

 

incoming

 

OK            CANCEL

 

 

  • Telnet Server

Dalam /etc/inetd.conf terdapat baris :

 

telnet stream tcp    nowait root   /usr/libexec/telnetd telnetd

 

Telnet server memberikan access ke user non console user untuk melakukan remote login dengan menggunakan telnet client. Fasilitas ini terkait dengan options dalam kernel, maxuser dan pty device.

File konfigurasi terminal adalah /etc/ttys, memberikan access pada user dari daftar terminal yang ada.

  • Shell (rshd)

Remote shell digunakan untuk user yang terhubung dengan server dari komputer lain dengan rsh (remote shell). Dameon dalam inetd.conf sebagai berikut :

shell  stream tcp    nowait root   /usr/libexec/rshd          rshd

 

  • Remote Login (rlogin)

Selain telnetd, rshd terdapat juga rlogind, remote login daemon server ini digunakan seperti halnya telnet. Dameon dalam inetd.conf sebagai berikut :

 

login  stream tcp    nowait root   /usr/libexec/rlogind rlogind

 

  • Finger (fingerd)

Fingerd merupakan remote informasi user, secara default FreeBSD telah di jalankan. Demi keamanan options fingerd ini remark saja. Dameon dalam inetd.conf sebagai berikut :

 

finger stream tcp    nowait/3/10 nobody /usr/libexec/fingerd  fingerd -s

 

  • Comsat

Adalah biff server, yang mana bila user menerima pesan seperti email datang dan  pemberitahuan jika memiliki permintaan pada service ini. User menggunaan perintah biff y atau n bila ingin mengaktifkan fasilitas ini.

comsat dgram  udp    wait   tty:tty       /usr/libexec/comsat  comsat

 

  • Talk Server (ntalkd)

Talk daemon ini digunakan bila server ingin menerima request dari server lain (remote) untuk faslitas talk.

ntalk  dgram  udp    wait   tty:tty       /usr/libexec/ntalkd  ntalkd

 

  1. Konfigurasi Cron

Cron adalah daemon yang akan mengeksekusi suatu program pada waktu waktu tertentu atau daemon yang menjalankan program pada waktu yang telah ditentukan. Cron dijalankan dalam /etc/rc atau /etc/rc.local.

  • Crontab pada system FreeBSD

Cron mencari /var/cron/tabs (berisi crontab konfigurasi user). Cron juga mencari file /etc/crontab untuk konfigurasinya system. /etc/crontab ini biasanya merupakan program program yang dipasang khusus yang terkait dengan system rutin.

 

# /etc/crontab – root’s crontab for FreeBSD

#

# $FreeBSD: src/etc/crontab,v 1.18.2.2 1999/08/29 14:18:39 peter Exp $

#

SHELL=/bin/sh

PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin

HOME=/var/log

#

#minute hour    mday    month   wday    who     command

#

*/5     *       *       *       *       root    /usr/libexec/atrun

#

# rotate log files every hour, if necessary

0       *       *       *       *       root    newsyslog

#

# do daily/weekly/monthly maintenance

59   1    *    *    *       root    periodic daily 2>&1 | sendmail root

30   3    *    *    6       root    periodic weekly 2>&1 | sendmail root

30   5    1    *    *       root    periodic monthly 2>&1 | sendmail root

#

# time zone change adjustment for wall cmos clock,

# does nothing, if you have UTC cmos clock.

# See adjkerntz(8) for details.

1,31    0-5     *       *       *       root    adjkerntz –a

 

Format penulisan program yang akan di eksekusi adalah :

#minute hour    mday    month   wday    who     command

 

  • Crontab User

Kadang kala user memasang script crontab ini dalam home direktorynya Untuk mengeksekusi program seperti monitoring dengan mrtg dan lainnya. Crontab daemon juga memperbolehkan user untuk menggunakannya. Untuk itu user harus membuat script seperti halnya /etc/crontab. Hanya saja nama file ini dapat dibuat dengan nama yang berbeda.

Contoh : user membuat file crontab dengan nama mycron dengan isi sebagai berikut :

$ more mycron

0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /usr/home/sis/bin/mrtg-2.7.2/run/mrtg /usr/home/sis/bin/mrtg-2.7.2/run/office.cfg

0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /usr/home/sis/bin/mrtg-2.7.2/run/mrtg /usr/home/sis/bin/mrtg-2.7.2/run/k3.cfg

 

kemudian jalankan dengan perintah

$ crontab mycron

$ crontab -l

# DO NOT EDIT THIS FILE – edit the master and reinstall.

#(mycron installed on Fri Jun  8 09:22:09 2001)

#(Cron version — $FreeBSD: src/usr.sbin/cron/crontab/crontab.c,v 1.12 1999/08/28 01:15:52 peter Exp $)

0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /usr/home/sis/bin/mrtg-2.7.2/run/mrtg /usr/home/sis/bin/mrtg-2.7.2/run/office.cfg

0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /usr/home/sis/bin/mrtg-2.7.2/run/mrtg /usr/home/sis/bin/mrtg-2.7.2/run/k3.cfg

 

Untuk membuang list crontab untuk user ini gunakan perintah

 

> crontab -r

 

Untuk memastikan lihat kembali dengan perintah crontab -l

 

> crontab -l

crontab: no crontab for sis

 

 

 

 

  1. Konfigurasi Service

File /etc/service adalah database service yang disediakan oleh system, merupakan urutan nomor port dan terdapat informasi tentang

  1. Nama Service
  2. Nomor port
  3. Nama protocol
  4. Alias

 

#

# Network services, Internet style

#

# Note that it is presently the policy of IANA to assign a single well-known

# port number for both TCP and UDP; hence, most entries here have two entries

# even if the protocol doesn’t support UDP operations.

# Updated from RFC 1700, “Assigned Numbers” (October 1994).  All ports

# are included.

#

# The latest IANA port assignments can be gotten from

#       http://www.isi.edu/in-notes/iana/assignments/port-numbers

# The Well Known Ports are those from 0 through 1023.

# The Registered Ports are those from 1024 through 49151

# The Dynamic and/or Private Ports are those from 49152 through 65535

#

# Kerberos services are for Kerberos v4, and are unofficial.  Sites running

# v5 should uncomment v5 entries and comment v4 entries.

#

# $FreeBSD: src/etc/services,v 1.62 1999/08/27 23:23:45 peter

#       From: @(#)services      5.8 (Berkeley) 5/9/91

#

# WELL KNOWN PORT NUMBERS

#

rtmp              1/ddp    #Routing Table Maintenance Protocol

tcpmux            1/tcp    #TCP Port Service Multiplexer

tcpmux            1/udp    #TCP Port Service Multiplexer

nbp               2/ddp    #Name Binding Protocol

compressnet       2/tcp    #Management Utility

compressnet       2/udp    #Management Utility

compressnet       3/tcp    #Compression Process

compressnet       3/udp    #Compression Process

echo              4/ddp    #AppleTalk Echo Protocol

rje               5/tcp    #Remote Job Entry

rje               5/udp    #Remote Job Entry

zip               6/ddp    #Zone Information Protocol

Pada file tersebut kita dapat menambahkan serivice port didalamnya secara manual.

Download File pdf

One Comment to “Konfigurasi FreeBSD”

  1. Hello everybody, here every one is sharing such experience, therefore it’s
    fastidious to read this weblog, and I used
    to pay a visit this website everyday.

    Also visit my web site: خرید بک لینک قوی

Leave a Reply

Your email address will not be published. Required fields are marked *