Re: Pequena Duvida iptables
faça assim:
suponto que vc tem um serviço no servidor rodando na porta 80 e que somente os hosts 192.168.0.5 e 192.168.0.10 acessam esse servico.. o resto nao acessa... faça isso:
1 iptables -t filter -N SERVICO
2 iptables -t filter -A SERVICO -s 192.168.0.5 -j ACCEPT
3 iptables -t filter -A SERVICO -s 192.168.0.10 -j ACCEPT
4 iptables -t filter -A SERVICO -j DROP
5 iptables -t filter -I INPUT -p tcp --dport 80 -j SERVICO
1. cria uma tabela chamada SERVICO
2. aceita o ip 192.168.0.5
3. aceita o ip 192.168.0.10
4. nega o que nao for permitido
5. força o trafego com destino a porta 80 protocolo TCP a passar pela tabela SERVICO !!
ai é soh ir adicionando os ips ai na tabela SERVICO .. lembrese.. o DROP tem q ficar SEMPRE POR ULTIMO !!
um script bash simples :
#!/bin/bash
#limpando..
iptables -t filter -F SERVICOS >/dev/null 2>&1
iptables -t filter -X SERVICOS >/dev/null 2>&1
iptables -t filter -D INPUT -p tcp --dport 80 -j SERVICOS >/dev/null 2>&1
IPS="192.168.0.5 192.168.0.10"
iptables -t filter -N SERVICOS
for ip in $IPS; do
iptables -t filter -A SERVICOS -s $ip -j ACCEPT
done
iptables -t filter -A SERVICOS -j DROP
iptables -t filter -I INPUT -p tcp --dport 80 -j SERVICOS
pronto.. isso deve te ajudar !!
Re: Pequena Duvida iptables
Obrigado pelo Força Alexandre,
abraços...
Re: Pequena Duvida iptables