Selasa, 05 Februari 2013

KONFIGURASI NETWORKING

Mengaktifkan Ethernet 
Network Interface Card (NIC) atau Ethernet di linux diberi nama etho, eth1, eth2, dst. Dan untuk interface Local
Loopback diberi nama lo. Untuk mengetahui interface apa saja yang terpasang pada server Debian, gunakan
perintah ifconfig berikut.

debian-server:/home/pondan# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:46 errors:0 dropped:0 overruns:0 frame:0
TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3036 (2.9 KiB) TX bytes:3036 (2.9 KiB)
Seperti terlihat diatas, Interface yang aktif hanyalah interface Loopback. Sebagai tambahan, jangan pernah sekalikali untuk menon-aktifkan interface Loopback tersebut. Sebab interface tersebut digunakan oleh aplikasi-aplikasi
server Debian agar dapat berjalan pada computer Localhost.
Agar dapat terkoneksi ke Jaringan Komputer, aktifkan terlebih dahulu Interface Ethernet. Pastikan nama untuk
Ethernet tersebut, default untuk Ethernet pertama adalah etho. Gunakan perintah ifup untuk meng-aktifkan, dan
sebaliknya gunakan perintah ifdown.

debian-server:/home/pondan# ifconfig

eth0 Link encap:Ethernet HWaddr 00:0c:29:58:cf:68
inet addr:0.0.0.0 Bcast:0.0.0.0 Mask:0.0.0.0
inet6 addr: fe80::20c:29ff:fe58:cf68/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1610 errors:0 dropped:0 overruns:0 frame:0
TX packets:1419 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:189305 (184.8 KiB) TX bytes:198940 (194.2 KiB)
Interrupt:18 Base address:0×1080
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:46 errors:0 dropped:0 overruns:0 frame:0
TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3036 (2.9 KiB) TX bytes:3036 (2.9 KiB)
Kemudian kita konfigurasi IP ADDRESS
Memberi Ip Address pada linux debian tidaklah sulit. Untuk cara cepatnya, gunakan perintah singkat dibawah ini.

debian-server:/home/pondan# ifconfig eth0 192.168.20.1 netmask 255.255.255.248 up
Kelemahan perintah di atas adalah, jika computer booting ulang, maka konfigurasi Ip Address tersebut akan hilang.
Untuk itu kita harus mengedit file interfaces, agar konfigurasi tersebut tidak hilang walaupun computer booting
ulang. Kita bisa menggunakan aplikasi text editor vim, vi, nano, gedit¸ ataupun yang lainya untuk mengedit file
tersebut. Saya sarankan, lebih baik Anda menggunakan editor vim saja.

debian-server:/home/pondan# nano /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The local network interface
auto eth0
iface eth0 inet static
        address 192.168.20.1
        netmask 255.255.255.248
        network 192.168.20.0
        gateway 192.168.20.6
        broadcast 192.168.20.7
        dns-nameservers 192.168.20.1


Tambahkan Ip Address anda seperti script di atas. Khusus editor vim, kita harus menekan  “ctrl+o” ( untuk  menyimpan. Setelah dirasa konfigurasi sudah benar, tekan tombol “ctrl+x”, lalu tekan “enter” untuk keluar dari konfigurasi.

Agar konfigurasi tersebut dapat langsung dijalankan, kita harus merestart terlebih dahulu service networking.
debian-server:/home/pondan# /etc/init.d/networking restart
Menambahkan DNS
Agar server Debian dapat terkoneksi ke Internet, harus kita tambahkan dns-name-server terlebih dahulu. Biasanya DNS tersebut, kita dapatkan dari ISP (Internet Service Provider). Daftarkan DNS tersebut pada file resolv.conf.
Jika file tersebut belum ada, ya tinggal buat saja file tersebut secara manual.

debian-server:/home/pondan# nano /etc/resolv.conf
search smkmuh2.sch.id
nameserver 192.168.20.1


 Menambahkan IP Alias
Ip Address Alias adalah suatu kondisi, dimana kita diharuskan menggunakan dua atau lebih Ip Address dalam satu NIC (just One network adapter). Seolah-olah computer kita memiliki dua buah NIC, dan terkoneksi dalam dua atau lebih jaringan yang berbeda.
Masih dalam file interfaces, tinggal tambahkan scripts untuk Ip Alias berikut. Dalam Ip Address Alias, tinggal
tambahkan sub-nomor di belakang nama interface asli. Misal eth0:0, eth0:1, eth0:2 atau eth1:0, eth1:1 dan
seterusnya.

debian-server:/home/pondan# nano /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The local network interface
auto eth0
iface eth0 inet static
             address 192.168.20.1
              netmask 255.255.255.248
              network 192.168.20.0
              broadcast 192.168.1.7
              gateway 192.168.1.6
             dns-nameservers 192.168.20.1
# The local alias network interface
auto eth0:0
iface eth0:0 inet static
              address192.168.20.2
              netmask 255.255.255.248
auto eth0:1
iface eth0:1 inet static
              address  192.168.20.3
              netmask 255.255.255.248

Tambahkan Ip Address anda seperti script di atas. Khusus editor vim, kita harus menekan  “ctrl+o” ( untuk  menyimpan. Setelah dirasa konfigurasi sudah benar, tekan tombol “ctrl+x”, lalu tekan “enter” untuk keluar dari konfigurasi.

Jangan lupa untuk selalu merestart service networking, setiap kali selesai mengkonfigurasinya.
debian-server:/home/riqial# /etc/init.d/networking restart

Tidak ada komentar:

Posting Komentar