Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Network Setup: Router: to internet Server: Ubuntu based server,default gateway is PC

I created a PPTP connection(interface: ppp0) on Server to a machine on the internet, what I want to do is route all the traffic from certain IP address( through the PPTP connection and then to the internet. What I did are:

  1. Set the gateway on PC( as
  2. Enabled ipv4 forward on 10,0,0,70
  3. Add the masquerade rule to iptable:
    iptables -t nat -A POSTROUTING -o ppp0 -s -j MASQUERADE

After that, it seems none of the traffic from be redirected to ppp0, instead these traffic are still going through directly.

Any thoughts on it?

share|improve this question

Assuming that the internal interface on Ubuntu gateway is eth0.

Add more 2 below rules:

iptables -A FORWARD -i eth0 -o ppp0 -s -j ACCEPT
iptables -A FORWARD -i ppp0 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT

and make sure that you removed the old gateway on the client:

route del default gw dev <ethx>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.