How to specify external port when adding rules with Easyrule
liuting last edited by
I am trying to add port forwarding using Easyrule. I've followed this in the shell:
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]
easyrule block wan 184.108.40.206
Pass example (protocol with port):
easyrule pass wan tcp 220.127.116.11 192.168.0.4 80
Block example (protocol without port):
easyrule pass wan icmp 18.104.22.168 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?
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.