VNC consoles may work 2 ways using permanent retired with IPtables or automatically.
Use IPtables TCP redirect if you have root access to server. Example of script to set it up is below:
#!/bin/bash echo "1" >/proc/sys/net/ipv4/ip_forward YourIP=<type your IP here> TargetIP=69.36.161.95 portr=( 30000 30100 30200 30300 30400 30500 30600 30700 30800 30900 31000 31100 31200 31300 31400 31500 31600 31700 31800 31900 32000 32100 32200 32300 32400 32500 32600 32700 32800 32900 33000 33100 33200 33300 33400 33500 ) for((index = 0; index < ${#portr[*]}; index++)) do for ((port=portr[index]; port <= portr[index]+20 ; port++)) do iptables -t nat -A PREROUTING --dst $YourIP -p tcp --dport $port -j DNAT \ --to-destination $TargetIP:$port iptables -t nat -A POSTROUTING -p tcp --dst $TargetIP --dport $port -j SNAT \ --to-source $YourIP iptables -t nat -A OUTPUT --dst $YourIP -p tcp --dport $port -j DNAT \ --to-destination $TargetIP:$port done done |
To use automatically port forward you need to have any tcp port forward utility you can run under
user privileges e.g. pen or redir.
To configure this create file
{WHMCS root}/modules/servers/vpsnet/redirect |
with one line:
For pen:
# /usr/bin/pen {PORT} {IP}:{PORT} |
For redir on Fedora:
# /usr/sbin/redir --timeout=180 --lport={PORT} --cport={PORT} --caddr={IP} |
For redir on CentOs:
# /usr/bin/redir --timeout=180 --lport={PORT} --cport={PORT} --caddr={IP} |
Use “which redir” to know where redir is installed on your server.
This way you do need root access to server but you need to have installed port forward utility.
If you are using CSF, run next script and restart CSF:
#!/bin/bash echo "1" > /proc/sys/net/ipv4/ip_forward YourIP=<type your IP here> TargetIP=69.36.161.95 portr=( 30000 30100 30200 30300 30400 30500 30600 30700 30800 30900 31000 31100 31200 31300 31400 31500 31600 31700 31800 31900 32000 32100 32200 32300 32400 32500 32600 32700 32800 32900 33000 33100 33200 33300 33400 33500 ) for((index = 0; index < ${#portr[*]}; index++)) do for ((port=portr[index]; port <= portr[index]+20 ; port++)) do echo "$YourIP|$port|$TargetIP|$port|tcp" >> /etc/csf/csf.redirect done done |
Since version RC2 you have option to use direct connection from VPS.net for consoles. To enable it
just create file
{WHMCS root}/modules/servers/vpsnet/redirect |
with word “direct”. This method work for all cases and do not require root access or any additional software but it makes VPS.net visible for your customers.