문제

I have a gateway computer which connects Internet via ADSL and got a virtual interface ppp0. The I establish a pptp vpn through the ADSL and got a virtual interface ppp1.

There are several computers connect to this gateway computer in order to share the Internet and vpn connection.

I want to set some route rules or iptables rule to let the specific requests of specified IP ranges from the internal computers forward to the vpn connection(ppp1) and other requests go directly through the ADSL connection(ppp0).

How should I do?

도움이 되었습니까?

해결책

Hi you could do that by DNAT in iptable on the PREROUTING chain

Below example will redirect http traffic from the range of ips specified ("start-ip" to "end-ip") to the destination ip and port specified(gatewayip:vpnportnumber).

iptables -A PREROUTING -t nat -m iprange --src-range "start-ip"-"end-ip" -i "interface" -p tcp -m tcp --dport 80 -j DNAT --to-destination "gatewayip:vpnportnumber"

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top