Monday, January 25, 2021

iptables: Allow local connections

Hello,

I am using iptables to block all traffic except from my local network. I also added a rule to allow loopback traffic, but all traffic to localhost is still blocked. Am I missing something?

#Default policies

iptables -P INPUT DROP

iptables -P FORWARD DROP

iptables -P OUTPUT DROP

ip6tables -P INPUT DROP

ip6tables -P FORWARD DROP

ip6tables -P OUTPUT DROP

#Allow loopback

iptables -A INPUT -i lo -j ACCEPT

iptables -A OUTPUT -o lo -j ACCEPT

#Allow local traffic

iptables -A INPUT -s 192.168.178.0/24 -i eth0 -j ACCEPT

iptables -A OUTPUT -d 192.168.178.0/24 -o eth0 -j ACCEPT



No comments:

Post a Comment