Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > Linux Networking > OpenVPN traffic routing on secondary IP problem

Forgot Password?
 Linux Networking   Hardware/Software related, Modems, Internet connection sharing, IPTables etc.

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds


Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 07-04-2009   #1 (permalink)
Just Joined!
 
Join Date: Jul 2009
Posts: 1
Exclamation OpenVPN traffic routing on secondary IP problem

Hi.

I am not sure where to post this but I feel this is the appropriate section. [Mods, please move the thread to the right section if you feel otherwise.]

I seem to have a problem running a second instance of OpenVPN using a secondary IP address on my virtual machine (VPS) to successfully route my internet traffic through it. The first instance works well, with the OpenVPN server managed to create a tun1 adapter and route clients' traffic to the primary ethernet adapter and IP address on the machine, which is eth0 (aaa.aaa.aaa.aaa). All is well with the first one.

However, the same could not be done with the secondary IP/ethernet adapter, which its adapter name is eth0:0 (bbb.bbb.bbb.bbb) and a tun0 adapter. OpenVPN managed to bind to the said IP and I was able to connect to it and ping the internal VPN IP network (10.11.0.0/24), including the gateway (10.11.0.1) and my assigned IP (10.11.0.6), but for some wierd reasons, I could not browse the internet through it, as if the iptables was not set up correctly. It could be, given that when I try to set up the rules for the second server, I got a warning message about the ethernet adapter having a 'wierd character' in it. Although it shoots out a warning, the rule does seem to be applied when I invoke a list command ("iptables -t nat -L").

Code:
$ iptables -t nat -A POSTROUTING -s 10.11.0.0/24 -o eth0:0 -j MASQUERADE
Warning: weird character in interface `eth0:0' (No aliases, :, ! or *).
I even tried replacing the "-o eth0:0" switch to use IP address instead ("-d [IP]") but to no avail as well.

Any ideas on why it does work on the first OpenVPN server but not the second one? My machine is a Xen-based VPS, running Debian 64-bit. Replies are very much appreciated.

Here are my configuration files for your reference:

---
first-openvpn-server.conf
---
Code:
local aaa.aaa.aaa.aaa
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
server 10.10.0.0 255.255.255.0
ifconfig-pool-persist ipp-aaa.txt
push "redirect-gateway"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
client-to-client
keepalive 10 120
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status-aaa.log
verb 3
---

---
first-openvpn-server-client-config.ovpn
---
Code:
client
dev tun
proto udp
remote aaa.aaa.aaa.aaa 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert aaa.crt
key aaa.key
remote-cert-tls server
---

---
second-openvpn-server.conf
---
Code:
local bbb.bbb.bbb.bbb
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
server 10.11.0.0 255.255.255.0
ifconfig-pool-persist ipp-bbb.txt
push "redirect-gateway"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
client-to-client
keepalive 10 120
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status-bbb.log
verb 3
---

---
second-openvpn-server-client-config.ovpn
---
Code:
client
dev tun
proto udp
remote bbb.bbb.bbb.bbb 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert aaa.crt
key aaa.key
remote-cert-tls server
---

IPTables rules:

Code:
$ iptables -P FORWARD ACCEPT
$ iptables -t nat -A POSTROUTING -s 10.10.0.0/24 -o eth0 -j MASQUERADE
$ iptables -t nat -A POSTROUTING -s 10.11.0.0/24 -o eth0:0 -j MASQUERADE
* net.ipv4.ip_forward=1 is uncommented in /etc/sysctl.conf
dominos is offline  


Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 11:38 PM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2