Linux – PPTPD nic configuration and default gateway

linuxpptpd

I have a Ubuntu 10.04 server with PPTPD server. It has one nic with eth0 and eth0:0. eth0:0 has an UK IP and eth0 has a Franch IP. I have setup eth0:0 as default gateway because I want to show that the server has an UK IP address.

The problem is that when I connect to the server using a Mac, the traffic is routed using the eht0 nic.

Is there a way to tell to PPTPD which nic to use to route the internet traffic? Using route -n I get the right routing table:

Destination 0.0.0.0 -> UK-IP

If I access an IP to geolocation web site from the server, it shows the UK IP. Network configuration is:

auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask 255.255.255.0
broadcast xxx.xxx.xxx.255
network xxx.xxx.xxx.0

auto eth0:0
iface eth0:0 inet static
address IP.DE.FAIL.OVER
netmask 255.255.255.255
broadcast IP.DE.FAIL.OVER
gateway IP.DE.FAIL.OVER

I have used this guide to configure PPTPD: http://www.ubuntugeek.com/howto-pptp-vpn-server-with-ubuntu-10-04-lucid-lynx.html

Best Answer

Instead of

# PPTP IP forwarding
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Use:

# PPTP IP forwarding
iptables -t nat -A POSTROUTING -o eth0 -d xxx.xxx.xxx.xxx -j MASQUERADE

(where xxx.xxx.xxx.xxx is the UK IP assigned to eth0:0)