sexta-feira, 18 de janeiro de 2013

iptables                                         

# iptables -v -nL --line-number

Chain INPUT (policy ACCEPT 12 packets, 623 bytes)
num   pkts bytes target    prot opt in     out     source    destination
1       16  1841 ACCEPT     all  --   lo     *     0.0.0.0/0  0.0.0.0/0
2      193 16720 ACCEPT   all  --   *      *     0.0.0.0/0  0.0.0.0/0   state RELATED,ESTABLISHED
3        4   208 ACCEPT      tcp  --  *      *     0.0.0.0/0  0.0.0.0/0   tcp dpt:22
4        0     0 ACCEPT       udp  --  *      *     0.0.0.0/0  0.0.0.0/0   udp dpt:1194
5        1    52 ACCEPT      tcp  --   *      *     0.0.0.0/0  0.0.0.0/0   tcp dpt:8080
6        0     0 ACCEPT       tcp  --   *      *     0.0.0.0/0  0.0.0.0/0   tcp dpt:10000
7        0     0 ACCEPT       tcp  --   *      *     0.0.0.0/0  0.0.0.0/0   multiport dports 50000:51000
8        0     0 ACCEPT       tcp  --  eth1   *     0.0.0.0/0  0.0.0.0/0   tcp dpt:3128
9        0     0 ACCEPT       udp  --  eth1   *     0.0.0.0/0  0.0.0.0/0   udp dpt:53
10      0     0 ACCEPT       udp  --  eth1   *     0.0.0.0/0  0.0.0.0/0   udp dpt:63
11      0     0 ACCEPT       tcp  --   eth1   *     0.0.0.0/0  0.0.0.0/0   tcp dpt:631

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source          destination
1        0     0 ACCEPT     all  --  eth1   *       192.168.1.0/24  0.0.0.0/0
2        0     0 ACCEPT     all  --  *      eth1    0.0.0.0/0       192.168.1.0/24      state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT 199 packets, 34546 bytes)
num   pkts bytes target     prot opt in     out     source          destination

_____________________________________________________________________

# iptables -L INPUT –n

Chain INPUT (policy ACCEPT)
target     prot opt  source            destination
ACCEPT      all  --  0.0.0.0/0         0.0.0.0/0
ACCEPT      all  --  0.0.0.0/0         0.0.0.0/0           state RELATED,ESTABLISHED
ACCEPT      tcp  --  0.0.0.0/0         0.0.0.0/0           tcp dpt:22
ACCEPT      udp  --  0.0.0.0/0         0.0.0.0/0           udp dpt:1194
ACCEPT      tcp  --  0.0.0.0/0         0.0.0.0/0           tcp dpt:8080
ACCEPT      tcp  --  0.0.0.0/0         0.0.0.0/0           tcp dpt:10000
ACCEPT      tcp  --  0.0.0.0/0         0.0.0.0/0           multiport dports 50000:51000
ACCEPT      tcp  --  0.0.0.0/0         0.0.0.0/0           tcp dpt:3128
ACCEPT      udp  --  0.0.0.0/0         0.0.0.0/0           udp dpt:53
ACCEPT      udp  --  0.0.0.0/0         0.0.0.0/0           udp dpt:63
ACCEPT      tcp  --  0.0.0.0/0         0.0.0.0/0           tcp dpt:631

_____________________________________________________________________

# iptables -t nat –nvL

Chain PREROUTING (policy ACCEPT 7 packets, 406 bytes)
 pkts bytes target     prot opt in     out     source      destination
    0     0 REDIRECT   tcp  --  eth1   *       0.0.0.0/0   0.0.0.0/0     tcp dpt:80 redir ports 3128

Chain POSTROUTING (policy ACCEPT 3 packets, 195 bytes)
 pkts bytes target     prot opt in      out    source        destination
    3   180 MASQUERADE  all  --  *     ppp0    0.0.0.0/0     0.0.0.0/0
    0     0 MASQUERADE  all  --  *     eth1    0.0.0.0/0     0.0.0.0/0

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

_____________________________________________________________________

# iptables -L INPUT -n --line-numbers

Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT       all  --  0.0.0.0/0            0.0.0.0/0
2    ACCEPT       all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
3    ACCEPT       tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:22
4    ACCEPT       udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:1194
5    ACCEPT       tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:8080
6    ACCEPT       tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:10000
7    ACCEPT       tcp  --  0.0.0.0/0            0.0.0.0/0           multiport dports 50000:51000
8    ACCEPT       tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:3128
9    ACCEPT       udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:53
10   ACCEPT       udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:63
11   ACCEPT       tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:631




Apagando regras no firewall.

Veja o número na primeira coluna da listagem acima. Escolha o número da regra que deseja apagar, veja o exemplo abaixo:

O parâmetro –D é de Delete e o número 1 refere-se a regra a ser removida.

# iptables -t filter -D INPUT 1

# iptables -t filter -L INPUT

_____________________________________________________________________

# iptables -L

# iptables -L -v –n

# iptables -t nat -nvL
  
# iptables -t nat -nvL

# iptables -t filter -L INPUT

# iptables -L INPUT -n

# iptables --list -n -v

# iptables --list

# iptables -t nat –nvL

_____________________________________________________________________


Bloqueando somente o "facebook"


# iptables -nL

# iptables -t filter -I FORWARD -s 192.168.1.116 -m string --algo bm --string "facebook.com" -j REJECT

# iptables -t filter -I FORWARD -s 192.168.1.116 -p tcp -m string --algo bm --string "facebook.com" -j REJECT --reject-with 
tcp-reset


# iptables -nL --line-numbers



Apagando regra 1 ( Erasing rule number 1 )

iptables -D FORWARD 1



------------------------------------------------------------------------------------------------------------------------
===[ Sharing Knowledge ]===   -  Obrigado - Thank you - Danke - Merci - Grazie - Gracias - arigatou gozaimasu
“We make a living by what we get, but we make a life by what we give.”  - Give and you will receive - just share :)
------------------------------------------------------------------------------------------------------------------------

Nenhum comentário:

Postar um comentário