Buat router gateway

1. .:: Set IP Address eth0 dan eth1.

Pengsian berdasarkan asumsi sebagai berikut;
eth0 terhubung ke jaringan lokal / client internet
eth1 terhubung ke Modem ADSL atau WiFi dengan ip 10.1.1.1
Set eth0 dengan ip 192.168.0.254 dan eth1 10.1.1.2

# vi /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.0.254
netmask 255.255.255.0
broadcast 192.168.1.255

auto eth1
iface eth1 inet static
address 10.1.1.2
netmask 255.255.255.0
broadcast 10.1.1.255
gateway 10.1.1.1

2. ..::Install Bind 9 sebagai DNS server.

# apt-get install bind9

setelah selesai terinstall lakukan setting:

# vi /etc/bind/named.conf

masukkan perintah ;

// add entries for other zone below here

zone “domain yang diinginkan” IN {
type master;
file “db.domain”;
};

zone “0.168.192.in-addr.arpa” IN {
type master;
file “db.ip”;
};

*lalu buat file db.domain dan db.ip , letak posisi file di /var/cache/bind/

.::db.domain

; chuprex.net
$TTL 604800
@ IN SOA ns1.chuprex.net. root.chuprex.net. (
2006020201 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800); Negative Cache TTL
;
@ IN NS ns1
IN MX 10 mail
IN A 192.168.0.254
ns1 IN A 192.168.0.254
mail IN A 192.168.0.2 ; We have our mail server somewhere else.
www IN A 192.168.0.254
client1 IN A 192.168.0.1 ; We connect to client1 very often.

.:: db.ip

; chuprex.net
$TTL 604800
@ IN SOA ns1.chuprex.net. root.chuprex.net. (
2006020201 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800); Negative Cache TTL
;
@ IN NS ns1
IN MX 10 mail
ns1 IN PTR 192.168.0.254
254 IN PTR ns1
254 IN PTR ns1.chuprex.net

** Setting file resolv.conf , posisi di /etc/resolv.conf

nameserver 192.168.0.254
domain chuprex.net
domain http://www.chuprex.net

**setelah itu restart bind

/etc/init.d/bind9 restart

2. ..:: Sekarang saatnya edit Routing Setting :

**Edit file ipv4_forward untuk memForwardkan ip dari 2 eth.

#vi /etc/network/options

ip_forward = yes
spoofprotect = yes
syncookies = no

**Masukkan rule iptables untuk share internet dari eth1 ke eth0.

#iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

untuk mempermanenkan rule iptables, jangan lupa menyimpannya.

#iptables-save

Sekian aja ya, setting router sederhana sudah selesai. Ooops, ternyata ada yg tertinggal.

**:: Restart setting network anda.

#/etc/init.d/networking restart

Komentar ditutup.

%d blogger menyukai ini: