Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    How to specify external port when adding rules with Easyrule

    Scheduled Pinned Locked Moved Firewalling
    2 Posts 2 Posters 1.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      liuting
      last edited by

      Hi!

      I am trying to add port forwarding using Easyrule. I've followed this in the shell:

      : easyrule
      usage:
      Blocking only requires an IP to block
          easyrule block <interface><source ip="">

      Passing requires more detail, as it must be as specific as possible. The destination port is optional if you're using a protocol without a port (e.g. ICMP, OSPF, etc).
          easyrule pass <interface><protocol><source ip=""> <destination ip=""> [destination port]

      Block example:
          easyrule block wan 1.2.3.4

      Pass example (protocol with port):
          easyrule pass wan tcp 1.2.3.4 192.168.0.4 80

      Block example (protocol without port):
          easyrule pass wan icmp 1.2.3.4 192.168.0.4

      Because I want to pass any source with source port 8080 direct to 192.168.1.101:80,
      I tried command:  'easyrule pass wan tcp any 192.168.1.101 80' and it works, but I don't know how to add '8080' as a source port using Easyrule..
      Just like in web UI - Add a new rule - Source - Advanced,  I can specify the source port range.

      Does anyone know how to do this using Easyrule? or any other approach in the shell?

      Regards,
      Liuting</destination></protocol></interface></interface>

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        There isn't a way to specify the source port with easyrule. It's rarely needed since most things randomize the source port.

        You can always hack at the source of the easyrule script and make your own to do whatever you want though.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.