Child pages
  • 시스템 관리자를 위한 20개의 Iptables 예제

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

 

Iptable Basic

Displaying the Status of Your Firewall


방화벽 상태 표시

Type the following command as root:

...

Panel
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

 


Above output indicates that the firewall is not active. The following sample shows an active firewall:

...

Panel

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
56 3706 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
1 58 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
30 3398 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT 78 packets, 15600 bytes)
pkts bytes target prot opt in out source destination

 


  • -L : List rules.
  • -v : Display detailed information. This option makes the list command show the interface name, the rule options, and the TOS masks. The packet and byte counters are also listed, with the suffix 'K', 'M' or 'G' for 1000, 1,000,000 and 1,000,000,000 multipliers respectively.
  • -n : Display IP address and port in numeric format. Do not use DNS to resolve names. This will speed up listing.

...

Code Block
iptables -n -L -v --line-numbers

 


To display INPUT or OUTPUT chain rules, enter:

Code Block
iptables -L INPUT -n -v
iptables -L OUTPUT -n -v --line-numbers

 


Stop / Start / Restart the Firewall 

...

Code Block
iptables -D INPUT 4


 

 

Insert Firewall Rules


Code Block
iptables -L INPUT -n --line-numbers

 


Ref