Cannot interact remotely after Connection with OpenVPN

This forum is for admins who are looking to build or expand their OpenVPN setup.

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
WhatTheIanni
OpenVpn Newbie
Posts: 4
Joined: Fri Nov 04, 2011 10:58 am

Cannot interact remotely after Connection with OpenVPN

Post by WhatTheIanni » Fri Nov 04, 2011 11:02 am

Hello everybody.!!!

I am not that much skilled on linux and openvpn. I have a headless ubuntu minimal installation and I achieved connection to a vpn service via openVPN (as a matter of fact, it was the easiest way comparing to other vpn protocols).

The problem is that even though after the connection I have internet access via the vpn server, I cannot remotely communicate with my linux machine using the dyndns ip I've been using, not even the provider's ip.

I need to access to shell as well as an rsync service i have on that machine but I cannot even ping it.

Do I need ip forwarding? or to change / disable iptables?

Thank you so much in advance

Greetings from sunny greece

User avatar
Mimiko
Forum Team
Posts: 1564
Joined: Wed Sep 22, 2010 3:18 am

Re: Cannot interact remotely after Connection with OpenVPN

Post by Mimiko » Fri Nov 04, 2011 11:39 am

Yes, you have to enable forwarding and adjust iptable's rules.

WhatTheIanni
OpenVpn Newbie
Posts: 4
Joined: Fri Nov 04, 2011 10:58 am

Re: Cannot interact remotely after Connection with OpenVPN

Post by WhatTheIanni » Fri Nov 04, 2011 11:58 am

I guess the command for the IP forwarding is:

echo 1 > /proc/sys/net/ipv4/ip_forward

...

But how do I adjust the iptables rules???

UPDATE: I just noticed that iptables is not installed

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Cannot interact remotely after Connection with OpenVPN

Post by maikcat » Fri Nov 04, 2011 12:57 pm

hi all,

after talking to my fellow greek let me clarify his problem..

he has an ubuntu with openvpn client at his home connecting to vyprvpn service
which upon connection it redirects all traffic inside vpn.

he wants to access this server via ssh from another location using
port forward to his router at home.

the problem is that the redirection that openvpn provider does returns
his packets concerning ssh through vpn...

is there any way (using iptables maybe) to make his scenario work?

Michael.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Cannot interact remotely after Connection with OpenVPN

Post by maikcat » Fri Nov 04, 2011 2:35 pm

just a thought...

how about using ip alias on ubuntu and multiple default gateways...

http://kindlund.wordpress.com/2007/11/1 ... -in-linux/

basically forwarding ports to the alias interface and configure routing based on
traffic that destined to eth0:0..


any ideas?

Michael.
Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

User avatar
Mimiko
Forum Team
Posts: 1564
Joined: Wed Sep 22, 2010 3:18 am

Re: Cannot interact remotely after Connection with OpenVPN

Post by Mimiko » Sun Nov 06, 2011 8:37 am

Oh, now it is clear. The responce packets are return by default route if the source address does not lay on the same IP mask as eth0. First fouthg is using iptables tagging and using rerouting by the source of the packet. I don't know exactly the write writting of the rule, but it must look something like this:
route 1, tagging packets:

Code: Select all

iptables -i eth0 --dport [all the ports of the local services] --tag [tagname]
route 2, rerouting by tagname:

Code: Select all

iptables --tag [tagname] --destination-gateway x.x.x.x[gw of eth0]
But I don't know if services will respond with packets with the same tagname. So I think about another resolution: SNATing the internet on the INPUT (or MANGLE) table:

Code: Select all

iptables -i eth0 --dport [all the ports of the local services] --SNAT [ip of eth0]
So the service will respond to the IP of the eth0 and not transmit to tun-adapter. Using in rules only the ports of local services is benefit by limiting the purpose and adding security if someone will probe a non use port and something is responding, it will respond thru tunnel, so the attacker will never get responce.

WhatTheIanni
OpenVpn Newbie
Posts: 4
Joined: Fri Nov 04, 2011 10:58 am

Re: Cannot interact remotely after Connection with OpenVPN

Post by WhatTheIanni » Sun Nov 06, 2011 9:36 pm

Great! I'll try that and tell you how it works for me! Thank you :))

WhatTheIanni
OpenVpn Newbie
Posts: 4
Joined: Fri Nov 04, 2011 10:58 am

Re: Cannot interact remotely after Connection with OpenVPN

Post by WhatTheIanni » Mon Nov 07, 2011 7:58 am

Unfortunately it doesn't recognize the dport argument... nor "dports"

john@XBMCLive:~$ iptables -i wlan0 --dport 9091 --SNAT 192.168.1.70
iptables v1.4.4: unknown option `--dport'

User avatar
Mimiko
Forum Team
Posts: 1564
Joined: Wed Sep 22, 2010 3:18 am

Re: Cannot interact remotely after Connection with OpenVPN

Post by Mimiko » Mon Nov 07, 2011 8:20 am

Please find your self the correct option names of iptables. I dont have a working linux to do a test. A simple search on net gave me "--destination-port" option. Please try it. Hope you got the idea about the needed rules. :P

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Cannot interact remotely after Connection with OpenVPN

Post by maikcat » Mon Nov 07, 2011 11:03 am

Amiga 500 , Zx +2 owner
Long live Dino Dini (Kick off 2 Creator)

Inflammable means flammable? (Dr Nick Riviera,Simsons Season13)

"objects in mirror are losing"

User avatar
Mimiko
Forum Team
Posts: 1564
Joined: Wed Sep 22, 2010 3:18 am

Re: Cannot interact remotely after Connection with OpenVPN

Post by Mimiko » Mon Nov 07, 2011 6:45 pm

maikcat, a good example of marking the packets from some application.

Just remembered. Using just one rule to redirect the packets from application: Made on OUTPUT table (or mangle) add a rule to redirect packets with teh specified source port:

Code: Select all

iptable -A OUTPUT --source-port [opened ports] --gw [desired gateway]

Post Reply