How to specify external port when adding rules with Easyrule
-
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.4Pass example (protocol with port):
easyrule pass wan tcp 1.2.3.4 192.168.0.4 80Block example (protocol without port):
easyrule pass wan icmp 1.2.3.4 192.168.0.4Because 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> -
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.