LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 05-14-2009, 04:43 AM   #1
filex
Member
 
Registered: Sep 2004
Posts: 56

Rep: Reputation: 15
OpenVPN problem


I was try to setup OPENVPN as detail show below, I'm having an issue connect to another subnet.

OPENVPN server.conf:
port 1194
proto udp
dev tun
ca keys/ca.crt
cert keys/server.crt
key keys/server.key
dh keys/dh1024.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 10.8.0.1 255.255.255.0"
push "route 172.16.0.0 255.255.0.0"
push "route 219.95.19x.0 255.255.0.0"
push "redirect-gateway"
keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3

SERVER INTERNAL NETWORK
eth0 Link encap:Ethernet HWaddr 00:22:19:86:A3:70
inet addr:172.16.7.254 Bcast:172.16.255.255 Mask:255.255.0.0
inet6 addr: fe80::222:19ff:fe86:a370/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:3637 errors:0 dropped:0 overruns:0 frame:0
TX packets:12999 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:437068 (426.8 KiB) TX bytes:834466 (814.9 KiB)
Interrupt:169 Memory:f8000000-f8012100

SERVER EXTERNAL NETWORK/INTERNET
eth1 Link encap:Ethernet HWaddr 00:22:19:86:A3:72
inet addr:219.95.19x.1xx Bcast:219.95.19x.1xx Mask:255.255.255.252
inet6 addr: fe80::222:19ff:fe86:a372/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:27270 errors:0 dropped:0 overruns:0 frame:0
TX packets:25354 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3293475 (3.1 MiB) TX bytes:4886119 (4.6 MiB)
Interrupt:169 Memory:f4000000-f4012100

SERVER OPENVPN
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.0.1 P-t-P:10.8.0.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:69 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:4345 (4.2 KiB) TX bytes:540 (540.0 b)

# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.8.0.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
219.95.1xx.1xx 0.0.0.0 255.255.255.252 U 0 0 0 eth1
10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 219.95.19x.1xx 0.0.0.0 UG 0 0 0 eth1


# ip route
10.8.0.2 dev tun0 proto kernel scope link src 10.8.0.1
219.95.1xx.1xx/30 dev eth1 proto kernel scope link src 219.95.1xx.1xx
10.8.0.0/24 via 10.8.0.2 dev tun0
169.254.0.0/16 dev eth1 scope link
172.16.0.0/16 dev eth0 proto kernel scope link src 172.16.7.254
default via 219.95.19x.1xx dev eth1



WINDOWS XP ipconfig /all show:
IP ADDRESS: 10.8.0.6
NETMASK: 255.255.255.252
GATEWAY: 10.8.0.5
DHCP: 10.8.0.5


While connected to OpenVPN server with Windows XP (firewall off), I was managed to ping 172.16.7.254 BUT NOT 172.16.2.1(this IP is pingable in server itself). Any idea why I can't ping 172.16.2.1 or 172.16.2.2?


Please help?

NOTE: IPTABLES and WINDOWS XP Firewall are OFF.

Last edited by filex; 05-14-2009 at 09:54 PM.
 
Old 05-14-2009, 10:16 AM   #2
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
turn on routing on linux by following command
Code:
echo "1" > /proc/sys/net/ipv4/ip_forward
regards
 
Old 05-14-2009, 11:08 AM   #3
filex
Member
 
Registered: Sep 2004
Posts: 56

Original Poster
Rep: Reputation: 15
done and same problem.

Can I know whether OpenVPN support 255.255.0.0 network?
 
Old 05-14-2009, 12:01 PM   #4
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
it should support 255.255.0.0 subnet. it seems that u have network setup trouble.
please check routing table windows side: "route print", and u may want to try traceroute : "traceroute 172.16.2.1"

and what about logs on linux side? check /var/log/messages and openvpn-status.log

u may also want to add an iptables log rule to see if packets comes from windows box and turn back from local network.
Code:
iptables -I FORWARD -i tun0 -d 172.16.0.0/16 -j LOG --log-prefix " packets from windows to local net:"
iptables -I FORWARD -o tun0 -s 172.16.0.0/16 -j LOG --log-prefix " packets to windows from local net:"
u should see those packets in /var/log/messages or /var/log/syslog files depending on your linux distro..

and another point is the local computers that have 172.16.x.x ip addresses, must use 172.16.7.254 (linux) as gateway. if not, u should do ip MASQUERADE on linux box.

regards
 
Old 05-14-2009, 09:56 PM   #5
filex
Member
 
Registered: Sep 2004
Posts: 56

Original Poster
Rep: Reputation: 15
maxut, you're right. I need MASQUERADE.

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Thanks and appreciated!
 
Old 05-15-2009, 10:16 AM   #6
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
welcome!
glad to hear that it worked..
 
  


Reply

Tags
openvpn, vpn


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenVPN client has not default gateway when connect to OpenVPN server sailershen Linux - Security 3 03-04-2010 03:20 AM
OpenVPN Question : connecting 5-6 comps with OpenVPN duryodhan Linux - Networking 7 02-15-2007 11:28 PM
OpenVPN problem Rognon Linux - Networking 2 09-25-2006 07:33 PM
Openvpn problem kingisthebest Linux - Networking 1 03-07-2006 06:23 AM
Problem with OpenVPN eantoranz Linux - Networking 8 10-10-2005 05:49 PM


All times are GMT -5. The time now is 09:44 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration