Re: how to only allow tcp on dport 443 on the OUTPUT chain?

On Tue, 08 Mar 2011 23:35:41 -0800
erikmccaskey64 <erikmccaskey64@xxxxxxxx> wrote:

If i want to block udp on dport 80 on the output chain, then is this
enough? i want to only allow tcp on it! iptables -P OUTPUT DROP
iptables -A OUTPUT -o $PUBIF --dport 80 -j ACCEPT

or i need this rule?
iptables -P OUTPUT DROP
iptables -A OUTPUT -o $PUBIF -p tcp --dport 80 -j ACCEPT

the second one is the good one?

I think you need to use a a couple of rules like
iptables -A OUTPUT -o $PUBIF -p !tcp --dport 80 -j DROP
iptables -A OUTPUT -o $PUBIF -p tcp --dport 80 -j ACCEPT

The first rule will drop anything not tcp on port 80. The second rule
will accept anything tcp on port 80. If you only want to drop udp,
change the first rule to
iptables -A OUTPUT -o $PUBIF -p udp --dport 80 -j DROP
iptables -A OUTPUT -o $PUBIF -p all --dport 80 -j ACCEPT

If you are using an output rule that accepts everything
outbound like the default Fedora firewall, you will have to put these
rules in front of that.
iptables -I OUTPUT -o $PUBIF -p tcp --dport 80 -j ACCEPT
iptables -I OUTPUT -o $PUBIF -p !tcp --dport 80 -j DROP
Note the reversed order, since these are being inserted instead of
users mailing list
To unsubscribe or change subscription options:

Relevant Pages

  • Re: Webmin & system-config-securitylevel
    ... >>service unless I expressly opened that port. ... I did this thru webmin using the firewall config tool under ... tcp dpt:webcache ... iptables v1.2.9: can't initialize iptables table `-tnat': Table does not ...
  • Re: iptables/html redirect
    ... I'm wondering if there is a way to use iptables to redirect new tcp ... group to another port. ... If you want to redirect connects to port 80 to another address or port: ...
  • Need help configuring IPtables w/ DMZ, 2 LAN, and INET
    ... I am desperately in need of assistance in configuring an IPtables ... firewall on a Red Hat Linux 9.0 server. ... Chain FORWARD ... tcp dpt:25 flags:0x16/0x02 ...
  • Re: Strange connection
    ... >>that port is closed, I'm probably ok on that score. ... This should not be a problem, however your router should ... > service iptables status ... tcp dpt:smtp ...
  • Re: Iptables: port 22 open only for my IP
    ... > I am total beginner to Linux and I'm trying to learn iptables basics. ... what to do with packets that don't match my rules ... # accept tcp and udp packets for port 20 ...