So need to do the listed tasks for my open wrt device its firewall config file:
1.From my local ip address i have to restrict the access to port 22 for all addresses outside the local network
2. i have to restrict the access to an ip address in the local network
3. i have to restrict the access to all protocols that are connected to the port and the ip address and the local ip address
Go to Network-Firewall-Rules tab. Create 2 rules, one that rejects traffic from lan IP or mac of the host to the router and one that rejects traffic from host to the wan.
I can't tell you how to do it if I don't understand what you want to do. And your description is too generic.
For each listed task, explain what you want to block and why
Explain the SRC and DST of all the local and remote hosts you want blocked
(Perhaps if you explain it out more, we can get on the same page...as I've read your 3 tasks, 3 times...and still don't clearly understand...or perhaps you're new to firewalling.)
As I've observed thus far:
This is setup already in the default firewall config
It is unclear of the location of the host/IP you want to restrict access to "in the local network"; it is important to have this information - it's needed to answer you - as has already been noted, no traffic passes a firewall if it's in the same zone and/or [PHY] interface
Please reword and clarify this. Your terminology is unclear. I cannot tell if you mean "physical ports on the device", "TCP/UDP ports" (which are a 2 IP Protocols that use the term "ports"), etc. - this also needs to be clearly understood in order to properly answer your inquiry