OpenVPN on different IP address (eth0:1)

Need help configuring your VPN? Just post here and you'll get that help.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
kenzopl
OpenVpn Newbie
Posts: 2
Joined: Sat Jan 02, 2010 2:26 am

OpenVPN on different IP address (eth0:1)

Post by kenzopl » Sat Jan 02, 2010 2:39 am

Hello

I have a problem with my OpenVPN configuration. I always had one public IP address on my openvpn server, but few days ago I added additional IP (as eth0:1), so I would like to run openvpn on that IP:

Let's assume that my eth0 is 1.2.3.4 and my eth0:1 is 1.2.3.5

server config:
tun-mtu 1500
local 1.2.3.5
ifconfig 10.200.0.1 10.200.0.2
port 5000
proto udp
user nobody
group nogroup
comp-lzo
keepalive 10 60
daemon
verb 0
secret secret.key

client:
dev tun
tun-mtu 1500
ifconfig 10.200.0.2 10.200.0.1
proto udp
remote 1.2.3.5 5000
resolv-retry infinite
nobind
comp-lzo
keepalive 10 60
verb 0
secret secret.key

vpn works fine, it's connecting with eth0:1 1.2.3.5, not 1.2.3.4, but when I try to route my traffic from windows client throughout the vpn, then on the internet I'm still visible as 1.2.3.4, not 1.2.3.5

Can anyone help me with this ? Maybe I'm not so good in routing traffic or iptables nat etc. but I already tried several options and still nothing.

Regards

User avatar
krzee
Forum Team
Posts: 728
Joined: Fri Aug 29, 2008 5:42 pm

Re: OpenVPN on different IP address (eth0:1)

Post by krzee » Wed Jan 27, 2010 10:04 am

kenzopl wrote: vpn works fine, it's connecting with eth0:1 1.2.3.5, not 1.2.3.4, but when I try to route my traffic from windows client throughout the vpn, then on the internet I'm still visible as 1.2.3.4, not 1.2.3.5
(#1) for a basic iptables NAT where 10.8.0.x is the vpn network: iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE, or (#2) to choose what IP address to NAT as, you can use iptables -t nat -I POSTROUTING -o eth0 -j SNAT --to <IP ADDRESS>, or (#3) http://netfilter.org/documentation/HOWT ... HOWTO.html for more info

sounds like #2 is what you need

Post Reply