Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: UFW : how to manage a port range ?

  1. #1
    Join Date
    Apr 2005
    Beans
    9

    Thumbs down UFW : how to manage a port range ?

    Hi,

    I would like to apply a rule to more that one port at a time with UFW.
    For example to open the ports from 1000 to 2000 for a computeur.
    I try the folowing syntax :

    ufw allow proto tcp from 192.168.3.5 to any port 1000-2000

    but 1000-2000 is not a valid port, as well as 1000:2000, 1000,2000, 1000;2000 etc ....
    I don't find the syntax in the documentation

    thanks for your help

  2. #2
    Join Date
    Sep 2007
    Location
    Nothern Side of the Earth
    Beans
    70
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: UFW : how to manage a port range ?

    Have you found an answer??? I am looking for the same))
    "I recommend Ubuntu." Bill Gates
    "Let's install Ubuntu on Mac." Steve Jobs
    (Ubuntu - linux for human beings, get it free at www.ubuntu.com)

  3. #3
    Join Date
    May 2006
    Beans
    35

    Re: UFW : how to manage a port range ?

    I'm looking for the same answer

  4. #4
    Join Date
    Apr 2005
    Beans
    9

    Thumbs up Re: UFW : how to manage a port range ?

    No I did not find the answer, I suppose that UFW is to limited to manage a port range

  5. #5
    Join Date
    Jun 2006
    Location
    Austrian in Taiwan
    Beans
    Hidden!
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: UFW : how to manage a port range ?

    Have you found the answer at:

    https://wiki.ubuntu.com/UbuntuFirewall

    Here the syntax is written as:
    ufw allow|deny [proto <protocol>] [from <address> [port <port>]] [to <address> [port <port>]]
    I would try instead:
    ufw allow proto tcp from 192.168.3.5 to any port 1000-2000


    this:

    ufw allow proto tcp from 192.168.3.5 port 1000 to 192.168.3.5 port 2000

  6. #6
    Join Date
    Apr 2006
    Location
    Christchurch, N
    Beans
    9
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: UFW : how to manage a port range ?

    The ufw rule

    Quote Originally Posted by ELMIT
    ufw allow proto tcp from 192.168.3.5 port 1000 to 192.168.3.5 port 2000
    will only allow 192.168.3.5 port tcp/2000 to accept traffic from 192.168.3.5 port tcp/1000


    You could try something like

    Code:
       -A ufw-before-input -p udp -m udp --dport 1000:2000 -j ACCEPT
    in /etc/ufw/before.rules


    You will probably need a better rule than this example - this will open up every udp port between 1000 and 2000 to everyone!

    Looks like a port range support is being worked on at the moment, but not working in my Ubuntu Hardy yet:

    http://bazaar.launchpad.net/~jdstran...k/revision/185

  7. #7
    Join Date
    May 2006
    Beans
    Hidden!

    Re: UFW : how to manage a port range ?

    my current solution has been to do this:

    Code:
    for i in `seq 1000 2000`; do
      ufw allow $i
    done
    realizing that this will put a thousand rules into your ufw config, but at least it gets the job done.

  8. #8
    Join Date
    Aug 2008
    Location
    Lisbon, Portugal
    Beans
    101
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: UFW : how to manage a port range ?

    Gufw version 0.20.0 allows you to insert port range (ufw will too). it hasn't been released yet. That is, if you prefer to configure ufw in a GUI.

    http://gufw.tuxfamily.org

  9. #9
    Join Date
    Aug 2006
    Location
    20,000 structs inside C
    Beans
    321
    Distro
    Ubuntu Development Release

    Re: UFW : how to manage a port range ?

    Quote Originally Posted by rogeriopvl View Post
    Gufw version 0.20.0 allows you to insert port range (ufw will too). it hasn't been released yet. That is, if you prefer to configure ufw in a GUI.

    http://gufw.tuxfamily.org
    deb is available for the above though. makes ufw even easier than it already is. Thanks
    "Everything that can be invented has been invented." -- Charles H. Duell, Commissioner, U.S. Office of Patents, 1899
    Ubuntu user #24001

  10. #10
    Join Date
    Jun 2008
    Location
    San Diego
    Beans
    182
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: UFW : how to manage a port range ?

    Quote Originally Posted by frederictoulouse View Post
    Hi,

    I would like to apply a rule to more that one port at a time with UFW.
    For example to open the ports from 1000 to 2000 for a computeur.
    I try the folowing syntax :

    ufw allow proto tcp from 192.168.3.5 to any port 1000-2000

    but 1000-2000 is not a valid port, as well as 1000:2000, 1000,2000, 1000;2000 etc ....
    I don't find the syntax in the documentation

    thanks for your help
    This works in 9.04
    Code:
    ufw allow proto tcp to any port 1000:2000
    Site | My PHP Framework
    "…the Linux philosophy is 'laugh in the face of danger'. Oops. Wrong one. 'Do it yourself'. That's it." -Linus Torvalds

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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