Results 1 to 4 of 4

Thread: this iptable

  1. #1
    Join Date
    Jun 2002
    Location
    United Kingdom
    Posts
    1,236

    this iptable

    ok i have been looking at iptables and have been studying it.

    am i right in thinking that the iptable below will only let incomming packets on port 80, unless my server talks to the recieving computer first


    iptables -A INPUT -i eth0 -p tcp --syn --destination-port ! 80 -j DROP

    if i am totally wrong, please tell me, as i really wanna learn, thanx

  2. #2
    Join Date
    Jun 2002
    Location
    United Kingdom
    Posts
    1,236
    ok i take it that it is wrong, because no-one has said anything about it, and its had 39 views.


    ill go find some more tutorials

  3. #3
    Join Date
    Jul 2001
    Location
    /dev/null
    Posts
    1,219
    First close all the ports. Then open port 80 AND all other ports you need. Be careful not to lock yourself out.

    iptables -P INPUT DROP
    iptables -P FORWARD DROP
    iptables -P OUTPUT DROP

    Code:
    iptables -A INPUT  -i eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
    iptables -A OUTPUT -o eth0-p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
    iptables -A INPUT  -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
    iptables -A OUTPUT -o eth0 -p tcp --sport 80 -m state --state NEW,ESTABLISHED -j ACCEPT

  4. #4
    Join Date
    Jun 2002
    Location
    United Kingdom
    Posts
    1,236
    ok cheers

    looking at what you have given me, i think this (tell me if im wrong)

    this closes all ports :

    PHP Code:
    iptables -P INPUT DROP
    iptables 
    -P FORWARD DROP
    iptables 
    -P OUTPUT DROP 
    and then this opens port 80 :

    PHP Code:
    iptables -A INPUT  -i eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
    iptables 
    -A OUTPUT -o eth0-p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
    iptables 
    -A INPUT  -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
    iptables 
    -A OUTPUT -o eth0 -p tcp --sport 80 -m state --state NEW,ESTABLISHED -j ACCEPT 
    so if im right does this open port 21 as well :

    PHP Code:
    iptables -A INPUT  -i eth0 -p tcp --sport 21 -m state --state ESTABLISHED -j ACCEPT
    iptables 
    -A OUTPUT -o eth0-p tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
    iptables 
    -A INPUT  -i eth0 -p tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
    iptables 
    -A OUTPUT -o eth0 -p tcp --sport 21 -m state --state NEW,ESTABLISHED -j ACCEPT 
    Thanx for the help

    Matt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •