how to transmit traffic from a linux vpn server to another linux server?

て烟熏妆下的殇ゞ 提交于 2019-12-13 09:37:39

问题


I have established a vpn server in area b,and I can get internet from my pc on area a through this vpn server.But some services are access more convenient through area c,I want to get this services more faster,So I want to transmit all the vpn traffic from my vpn server to another linux server.Is there some awesome solution for this issue? I have googled some solutions about that,e.g. the iptables、the haproxy..but I have tried failed.could someone give me the iptables commands for this?


回答1:


First you have to run the following command to allow forwarding: sysctl net.ipv4.conf.eth0.forwarding=1 Then you have to specify the nat configuration and which ports you want to forward:

iptables -t nat -A PREROUTING -p tcp -i **Public network interface** --dport **Desired port you want to use on vpn server** -j DNAT --to-destination **IP of area C**:**Desired port you want to use on area C**

iptables -A FORWARD -p tcp -d **IP of area C** --dport **Port you want to connect on area C** -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

Hope this can help



来源:https://stackoverflow.com/questions/44177506/how-to-transmit-traffic-from-a-linux-vpn-server-to-another-linux-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!