Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
258 views
in Technique[技术] by (71.8m points)

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

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?

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...