In my country sometimes government decides to limit access to the international internet. we only have access to sites and IPs inside the country, but data centers have more access to the internet.
I need to, at first, make a VPN connection from my home internet to a data center server inside the country, then from that server create a connection to an external server to have full access like in other countries (Instagram, facebook, ...).
In the server inside of the country, I have set up openconnect on port 443 via TCP and UDP protocol, and I also made an internal socks5 proxy to an external server via SSH dynamic port forwarding via this command:
ssh -D 127.0.0.1:1888 -f -q -C -N root@remoteIp
I need to tunnel all traffic from port 443 openconnect service to 1888 socks5 proxy.
I also tried these iptables rules, but it doesn't work. I have only access to websites located in my country. It doesn't forward traffic to the created proxy.
iptables -t nat -A PREROUTING -s 127.0.0.1 -p tcp --dport 443 -j REDIRECT --to 1888
iptables -t nat -A OUTPUT -s 127.0.0.1 -p tcp --dport 443 -j REDIRECT --to 1888
I want to know if my approach is ok, and how to do that.