IP untuk koneksi internet kita taruh di eth0
IP : 172.16.16.1/25
Gateway : 172.16.16.126
IP untuk local ditaruh di eth1
IP : 192.168.1.1/26
Berikut konfigurasinya:
1. Memasukkan IP di interfaces (eth)
Command Line interfacenya:
#nano /etc/network/interfaces
kemudian edit filenya menjadi sebagai berikut:
# The primary network interface
auto eth0
iface eth0 inet static
address 172.16.16.1
netmask 255.255.255.128
network 172.16.16.0
broadcast 172.16.16.127
gateway 172.16.16.126
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 172.16.16.1
dns-search blue-software.com
auto eth1
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.192
network 192.168.1.0
broadcast 192.168.1.63
2. Kemudian kita edit file rc.local
(digunakan untuk melakukan routing walaupun di restart)
Perintahnya:
#nano /etc/rc.local
sebelum baris exit 0 ditambahkan
iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE
sehingga rc.local akan menjadi
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE
exit 0
Untuk mengecek apakah konfigurasi sudah benar
iptables �t nat �n �L
dan akan muncul
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
berarti setting telah benar
Kemudian isi konfigurasi pada /etc/network/option
Isikan baris :
ip_forward = yes
spoofprotect = yes
syncookies = no
3. Aktifkan ip forward
dengan perintah
#nano /etc/sysctl.conf
cari kata #net.ipv4.ip_forward=1
kemudian hilangkan tanda #
4. Restart network
perintah
#/etc/init.d/networking restart
5. reboot (restart) komputer
kalau masih tidak mau komputernya terhubung setelah di restart ketikkan aja
iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE
kemudian ulangi langkah ke 4
cara diatas kalau belum bisa untuk internetan maka perlu di masukkan DNS Server
caranya
edit file resolv.conf dengan perintah #nano /etc/resolv.conf
edit atau tambahkan di paling bawah
nameserver xxx.xxx.xxx.xxx
xxx diisi ip DNS server
untuk pengisian client adalah
IP : 192.168.1.2 - 62 /26
Gateway : 192.168.1.1
Uji router yang sudah di konfigurasi dari clinet dengan masuk ke
command prompt (cmd) dan ping ke gateway dahulu (192.168.1.1).
Ping Gateway dari Client
Jika berhasil, ping ke ether public (172.16.16.1).
Ping Ether Public
Jika sudah OK, ping ke salah satu website (jika terkoneksi ke internet). Jika berhasi berarti router sudah bisa di gunakan
met coba ya...












