LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 12-17-2010, 10:10 AM   #1
salukibob
LQ Newbie
 
Registered: Mar 2001
Location: South of England
Posts: 9

Rep: Reputation: 0
Routing for a VPN Gateway Setup


Hello,

I've been trying to setup an IPSec connection between two routers, but am having trouble with the actual packet routing.

My setup currently is two local networks (192.168.1.0/24[netLANA] and 192.168.0.0/24[netLANB]) that are connected to their own routers (192.168.1.1 and 192.168.0.1 respectively). The routers are both connected to the 194.26.1.0/24[netWAN] network. I wish to setup an IPSec connection between the two routers, to act in tunnel mode between the two local networks.

The first router is a linux box (on the netLANA network) that I am setting up using the ipsec-tools, and the other is a Netgear ProSafe FVS318G (on the netLANB). I've set them both up to have the same configuration for IPSec. Also, on the linux router I have setup a route like this:
Code:
$ route add -net 192.168.1.0/24 wlan0
So that all traffic destined for the netLANB network will be routed to the wlan0 interface (netWAN in this case, and therefore over the tunnel).

My problem is that if I ping from any host on netLANA, I can see the ICMP reply comes back to the linux router, but it doesn't get back to the original host.

From the linux router, here is the tcpdump of the ping:
Code:
$ tcpdump -n -S -i any
17:06:26.308353 IP 192.168.0.5 > 192.168.1.4: ICMP echo request, id 1036, seq 1, length 64
17:06:26.308780 IP 194.16.1.6 > 194.16.1.5: ESP(spi=0x0ea08914,seq=0x2f), length 116
17:06:26.316287 IP 194.16.1.5 > 194.16.1.6: ESP(spi=0x0be1036c,seq=0x2f), length 116
17:06:26.316287 IP 192.168.1.4 > 192.168.0.5: ICMP echo reply, id 1036, seq 1, length 64
So it looks like the vpn tunnel is working properly, just not my routing. Here is my routing table:
Code:
$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
194.16.1.0      0.0.0.0         255.255.255.0   U     0      0        0 wlan0
0.0.0.0         194.16.1.1      0.0.0.0         UG    0      0        0 wlan0
On the linux router, the interfaces are setup as:
eth0 = 192.168.1.1 (netLANA)
wlan0 = 194.16.1.6 (netWAN)

Can anyone suggest what route entry I need to add to make this all work smoothly?

Thanks for any help with this,
Regards
Rob Smith
 
Old 12-17-2010, 03:08 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
You can monitor eth0 interface only to check whether ping reply send out on eth0 interface and check destination MAC address.
 
Old 12-20-2010, 05:02 AM   #3
salukibob
LQ Newbie
 
Registered: Mar 2001
Location: South of England
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks very much for your reply. Thankfully, I have finally found the problem, and of course, it was a simple typo.

I had setup my policies for setkey as:
Code:
spdadd 192.168.0.0/24 192.168.1.0/24 any -P out ipsec esp/tunnel/194.16.1.6-194.16.1.5/require;
spdadd 192.168.1.0/24 192.168.0.0/24 any -P out ipsec esp/tunnel/194.16.1.5-194.16.1.6/require;
An eagle eyed person will notice that the second line should by '-P in' instead of '-P out'. Therein was my mistake. It needed fresh weekend-rested eyes to spot that one!

Cheers
Rob
 
  


Reply



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
VPN and routing dormant Linux - Networking 8 08-28-2010 06:31 PM
VPN Routing kevosurge Linux - Networking 2 08-17-2009 07:29 AM
Routing through a gateway Tom Douglas Linux - Networking 7 10-25-2008 10:30 AM
VPN - Default Gateway / Routing Issues, pptpd stuartornum Linux - Networking 0 03-25-2008 01:15 PM
vpn routing without the gateway karen.pertierra Linux - Networking 1 03-18-2007 06:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration