Hi!
I'm new here, I just installed Asuswrt-merlin on my RT-AX58U. I've configured OpenVPN and everything is working fine, I created multiple users and assigned static IPs using this guide. Now, I would like to configure some rules using iptables to achieve this:
- Only two users can access the entire LAN while connected to the VPN.
- Another user, can only access a specific IP while connected, not the entire LAN.
The users I want to grant access to the whole LAN have the IPs 10.8.0.10 and 10.8.0.11, and the other user has the IP 10.8.0.50.
So, I started granting access to only 10 and 11, and dropping everything else with these rules:
This works, 10 and 11 can access the entire network, and 50 does not have access.
Now, I want to add a rule that allows 50 to access a specific machine in the lan, so I added a new rule:
However, with these rules, everyone can access the entire LAN, including 50.
What am I doing wrong? Is this doable or am I misunderstanding iptables at all?
Thanks in advance!!
I'm new here, I just installed Asuswrt-merlin on my RT-AX58U. I've configured OpenVPN and everything is working fine, I created multiple users and assigned static IPs using this guide. Now, I would like to configure some rules using iptables to achieve this:
- Only two users can access the entire LAN while connected to the VPN.
- Another user, can only access a specific IP while connected, not the entire LAN.
The users I want to grant access to the whole LAN have the IPs 10.8.0.10 and 10.8.0.11, and the other user has the IP 10.8.0.50.
So, I started granting access to only 10 and 11, and dropping everything else with these rules:
Code:
iptables --insert FORWARD --in-interface tun21 --out-interface br0 -s 10.0.0.0/8 -d 192.168.0.0/16 -j DROP
iptables --insert FORWARD --in-interface tun21 --out-interface br0 -s 10.8.0.10 -d 192.168.0.0/16 -j ACCEPT
iptables --insert FORWARD --in-interface tun21 --out-interface br0 -s 10.8.0.11 -d 192.168.0.0/16 -j ACCEPT
This works, 10 and 11 can access the entire network, and 50 does not have access.
Now, I want to add a rule that allows 50 to access a specific machine in the lan, so I added a new rule:
Code:
iptables --insert FORWARD --in-interface tun21 --out-interface br0 -s 10.0.0.0/8 -d 192.168.0.0/16 -j DROP
iptables --insert FORWARD --in-interface tun21 --out-interface br0 -s 10.8.0.10 -d 192.168.0.0/16 -j ACCEPT
iptables --insert FORWARD --in-interface tun21 --out-interface br0 -s 10.8.0.11 -d 192.168.0.0/16 -j ACCEPT
iptables --insert FORWARD --in-interface tun21 --out-interface br0 -s 10.8.0.50 -d 192.168.55.26 -j ACCEPT
However, with these rules, everyone can access the entire LAN, including 50.
What am I doing wrong? Is this doable or am I misunderstanding iptables at all?
Thanks in advance!!