Autor Tópico: iptables  (Lida 3017 vezes)

Offline schiraider

  • Usuário Ubuntu
  • *
  • Mensagens: 34
    • Ver perfil
iptables
« Online: 17 de Dezembro de 2008, 20:16 »
Pssoal, sem querer usei uma linha de comando usando iptables errada...ao inves de usar a eth1(internet) usei a eth0(ethernet)...tem como voltar atras?? eu queria fazer com q tudo que tivesse haver com a porta 80 fosse redirecionado para a porta 3128 do squid na eth1, e acabei trocando as interfaces sem querer....agora nenhuma maquina cliente loga no servidor. Obrigado a todos.

Offline Felix

  • Equipe Ubuntu
  • Usuário Ubuntu
  • *****
  • Mensagens: 3.068
    • Ver perfil
    • Alexsandro Felix
Re: iptables
« Resposta #1 Online: 17 de Dezembro de 2008, 20:45 »
Com os comandos abaixo você pode "zerar o iptables", para reconfigurá-lo do 'zero':


iptables -F
iptables -X
iptables -F -t nat
iptables -X -t nat
iptables -F -t mangle
iptables -X -t mangle
iptables -t filter -P INPUT DROP
iptables -t filter -P OUTPUT DROP
iptables -t filter -P FORWARD DROP


Espero que ajude.

Offline schiraider

  • Usuário Ubuntu
  • *
  • Mensagens: 34
    • Ver perfil
Re: iptables
« Resposta #2 Online: 17 de Dezembro de 2008, 22:30 »
Certo, vou tentar isso..muito obrigado!

Offline schiraider

  • Usuário Ubuntu
  • *
  • Mensagens: 34
    • Ver perfil
Re: iptables
« Resposta #3 Online: 24 de Dezembro de 2008, 11:59 »
Deu Certo!!
muito obrigado, ótimo natal e ano novo!

Offline asghan

  • Usuário Ubuntu
  • *
  • Mensagens: 1.221
    • Ver perfil
Re: iptables
« Resposta #4 Online: 08 de Fevereiro de 2009, 11:57 »
Alguém pode me dar uma luz?  ;D

Estou tentando utilizar o gnome-lokkit para criar um firewall básico. Mas parece que não surte efeito...

Vou deixar aqui a configuração do iptables para análise.

Inicialmente estava assim:

Código: [Selecionar]
ubuntu@ubuntu-laptop:~$ sudo 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   
     


Depois de rodar o comando gnome-lokkit (e colocando baixa segurança), ficou assim:

Código: [Selecionar]
ubuntu@ubuntu-laptop:~$ sudo 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         

Chain RH-Lokkit-0-50-INPUT (0 references)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere            udp spts:bootps:bootpc dpts:bootps:bootpc
ACCEPT     udp  --  anywhere             anywhere            udp spts:bootps:bootpc dpts:bootps:bootpc
ACCEPT     all  --  anywhere             anywhere           
REJECT     tcp  --  anywhere             anywhere            tcp dpts:0:1023 flags:FIN,SYN,RST,ACK/SYN reject-with icmp-port-unreachable
REJECT     tcp  --  anywhere             anywhere            tcp dpt:nfs flags:FIN,SYN,RST,ACK/SYN reject-with icmp-port-unreachable
REJECT     udp  --  anywhere             anywhere            udp dpts:0:1023 reject-with icmp-port-unreachable
REJECT     udp  --  anywhere             anywhere            udp dpt:nfs reject-with icmp-port-unreachable
REJECT     tcp  --  anywhere             anywhere            tcp dpts:x11:6009 flags:FIN,SYN,RST,ACK/SYN reject-with icmp-port-unreachable
REJECT     tcp  --  anywhere             anywhere            tcp dpt:font-service flags:FIN,SYN,RST,ACK/SYN reject-with icmp-port-unreachable

Como faço pra saber se a configuração acima está funcionando???
Tentei configurar para alta segurança para ver se bloqueava o DHCP e o aMSN (apenas para testar) e não surtiu efeito...

Para alta segurança fica assim (sem efeito aparente):

Código: [Selecionar]
ubuntu@ubuntu-laptop:~$ sudo 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         

Chain RH-Lokkit-0-50-INPUT (0 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere           
ACCEPT     udp  --  10.1.1.1             anywhere            udp spt:domain
REJECT     tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,ACK/SYN reject-with icmp-port-unreachable
REJECT     udp  --  anywhere             anywhere            udp reject-with icmp-port-unreachable

Se utilizo o seguinte comando o iptables bloqueia tudo (o que indica que está ativo):

Código: [Selecionar]
iptables -F && iptables -X && iptables -F -t nat && iptables -X -t nat && iptables -F -t mangle && iptables -X -t mangle && iptables -t filter -P INPUT DROP && iptables -t filter -P OUTPUT DROP && iptables -t filter -P FORWARD DROP
Estou usando este comando para voltar o iptables para o estado original, desbloqueando tudo:

Código: [Selecionar]
iptables -F && iptables -X && iptables -F -t nat && iptables -X -t nat && iptables -F -t mangle && iptables -X -t mangle && iptables -t filter -P INPUT ACCEPT && iptables -t filter -P OUTPUT ACCEPT && iptables -t filter -P FORWARD ACCEPT

Como faço para que as configurações geradas pelo gnome-lokkit tenham efeito???




Se fosse vc criaria um novo tópico :-)
   Ubuntu 12.04 - Unity 64bits