Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to configure NAT for my VPN connection. I have one NIC with 5 configured public IP addresses and I want to use one specific IP address for this NAT config.

I have enabled the ipv4 forwarding and successfully configured SNAT, but the internet connection still doesn't work. I am not sure how to configure prerouting.

This is the setup:

  • IP addresses 172.20.0.2 - 244 are used for the IP address pool for my VPN connection.
  • I want to use the IP address 46.xxx.xxx.18 as the VPN address. This IP address is configured on eth0 as eth0:4 and the other IP addresses on eth0 can't be used for this connection.
  • The IP address 172.20.0.1 is assigned to eth0:5

With masquerade everything works fine, but I can't select which IP address will be used.

Thank you for your help.

share|improve this question
    
What is address of VPN interface? –  Selivanov Pavel Aug 16 '12 at 14:43
    
VPN interface has the IP address set to 10.10.10.1. localip 10.10.10.1, remoteip 10.10.10.2-10.10.10.254 –  Viktor Stískala Aug 17 '12 at 12:09
    
What kind of VPN you are using? OpenVPN? PPTP? eth0:5, which has address 10.10.10.1, can not be VPN interface, because it's ethernet interface. VPN interface is tun/tap for OpenVPN or pppX for PPTP, PPPoE, etc. Please write your VPN type and configuration, and output of commands: ip adress print, ip route print, iptables -L -v -n, iptables -L -v -n -t nat –  Selivanov Pavel Aug 17 '12 at 12:20
    
I've changed the configuration a little bit, this is the output of the commands pastebin.com/pJj25PdY –  Viktor Stískala Aug 17 '12 at 16:23
    
I don't see any VPN interfaces. VPN server is not started. iptables are virgin clean, you didn't configure them. –  Selivanov Pavel Aug 17 '12 at 19:11

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.