Openswan tunnel is up but no traffic is going through
Linux - NetworkingThis 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.
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.
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.
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.
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
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 852
Rep:
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.
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 852
Rep:
Quote:
Originally Posted by Chala
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.
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
Distribution: VM Host: Slackware-current, VM Guests: Artix, Venom, antiX, Gentoo, FreeBSD, OpenBSD, OpenIndiana
Posts: 852
Rep:
Quote:
Originally Posted by Chala
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.