This simple rules of iptables enough for VPS/VDS Linux-based server for usage him as transparent proxy. Create new file for Bash script and put into this file the next text.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#!/bin/bash echo "1"> /proc/sys/net/ipv4/ip_forward PROXY="0.0.0.0" SERVER="0.0.0.0" PORT="7777" iptables -F iptables -t nat -A PREROUTING -p tcp --dst $PROXY --dport $PORT -j DNAT --to-destination $SERVER:$PORT iptables -t nat -A POSTROUTING -p tcp --dst $SERVER --dport $PORT -j SNAT --to-source $PROXY # Block ICMP traffic, e.g. ping. iptables -t nat -A PREROUTING -p icmp --icmp-type echo-request --dst $PROXY -j DNAT --to-destination $SERVER iptables -t nat -A POSTROUTING -p icmp --icmp-type echo-reply --dst $SERVER -j SNAT --to-source $PROXY |
Change PROXY and SERVER variables by own. Add premissions for this file and execute.
For usage proxy gates you need to use the uLogin project.