Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
01-11-2013, 03:36 AM
|
#1
|
Member
Registered: Jan 2013
Location: Stockholm, Sweden
Distribution: Debian 6
Posts: 37
Rep: 
|
OpenVPN struggles
I've got some problems with my OpenVPN setup.
The Setup:
-> Ubuntu Server 12.04
-> Two active NIC's: eth0 (default): 192.168.1.0/24
eth1: x.x.x.x (external ip)
I've managed to get the routing to work so i can connect to the outside world with the eth1 NIC.
Code:
holmen@filserver:~$ ping -I eth1 -c 3 www.linuxquestions.org
PING www.linuxquestions.org (75.126.162.205) from 192.168.1.2 eth1: 56(84) bytes of data.
64 bytes from www.linuxquestions.org (75.126.162.205): icmp_req=1 ttl=50 time=133 ms
64 bytes from www.linuxquestions.org (75.126.162.205): icmp_req=2 ttl=50 time=133 ms
64 bytes from www.linuxquestions.org (75.126.162.205): icmp_req=3 ttl=50 time=133 ms
--- www.linuxquestions.org ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 133.281/133.336/133.379/0.423 ms
One curious thing is that the "from ip #". It says "from 192.168.1.2 eth1" but that ip is the servers ip on the eth0 iface.
Netstat:
Code:
holmen@filserver:~$ netstat -anr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
x.x.x.x 0.0.0.0 255.255.128.0 U 0 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
But here comes the real problem:
When setting up openvpn with the option "local x.x.x.x (eth1 ext ip)" it still tunnels the eth0 interface. And i cant understand why.
OpenVPN settings:
Code:
client
dev tap
proto udp
local x.x.x.x
remote openvpn.anonine.net 1194
remote openvpn.anonine.net 1195
remote openvpn-2.anonine.net 1196
remote openvpn-2.anonine.net 1197
remote openvpn-3.anonine.net 1198
remote openvpn-3.anonine.net 1199
remote openvpn-4.anonine.net 1200
remote openvpn-4.anonine.net 1201
remote-random
resolv-retry infinite
auth-user-pass
persist-key
persist-tun
ca anonine.ca.crt
ns-cert-type server
comp-lzo
reneg-sec 0
verb 3
Netstat (tunnel active):
Code:
holmen@filserver:~$ netstat -anr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 46.246.20.129 128.0.0.0 UG 0 0 0 tap0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
x.x.x.x 0.0.0.0 255.255.128.0 U 0 0 0 eth1
46.246.20.128 0.0.0.0 255.255.255.128 U 0 0 0 tap0
80.67.8.222 192.168.1.1 255.255.255.255 UGH 0 0 0 eth0
128.0.0.0 46.246.20.129 128.0.0.0 UG 0 0 0 tap0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Anyone got any ideas?
Last edited by junkyhlm; 01-15-2013 at 12:44 AM.
|
|
|
01-14-2013, 09:01 AM
|
#2
|
Member
Registered: May 2011
Location: Nottingham, UK
Distribution: Debian
Posts: 178
Rep:
|
Ubuntu network manager is unreliable in my experience. Last I tried using it was about 18 months ago, so it might be fixed, but I was getting errors where an interface fails to come up or isn't seen. I am running with a manual setup since then, without any issues.
On a separate note, Ubuntu is a desktop distribution and to me Ubuntu Server is an oxymoron  I use Debian for servers, which is essentially the same OS but changed less often and more stable.
To help provide a better picture of your setup, run and post the output of:
(you might want to edit any public IP addresses, not a good idea to publish them)
ifconfig
ip route show table all
ip rule show
iptables -t nat -L -v -n
Nik
|
|
|
01-16-2013, 08:21 AM
|
#3
|
Senior Member
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323
Rep: 
|
A little confused by what is going on, but I think part of it has to do with the order that the NICs are being brought up. But on reconsideration looking at your routing table it appears your default route is set to go through that interface, which would explain why it is coming from there. You've got your routes all jugged up. I would go back to basics to start shutdown the OpenVPN connections, remove any routes you've added and add a default route , then being your OpenVPN connections back up and let them write their entries to the routing table then perhaps post the out put again and go from there.
|
|
|
01-17-2013, 03:30 AM
|
#4
|
Member
Registered: Jan 2013
Location: Stockholm, Sweden
Distribution: Debian 6
Posts: 37
Original Poster
Rep: 
|
Thank you for your post but after consulting the community support of openvpn i've concluded that this is pretty much impossible.
|
|
|
01-17-2013, 06:57 AM
|
#5
|
Senior Member
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323
Rep: 
|
Sorry you couldn't accomplish what you wanted to do, however, I'm still not clear on what it was you wanted to do.
|
|
|
01-17-2013, 07:27 AM
|
#6
|
Member
Registered: Jan 2013
Location: Stockholm, Sweden
Distribution: Debian 6
Posts: 37
Original Poster
Rep: 
|
Quote:
Originally Posted by scheidel21
Sorry you couldn't accomplish what you wanted to do, however, I'm still not clear on what it was you wanted to do.
|
This is what i tried to accomplish:
I have a server running with apache2, rtorrent and ssh as the main applications that need connection to the outside world. I have tried for some time now to separate my applications connections over 2 separe NIC's (eth0 and eth1). My main goal in this was to have a VPN tunnel to a anonymizer service (Anonine.com) running only at one NIC, eth1 to be exact. I get 2 separate external ip's from my ISP and i have got the two NIC's to work as they should.
So my setup would look something like attached image.
And then have only rtorrent running via the VPN tunnel on eth1 since i don't want to hide the ip of my apache2 and ssh servers.
And there's my problem..
|
|
|
01-17-2013, 07:35 AM
|
#7
|
Senior Member
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323
Rep: 
|
This can't be done in the OpenVPN configuration, but this might be able to be accomplished using either IPtables (prevent rtorrent traffic form going out the non VPN interface) or iproute2 ( http://lartc.org/howto/lartc.iproute2.html) it's used for advanced routing, like ensuring traffic coming in on one interface goes out the same interface it came in, regardless of routing table. Also you might take a look at this http://libtorrent.rakshasa.no/ticket/1809 looks like someone created a way you could bind rtorrent to a specific interface, which would accomplish what you want as well.
|
|
|
01-17-2013, 07:52 AM
|
#8
|
Member
Registered: Jan 2013
Location: Stockholm, Sweden
Distribution: Debian 6
Posts: 37
Original Poster
Rep: 
|
Quote:
Originally Posted by scheidel21
This can't be done in the OpenVPN configuration, but this might be able to be accomplished using either IPtables (prevent rtorrent traffic form going out the non VPN interface) or iproute2 ( http://lartc.org/howto/lartc.iproute2.html) it's used for advanced routing, like ensuring traffic coming in on one interface goes out the same interface it came in, regardless of routing table. Also you might take a look at this http://libtorrent.rakshasa.no/ticket/1809 looks like someone created a way you could bind rtorrent to a specific interface, which would accomplish what you want as well.
|
Thank you for your input but thats not the problem. The problem is that the openvpn tunnel chooses the eth0 interface to be tunneled. When getting help from the community support @ #openvpn we tried many possible solutions with --up scripts and ip variables but nothing works.
Thank you on the tip of binding rtorrent to interface. I have used "bind x.x.x.x" (eth1 ip) in my .rtorrent.rc.
|
|
|
01-17-2013, 07:55 AM
|
#9
|
Senior Member
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323
Rep: 
|
Well if is binding to eth0 because it is the lower NIC you could try editing the udev rules and switch the interface names http://www.novell.com/support/kb/doc.php?id=3012993
|
|
|
01-17-2013, 08:00 AM
|
#10
|
Member
Registered: Jan 2013
Location: Stockholm, Sweden
Distribution: Debian 6
Posts: 37
Original Poster
Rep: 
|
Quote:
Originally Posted by scheidel21
|
Thank you! I thiught of this way back but thaought it was to simple to be true  Will try this tonight!
|
|
|
01-17-2013, 08:00 AM
|
#11
|
Senior Member
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323
Rep: 
|
If you edit interface names and use static settigns you will need to edit those as well
|
|
|
01-17-2013, 08:21 AM
|
#12
|
Member
Registered: Jan 2013
Location: Stockholm, Sweden
Distribution: Debian 6
Posts: 37
Original Poster
Rep: 
|
Quote:
Originally Posted by scheidel21
If you edit interface names and use static settigns you will need to edit those as well
|
Yeah ofc. But i'll just change eth0 -> 1 and vice versa in /etc/network/interfaces
|
|
|
01-17-2013, 02:01 PM
|
#13
|
Member
Registered: Jan 2013
Location: Stockholm, Sweden
Distribution: Debian 6
Posts: 37
Original Poster
Rep: 
|
Quote:
Originally Posted by scheidel21
If you edit interface names and use static settigns you will need to edit those as well
|
Nope tested your solution and its no good. It still tunnels eth0 since the default route on the main table is the eth0 NIC. 
|
|
|
01-18-2013, 12:22 AM
|
#15
|
Member
Registered: Jan 2013
Location: Stockholm, Sweden
Distribution: Debian 6
Posts: 37
Original Poster
Rep: 
|
Quote:
Originally Posted by scheidel21
|
I have tried this. It does'nt work. It still chooses the NIC#1 ip. I think it worked for the other guy because he is connecting to the same gateway.
Output when starting openvpn:
Quote:
Fri Jan 18 07:20:13 2013 ROUTE default_gateway=192.168.1.1
|
Thats is the NIC#1 gateway.
|
|
|
All times are GMT -5. The time now is 06:36 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|