LinuxQuestions.org
Help answer threads with 0 replies.
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 02-11-2016, 09:58 AM   #1
tolekutma
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Rep: Reputation: 0
Linux fwd-back tunneling


Hi,

I wish to try to configure a type of transparent tunnel.

Have three machines:
- PC A
- Linux X
- Linux Y

(See "Physical Topology" JPG)
PC A is connected to the network through "Linux X".
(Linux X, have two physical ports)

I wish to create packet flow like this: (See packet flow JPG)
1. PC A send packet (Through Linux X)
2. "Linux X" send this packet to "Linux Y" (over Tunnel ??)
3. "Linux Y" send this packet back to "Linux X" (Over Tunnel ??)
4. "Linux X" forward the packet to the network

(and same for back, PC B -> PC A)

The question is:
What is a recommended configuration?
I will be glad for any suggestion (GRE based, IP tables, etc.)

Thanks!
Attached Thumbnails
Click image for larger version

Name:	Physical.JPG
Views:	26
Size:	28.3 KB
ID:	20793   Click image for larger version

Name:	flow.JPG
Views:	21
Size:	33.9 KB
ID:	20794  
 
Old 02-12-2016, 04:48 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,286

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
I'm sure you must have a very good reason to get up to all this jiggery pokery - get porn past watchful parents or something :-).

I would approach that using virtual interfaces. You configure something like 172.16.1.22.1 -- one nic on one tunnel
& 172.16.1.22.2 -- same nic but another tunnel. You make routes, and others are not 'in the loop.

I think linux tools support virtual interfaces, but switches don't necessarily do so.
 
Old 02-12-2016, 05:47 PM   #3
tolekutma
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Hi,

Thanks for the reply.

Ofcourse the interfaces on the left nic should be logical interfaces.

The main challenge is routing.
Because the same packet arrive from two different interfaces.
1. From PC A (1) and need to be forward up (2)
2. From Linux (3) and forward to PC B (4)

So, same packet (same source&destination IPs ) come from two different interfaces.
Is there a way to do one of the following:
1. routing based on the inbound interface?
2. if we assume using GRE interfaces. Can add GRE interface to bridge?


Thanks
 
Old 02-13-2016, 11:41 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,286

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
I don't know GRE and have not used it. I('m not qualified to answer that.
 
Old 02-14-2016, 09:11 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938
When you speak of "tunneling" in this way, you are certainly speaking of some form of VPN = Virtual Private Networking.

You could be speaking of:
  • ipSEC-based VPNs, the support for which is built deeply into the operating system, or ...
  • OpenVPN, which runs as a privileged user-land process that uses low-level software interfaces ("tun" and "tap") provided by the OS.
The fundamental illusion provided by both is the same: that "it really is 'real.'"

Now, I presume that you already know how "physical" (IP ...) addressing works:
  1. Each of the network interface cards (NICs) in your machine has an IP-address.
  2. The "other" computers in your local network also have IP-addresses that are known to yours. (These computers, which can be reached directly, are said to belong to 'local subnets.') There are three ways to get there:
    1. They are directly connected.
    2. You go through a switch.
    3. You go through a (local...)router.
  3. In order to get to "anywhere else" ... to anywhere that is not "on a subnet' ... the traffic must first be forwarded to a gateway, such as your Internet router.
So far, so good? Great.

VPNs extend this idea by defining additional subnets ... and the gateways which serve them ... entirely in software. The role of "router" (or "switch") is assumed by the VPN software, which transparently communicates to its peer using the system's (physical ...) network interfaces. Software clients cannot detect that these resources aren't "physically real."

Just like physically-attached subnets, these VPN-subnets either are (virtually ...) bridged, or they are connected by (virtual ...) routers. (VPNs provide software equivalents for both models.) If the subnets are routed, appropriate routing rules must be provided as-needed to route packets to the appropriate gateways correctly, exactly(!) as would be the case if the gateways were "real." VPN software generally provides for routing rules to be "set up" when a connection is made, then "torn down" when it is severed.)

Last edited by sundialsvcs; 02-14-2016 at 09:20 PM.
 
2 members found this post helpful.
Old 02-15-2016, 05:49 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,286

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
@sundialsvcs: Very simple and thorough summary!
 
Old 03-21-2017, 03:57 AM   #7
tolekutma
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by sundialsvcs View Post
When you speak of "tunneling" in this way, you are certainly speaking of some form of VPN = Virtual Private Networking.

You could be speaking of:
  • ipSEC-based VPNs, the support for which is built deeply into the operating system, or ...
  • OpenVPN, which runs as a privileged user-land process that uses low-level software interfaces ("tun" and "tap") provided by the OS.
The fundamental illusion provided by both is the same: that "it really is 'real.'"

Now, I presume that you already know how "physical" (IP ...) addressing works:
  1. Each of the network interface cards (NICs) in your machine has an IP-address.
  2. The "other" computers in your local network also have IP-addresses that are known to yours. (These computers, which can be reached directly, are said to belong to 'local subnets.') There are three ways to get there:
    1. They are directly connected.
    2. You go through a switch.
    3. You go through a (local...)router.
  3. In order to get to "anywhere else" ... to anywhere that is not "on a subnet' ... the traffic must first be forwarded to a gateway, such as your Internet router.
So far, so good? Great.

VPNs extend this idea by defining additional subnets ... and the gateways which serve them ... entirely in software. The role of "router" (or "switch") is assumed by the VPN software, which transparently communicates to its peer using the system's (physical ...) network interfaces. Software clients cannot detect that these resources aren't "physically real."

Just like physically-attached subnets, these VPN-subnets either are (virtually ...) bridged, or they are connected by (virtual ...) routers. (VPNs provide software equivalents for both models.) If the subnets are routed, appropriate routing rules must be provided as-needed to route packets to the appropriate gateways correctly, exactly(!) as would be the case if the gateways were "real." VPN software generally provides for routing rules to be "set up" when a connection is made, then "torn down" when it is severed.)


Thanks for the detailed information.
I familiar with VPN and I will try it.

One of the challenges in my orig question is to redirect the same packet twice with tdiffrent result (one from PC and one back from the VPN).
I think that routing based VPN and IP tables could help me with this situation. I will give it a try.
 
Old 03-22-2017, 09:40 PM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938Reputation: 3938
Quote:
Originally Posted by tolekutma View Post
One of the challenges in my orig question is to redirect the same packet twice with tdiffrent result (one from PC and one back from the VPN).
I think that routing based VPN and IP tables could help me with this situation. I will give it a try.
Fundamental notion: OpenVPN (in tunnel mode) is a router.

And so, there are two levels to OpenVPN routing: let's call them "physical" and "logical." (My terminology.)
  • Physical: The delivery of encrypted TCP/IP packets from one OpenVPN client/server to another. All of them must be able to communicate. These are real, physical resources: they are computers.
  • Logical: Here I am referring to the IP-addresses that refer either to the various OpenVPN participants, or to any subnets that are connected to one another using OpenVPN. These addresses do not correspond to physical resources on the local subnet: instead, the local OpenVPN client/server acts as a gateway through which to reach them. The two cases are:
    1. Every OpenVPN server or client is allocated an IP-address, usually in the range 10.8.0.x, which refers specifically to them. This address-range is implemented by, and is reserved to, "OpenVPN itself."
    2. If any OpenVPN client or server exposes a subnet, the IP-addresses that are used within that subnet.

The physical picture is self-explanatory: real computers, sending encrypted UDP datagrams to one another, having IP-addresses that correspond to actual locations in their (possibly "world-wide") network.

All of the logical address-ranges must be routed, "as a gateway," back to the local OpenVPN client or server for delivery back to the other side. (To put it in TCP/IP terms, this is necessary because the local OpenVPN client or server is the "gateway router" that services those ["remote" ...] addresses.) As is always the case with TCP/IP, this chore must be done by anyone and everyone who might encounter them, or, as the case may be, through "static routes" helpfully provided by their local (hardware ...) router. One way or the other, every packet must be correctly routed.

IPTables rules are applied to addresses, regardless of how they are routed, but they must not conflict with that routing.

Last edited by sundialsvcs; 03-22-2017 at 09:50 PM.
 
  


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
fwd to gmail ahmedd Linux - Newbie 1 12-07-2011 09:42 AM
HTTP Tunneling or VPN Tunneling Teomari Linux - Networking 3 04-09-2007 07:52 PM
Packet FWD on centOS ShadowRSA Linux - Networking 1 07-24-2006 11:00 AM
incoming tunneling or tunneling via a 3rd party? JustinHoMi Linux - Networking 1 04-15-2005 01:57 PM
Which Distro for a fwd mail server bkeating Linux - General 2 05-03-2002 02:20 PM

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

All times are GMT -5. The time now is 03:14 PM.

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