Pages

Minggu, 27 Juli 2014

Firewall atau Rule Menggunakan Iptables Debian 7

by Assalamualaikum  |  in Networking at   06.54.00


Membuat Firewall atau Rule Menggunakan Iptables Debian 7

J.    Membuat Firewall atau Rule Menggunakan Iptables Debian 7
router:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination 
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 
##Memasukin ip address
server:~# iptables -A INPUT -s 192.168.10.1 -j ACCEPT 
##Cek PORT dalam contoh ini cek PORT Web
router:~#less /etc/services | grep www
www             80/tcp          http            # WorldWideWeb HTTP
www             80/udp                          # HyperText Transfer Protocol
##LIST cek tabel menampilkan semua aturan pada sebuah tabel
 router:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  server.local         anywhere 
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 
##Memasukin PORT Web 80
router:~#iptables -A INPUT -p tcp --dport 80 -j ACCEPT
router:~#iptables -A INPUT -p udp --dport 80 -j ACCEPT
##Memasukin PORT SSH 22
router:~#iptables -A INPUT -p tcp -s 192.168.10.1/24 --dport 22 -j ACCEPT 
##Memasukin seluruh 25-110 PORT
router:~#iptables -A INPUT -p tcp -m multiport --destination-port 25,110 -j ACCEPT
router:~# iptables -A INPUT -p udp -m multiport --destination-port 25,110 -j ACCEPT
router:~#iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
## MeReject seluruh Konfigurasi INPUT
router:~#iptables -A INPUT -j REJECT
##LIST cek tabel menampilkan semua aturan pada sebuah tabel
router:~#iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  server.local         anywhere
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:www
ACCEPT     udp  --  anywhere             anywhere            udp dpt:www
ACCEPT     tcp  --  192.168.10.0/24      anywhere            tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere            multiport dports smtp,pop3
ACCEPT     udp  --  anywhere             anywhere            multiport dports 25,pop3
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
##FlushPerintah ini mengosongkan aturan pada sebuah chain
router:~#iptables -F INPUT
##LIST cek tabel menampilkan semua aturan pada sebuah tabel
router:~#iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination 
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 
##Cek SSH nya
router:~#ssh smkntujuh@192.168.10.1
smkntujuh@192.168.10.1's password:
Linux server 2.6.26-1-686 #1 SMP Sat Jan 10 18:29:31 UTC 2009 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have mail.
Last login: Wed Mar 28 13:24:09 2012 from server.local
smkntujuh@ router:~$exit
##MeReject PORT 22

router:~#iptables -A INPUT -p tcp --dport 22 -j REJECT

0 komentar :

Proudly Powered by Blogger .