Unfortunately what youi are asking is not possible. You can only forward one external port to one internal IP address. However you can use different external ports to the same port internally to different IP addresses. So what you show as
217.153.10.10 access only 192.168.1.10 on port 5900
217.153.10.11 access only 192.168.2.10 on port 5900
Could be done by using external port 5900 to internal port 5900 to machine 192.168.1.10 and then another forward on external port 5901 to internal port 5900 to IP 192.168.2.10 and then external port 5902 to internal port 5900 to 192.168.3.10
This can be done with port forwarding like
edit /etc/portfw.cfg
- Code: Select all
tcp,5900,5900,192.168.1.10
tcp,6502,6502,192.168.1.10
tcp,5901,5900,192.168.2.10
tcp,5902,5900,192.168.3.10
cp /etc/portfw.cfg /boot/etc/
rc_pfwd restart
As for blocking access to or from specific IP addresses that is just a matter of adding some firewall rules into the rc_user file like:
edit /rc/rc_user
- Code: Select all
firewall)
ipfwadm -I -a accept -P tcp -S 217.153.10.10 -D 0/0 5900
ipfwadm -I -a accept -P tcp -S 217.153.10.11 -D 0/0 5900
ipfwadm -I -a accept -P tcp -S 217.153.10.19 -D 0/0 6502
ipfwadm -I -a accept -P tcp -S 153.20.19.210 -D 0/0 5901
ipfwadm -I -a accept -P tcp -S 153.20.19.110 -D 0/0 5902
ipfwadm -I -a reject -P tcp -D 0/0 5900
ipfwadm -I -a reject -P tcp -D 0/0 5901
ipfwadm -I -a reject -P tcp -D 0/0 5902
ipfwadm -I -a reject -P tcp -D 0/0 6502
;;
rc_masq restart
At this point the only thing that has to be done is to change the access port for the remote client they use to connect to the internal clients for 192.168.2.10 and 192.168.3.10
Be VERY aware that these rules are just off the top of my head and I have not tested them in any way and I sometimes make gramatical errors :rolleyes:
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.