![Problema básico del firewall de Iptables de Linux](https://rvso.com/image/1642379/Problema%20b%C3%A1sico%20del%20firewall%20de%20Iptables%20de%20Linux.png)
Después de ingresar estos comandos en una terminal en un host con Iptables instalado, no se cargan páginas web después de conectarse a una red inalámbrica con acceso a Internet.
Sé que es algo simple pero no sé qué.
sudo iptables --policy INPUT DROP
sudo iptables --policy OUTPUT DROP
sudo iptables --policy FORWARD DROP
sudo iptables -A OUTPUT -j ACCEPT -p tcp --destination-port 53
sudo iptables -A OUTPUT -j ACCEPT -p tcp --destination-port 80
sudo iptables -A OUTPUT -j ACCEPT -p tcp --destination-port 443
sudo iptables -A OUTPUT -j ACCEPT -p udp --destination-port 53
sudo /sbin/iptables-save
Configuración listada después de los comandos anteriores:
user@debian:~$ sudo iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
Chain FORWARD (policy DROP)
target prot opt source destination
Chain OUTPUT (policy DROP)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:domain
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT udp -- anywhere anywhere udp dpt:domain
user@debian:~$ sudo iptables -L -v
Chain INPUT (policy DROP 1095 packets, 131K bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy DROP 33 packets, 2574 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:domain
8 480 ACCEPT tcp -- any any anywhere anywhere tcp dpt:http
0 0 ACCEPT tcp -- any any anywhere anywhere tcp dpt:https
1072 70910 ACCEPT udp -- any any anywhere anywhere udp dpt:domain
En este caso solo busco DNS, HTTP y HTTPS básicos. ¿Qué ocurre?
Respuesta1
sudo iptables --policy INPUT DROP
De forma predeterminada, esto elimina todo el tráfico entrante. No tiene ninguna regla que haga excepciones a esta política, es decir, solo tiene reglas de SALIDA que permiten el tráfico saliente. Normalmente, uno tendría al menos una regla para permitir conexiones coincidentes de entrada que se establecieron desde adentro, como:
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT