LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-10-2017, 12:22 AM   #1
Chala
LQ Newbie
 
Registered: Oct 2017
Posts: 9

Rep: Reputation: Disabled
Openswan tunnel is up but no traffic is going through


Hi All,

Im newbie to this thread and also for linux. I have little knowledge on linux and trying setup ipsec tunnel using openSwan on centos. My problem is, tunnel is established but not traffic going through. Can someone please help on this. Im trying this now for several days but
no luck. my server is a VPS which has two IPs. one is public and other one is private. both ips are assigned same interface as below
Here are some info.

ip add result. :

ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
inet 162.x.x.x/19 brd 162.x.x.x scope global eth0
inet 172.19.25.194/30 brd 172.19.25.195 scope global eth0:cp1
inet6 x::x:x:x:x/64 scope link
valid_lft forever preferred_lft forever

When I telnet to remote private IP it gives following error :

telnet 202.x.x.x 5016
Trying 202.x.x.x...
telnet: connect to address 202.x.x.x: No route to host

If you have any idea on this please help me. Thank you. If you need more info let me know. I'll send you.
 
Old 10-10-2017, 11:07 PM   #2
Chala
LQ Newbie
 
Registered: Oct 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
can someone light me up please?
 
Old 10-11-2017, 12:32 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
If a tunnel is "up," in that you can successfully "ping" both sides, then the problem is most likely that traffic is not being routed through it.

For instance, use the traceroute ip_address command to try to reach an IP-address that you know that you should be able to reach. This command will try to explore that route, "hop" by "hop," both "there and back again." Does it, in fact, know the route? (If you see the output de-evolve into "a string of asterisks," it means that the packet could not return.)

All VPN solutions basically work as "network appliances" (routers, or sometimes bridges) "implemented in software." But the basic requirement of routing still holds: "given an IP destination-address, such as 202.x.x.x," each computer must know where and how to send it. Either the packet will be sent to a particular NIC, or it will be sent to a gateway that will be responsible for getting it to where it needs to go. Your VPN "router," like all routers, is such a gateway.

Although I do most of my work these days with OpenVPN, rather than Swan, the principles are generally the same: "the software-device acts as a router." Given that you have succeeded in getting the two sides to talk to each other ("Yay!!"), what's left to you is "a TCP/IP routing problem."

Quite a few tutorials out there tend to focus on "getting the damned thing to connect!" (Which is why I said, "Yay!") They're not-so-good at explaining the routing. Here's a good one.

But here's one important question: "Is the machine that's trying to talk, the same machine that's running the VPN? Or are they separate machines, such that 'the machine that is running the VPN' is simply functioning 'as a router?'" In the latter case, you're strictly dealing with "a routing issue" that would be the same if encryption were not a part of it at all ... that would be the same if 'the router' were quite-literally a box.

Last edited by sundialsvcs; 10-11-2017 at 12:39 PM.
 
Old 10-11-2017, 09:00 PM   #4
Chala
LQ Newbie
 
Registered: Oct 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thank you very much for your reply.
Here I attached the my scenario in JPG. MY server is a bluehost VPS. openSwan and the application both running on same server.When I put a trace route without tunnel its going to destination from long path through internet. But when I put it after establishing the tunnel its stop at servers External IP.

Without tunnel

Quote:
[~]#[~]# traceroute 202.x.x.173
traceroute to 202.x.x.173 (202.x.x.173), 30 hops max, 60 byte packets
1 162-x-x-x.unifiedlayer.com (162.x.x.x) 0.797 ms 162-x.x.x.unifiedlayer.com (162.x.x.x) 0.833 ms 162-x-x-x.unifiedlayer.com (162.x.x.x) 0.805 ms
2 162-x.x-50.unifiedlayer.com (162.x.x.50) 6.186 ms 6.203 ms 162-x.x-54.unifiedlayer.com (162.x.x.54) 6.198 ms
3 162-x.x-148.unifiedlayer.com (162.x.x.148) 6.192 ms 162-x.x-152.unifiedlayer.com (162.x.x.152) 6.188 ms 162-x.x-166.unifiedlayer.com (162.x.x.166) 6.185 ms
4 ae-34.a01.snjsca04.us.bb.gin.ntt.net (129.250.195.137) 20.151 ms ae-33.a01.lsanca07.us.bb.gin.ntt.net (129.250.198.181) 19.878 ms 19.911 ms
5 ae-9.r00.lsanca07.us.bb.gin.ntt.net (129.250.2.17) 201.774 ms ae-5.r02.snjsca04.us.bb.gin.ntt.net (129.250.3.162) 20.032 ms ae-9.r00.lsanca07.us.bb.gin.ntt.net (129.250.2.17) 201.804 ms
6 ae-2.r23.lsanca07.us.bb.gin.ntt.net (129.250.3.237) 16.530 ms 16.383 ms ae-1.r22.snjsca04.us.bb.gin.ntt.net (129.250.3.26) 19.963 ms
7 ae-2.r20.sngpsi05.sg.bb.gin.ntt.net (129.250.3.49) 188.580 ms ae-12.r22.snjsca04.us.bb.gin.ntt.net (129.250.4.150) 24.614 ms ae-2.r20.sngpsi05.sg.bb.gin.ntt.net (129.250.3.49) 188.600 ms
8 ae-2.r20.sngpsi05.sg.bb.gin.ntt.net (129.250.3.49) 201.219 ms ae-1.r00.sngpsi05.sg.bb.gin.ntt.net (129.250.7.19) 203.042 ms 207.967 ms
9 116.51.31.126 (116.51.31.126) 271.373 ms ae-1.r00.sngpsi05.sg.bb.gin.ntt.net (129.250.7.19) 196.495 ms 195.483 ms
10 * * 116.51.31.126 (116.51.31.126) 270.887 ms
11 * * *
12 * * *
13 * * *
14 * * *

I asked from remote end admins, why it stop at 116.51.31.126. According to them that should come only to that point. They are handling after that point.

TraceRoute with tunnel
Quote:
traceroute 202.x.x.173
traceroute to 202.x.x.173 (202.x.x.173), 30 hops max, 60 byte packets
1 server.xxxxxx.com (162.x.x.x) 3000.353 ms !H 3000.334 ms !H 3000.292 ms !H


Can it be blocking from bluehost side?
Attached Thumbnails
Click image for larger version

Name:	Untitled.jpg
Views:	40
Size:	22.6 KB
ID:	26087  

Last edited by Chala; 10-11-2017 at 09:14 PM.
 
Old 10-12-2017, 07:39 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Thread being moved to Linux Networking to give the question some better exposure.
 
Old 10-12-2017, 07:59 AM   #6
Chala
LQ Newbie
 
Registered: Oct 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thank you. Im still trying to find some path. still I couldn't identify the point.
 
Old 10-14-2017, 01:41 PM   #7
Chala
LQ Newbie
 
Registered: Oct 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Is anyone their for help please ?
 
Old 10-14-2017, 05:14 PM   #8
Aeterna
Senior Member
 
Registered: Aug 2017
Location: Terra Mater
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 1,008

Rep: Reputation: Disabled
1) start tunnel
1a) check if tun is up and working (if not start tun manually first before setting up tunnel)
2) adjust default gateway
3) adjust resolv.conf

this works for stunnel/vpn. I would think that that is all you need.for openswan/ipsec too.

in addition CentOS may have another quirks I don't know about. e.g. the above works in Slackware, funtoo, devuan or FreeBSD but openindiana/solaris require some extra adjustments.

Last edited by Aeterna; 10-14-2017 at 05:30 PM.
 
Old 10-14-2017, 09:08 PM   #9
Chala
LQ Newbie
 
Registered: Oct 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thank Aeterna. I will check this and let you know. There is no tun interface when I check ip add. so which means I need to create it manually right.
 
Old 10-14-2017, 10:07 PM   #10
Aeterna
Senior Member
 
Registered: Aug 2017
Location: Terra Mater
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 1,008

Rep: Reputation: Disabled
Quote:
Originally Posted by Chala View Post
Thank Aeterna. I will check this and let you know. There is no tun interface when I check ip add. so which means I need to create it manually right.
Well, first you need a kernel that has tun module. I hope that CentOS mostly used as server has tun enabled in kernel.
When you establish ipsec connection
check for tun:
lsmod | grep tun

if you see tun module listed, just configure default gateway and resolv.conf
on the other hand, if you do not see tun module, then run
sudo modprobe tun
and try to connect ipsec again.
at this point you should loose connectivity and to restore it you will have to change default gateway and nameserver. That is all.

hope that this will help
 
Old 10-14-2017, 10:24 PM   #11
Chala
LQ Newbie
 
Registered: Oct 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Hi, This is what I get when I run the tun command.
Quote:
[~]# lsmod | grep tun
xfrm4_tunnel 1981 0
tunnel4 2943 1 xfrm4_tunnel
xfrm4_mode_tunnel 2002 0
xfrm6_mode_tunnel 1906 0
xfrm6_tunnel 4379 1 ipcomp6
tunnel6 2714 1 xfrm6_tunnel
tun 17094 0
ipv6 336368 47 ah6,esp6,xfrm6_mode_beet,xfrm6_mode_tunnel,ipcomp6,xfrm6_tunnel,tunnel6
And also the default gateway should be the external IP of my server right(which is use to create the tunnel)? And when I check the resolve.conf It include "search bluehost.com" . What should be in resolve.conf.
Please forgive me if its a foolish question. My knowledge is limited in this area. Highly appreciate your help . Thank you

Last edited by Chala; 10-14-2017 at 10:35 PM.
 
Old 10-14-2017, 11:05 PM   #12
Aeterna
Senior Member
 
Registered: Aug 2017
Location: Terra Mater
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 1,008

Rep: Reputation: Disabled
Quote:
Originally Posted by Chala View Post
Hi, This is what I get when I run the tun command.


And also the default gateway should be the external IP of my server right(which is use to create the tunnel)? And when I check the resolve.conf It include "search bluehost.com" . What should be in resolve.conf.
Please forgive me if its a foolish question. My knowledge is limited in this area. Highly appreciate your help . Thank you
tun 17094 0 <- ok

search bluehost.com
change to or delete altogether, this will get recreated by DHCP next time.
#search bluehost.com
also
#nameserver_from_your_isp_provider
but
nameserver_of_your_tunnel/ipsec_provider


gateway is not their server ip address, you should get their gateway address from their site. I am not sure how this should be set for tunnel/ipsec but because now you are connected to their local network it will be probably 10.xxx.xxx.xxx
You may need to consult their site.
 
Old 10-14-2017, 11:14 PM   #13
Chala
LQ Newbie
 
Registered: Oct 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Thanks. I will check this one.
 
Old 11-06-2017, 09:45 AM   #14
Chala
LQ Newbie
 
Registered: Oct 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Hi All,
Sorry for late reply. Unfortunately this couldn't investigate further, Cuz client decided to go with AWS. How ever thank you very much for the support
you given.
 
  


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
IPSec Tunnel AWS VPC <-> openSwan CentOS 6.6 Tunnel up, no traffic cojafoji Linux - Server 10 07-09-2015 08:07 AM
openswan ipsec tunnel pinging only one side. Gil@LQ Linux - Networking 0 09-21-2013 02:41 PM
how to know if the traffic via IPSEC tunnel is encrypted and tunnel working Gil@LQ Linux - Security 3 09-06-2013 05:02 AM
l2tp and openswan tunnel problem? shams Linux - Networking 2 06-26-2013 07:26 AM
OpenSWAN - IPSec tunnel drops dieduster Linux - Networking 0 12-17-2006 10:07 AM

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

All times are GMT -5. The time now is 12:17 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