Set generic iptables rules?
Posted
by
tftd
on Server Fault
See other posts from Server Fault
or by tftd
Published on 2012-04-05T22:35:15Z
Indexed on
2012/04/05
23:32 UTC
Read the original article
Hit count: 163
This may be a really dumb question but how can you open a port on multiple interfaces without defining the interfaces? For example how do I open port 22 on all interfaces?
On my machine I have some interfaces that are dynamic and may or may not be available so I have to set "generic" rules.
This code is not working for me but I can't figure out why:
# My default policy is to drop the input.
# The other policies are required like that.
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -t nat -P POSTROUTING ACCEPT
$IPTABLES -t nat -P PREROUTING ACCEPT
$IPTABLES -t mangle -P OUTPUT ACCEPT
$IPTABLES -t mangle -P PREROUTING ACCEPT
#Open port 22 on all interfaces ?
$IPTABLES -A INPUT -p tcp --dport 22 -j ACCEPT
So apparently there's something wrong with the last line... but I can't see it?
© Server Fault or respective owner