Clear all rule iptables centos 6.x

0
542

Pagi-pagi dikantor saya sempatkan untuk mengupdate article, hehe sebenernya sih cuman buat note pribadi biar ga lupa, kali ini saya akan menuliskan tutorial membersihkan seluruh

Berikut ini comment nya.

service iptables stop
iptables -F
iptables --flush
/sbin/iptables --flush
service iptables save
service iptables start
service iptables reload

 

comment diatas berguna untul flush seluruh rule atau aturan yang kita terapkan, untuk mengecek kita bisa menggunakan command ini

iptables -L
iptables --list
iptables -L -v -n
/sbin/iptables -L -v -n --line-numbers

nanti akan muncul seperti ini

Chain INPUT (policy DROP 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination
1      207 15336 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
2        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 3 reject-with icmp-host-prohibited
3        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 12 reject-with icmp-host-prohibited
4        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 5 reject-with icmp-host-prohibited
5        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 9 reject-with icmp-host-prohibited
6        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 10 reject-with icmp-host-prohibited
7        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 4 reject-with icmp-host-prohibited
8        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 11 reject-with icmp-host-prohibited
9        0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0
10       0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0
11       0     0 ACCEPT     all  --  eth0   *       0.0.0.0/0            0.0.0.0/0
12       0     0 ACCEPT     tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22
13       0     0 ACCEPT     tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:80
14       2    96 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited
Chain FORWARD (policy DROP 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination
1        0     0 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
2        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 3 reject-with icmp-host-prohibited
3        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 12 reject-with icmp-host-prohibited
4        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 5 reject-with icmp-host-prohibited
5        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 9 reject-with icmp-host-prohibited
6        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 10 reject-with icmp-host-prohibited
7        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 4 reject-with icmp-host-prohibited
8        0     0 REJECT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 11 reject-with icmp-host-prohibited
9        0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0

dan jika kita ingin mengahapus filternya hanya beberapa dan tidak semua, bisa memasukkan command ini

To delete rule number 6 on the INPUT chain, enter:
# /sbin/iptables -D INPUT 6

You can only list rules from OUTPUT or INPUT or custom chain as follows:
# /sbin/iptables -L INPUT -v -n --line-numbers

jangan lupa untuk save, restart dan reload .

tutorial ini mungkin banyak kurangnya, namun sudah diterapkan di server saya berhasil 😀 so silahkan mencoba.

LEAVE A REPLY

Please enter your comment!
Please enter your name here