Skip to contentSkip to conversation

track tunnel connections

LARTC [email protected] 2 participants 4 messages Dec 5, 2003 – Dec 6, 2003

lore
Share & tools
lore
#0 lore raw

hello,

I have this:

publicIP(server)-netA--internet(netC)--netB--172.26.3.0/24

I have tunnel between netA and netB. The tunnel is for manage some network devices what are using private IP from network 172.26.3.0/24.
Now if I ping from publicIP (it could be server
with nagios). Echo request
packet is routed through tunnel and reaches 172.26.3.1(device) but echo reply is routed via default route on netB gateway and NATed out to internet.

Question: Could I somehow discover that echo request traveled by tunnel so reply should take same way?

Petr Chloupek
[email protected]
All work and no play makes Jack a dull boy.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d s:--- a- C++(+++)$ UL+++$>++++$ P++$ L+++$>++++$ E-@ W++@$ N+ o? K w++> O- M-@ V? PS+ PE+@? Y+() PGP+@ t(+) 5? !X@ R(++)>-@ tv-- b++@ DI+ D+ G+ e+ h---- r+++ y++++
------END GEEK CODE BLOCK------

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw
Quoted 13 lines · [email protected] wrote:

I have this:

publicIP(server)-netA--internet(netC)--netB--172.26.3.0/24

I have tunnel between netA and netB. The tunnel is for manage some network devices what are using private IP from network 172.26.3.0/24.
Now if I ping from publicIP (it could be server
with nagios). Echo request
packet is routed through tunnel and reaches 172.26.3.1(device) but echo reply is routed via default route on netB gateway and NATed out to internet.

Quoted 4 lines

Question: Could I somehow discover that echo request traveled by tunnel so reply should take same way?

What tunneling technology are you using (IPIP, GRE, VPN (ESP/AH/PPTP/...) ) ?

Normally you'd configure the tunnel endpoint routers at both sites to have recipriocal routing entries for each others subnet. Also configure on the endpoint hosts a black hole routing entry with a higher metric than the tunnel, so that "Network Unreachables" are correctly returned in the event the tunnel is not configured / down. This is also one measure you can use to stop tunneled data from accidentally escaping onto the Internet.

But your subnets need to be correctly configured around the endpoint router so no discovery of the route is necessary by the hosts on the subnet.

So I ask: Does your network topology really need to be able to discover
tunnel(s) ? Routing protocols exist for this very application, but
they generally are to allow two routers to discover each others routes, not for hosts to discover routes. Its not clear if the issue of route discovery is really your problem or just the subnets aren't configured correctly ?

Darryl

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#2 lore raw
In reply to [email protected]
Quoted 15 lines · Darryl Miles
Quoted 13 lines · [email protected] wrote:

I have this:

publicIP(server)-netA--internet(netC)--netB--172.26.3.0/24

I have tunnel between netA and netB. The tunnel is for manage some network devices what are using private IP from network 172.26.3.0/24.
Now if I ping from publicIP (it could be server
with nagios). Echo request
packet is routed through tunnel and reaches 172.26.3.1(device) but echo reply is routed via default route on netB gateway and NATed out to internet.

Quoted 7 lines
Quoted 4 lines

Question: Could I somehow discover that echo request traveled by tunnel so reply should take same way?

What tunneling technology are you using (IPIP, GRE, VPN (ESP/AH/PPTP/...) ) ?

It's GRE.

Quoted 3 lines

Normally you'd configure the tunnel endpoint routers at both sites to

have recipriocal routing entries for each others subnet. Also configure

Yes, I've this done for nonpublic networks (more exactly for 172.26.0.0/16 which one we are using for network management). But netA is small ISP with about 1000 subscribers and we are not AS right now.
You're probably right, that I could simply add one route for each
our assigned C network, but than I have to reconfigure each tunnel
after each change.
I could simply use OSPF and set it on netB gw (we are using OSPF
on netA), but than all traffic to netA will go throught tunnel,
what is not exactly what I need.
One more difficulty is, that in netB are couple of clients on
172.26.3.0/24 (clients has addresses from .2 up and devices goes
from 254 down).

As I'm writing now, I'm starting to understand your advice like this:
"You screwed up you address plan. If you are doing things right way, you could not have this problem at all."

So one way is to simply move devices on netB to their own network 172.26.x.0/24 and all traffic from this network route to tunnel.

Is there any other way, how to "autoconfigure" routing through tunnel?

Quoted 2 lines

on the endpoint hosts a black hole routing entry with a higher metric than the tunnel, so that "Network Unreachables" are correctly returned

Ok. thanks. I forgot to do this.

Quoted 1 line

So I ask: Does your network topology really need to be able to discover

I'm not sure. Probably I can at least redesign netB and reconfigure devices there. netB is 80km from here and maybe I'm only afraid that I will have to leave my neat office and drive there.

Quoted 4 lines

Darryl

Petr Chloupek
[email protected]

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#3 lore raw
In reply to [email protected]
Quoted 27 lines · [email protected] wrote:
Quoted 23 lines · Darryl Miles
Quoted 13 lines · [email protected] wrote:

I have this:

publicIP(server)-netA--internet(netC)--netB--172.26.3.0/24

I have tunnel between netA and netB. The tunnel is for manage some network devices what are using private IP from network 172.26.3.0/24.
Now if I ping from publicIP (it could be server
with nagios). Echo request
packet is routed through tunnel and reaches 172.26.3.1(device) but echo reply is routed via default route on netB gateway and NATed out to internet.

Quoted 4 lines

Question: Could I somehow discover that echo request traveled by tunnel so reply should take same way?

Normally you'd configure the tunnel endpoint routers at both sites to

Quoted 9 lines
Quoted 3 lines

have recipriocal routing entries for each others subnet. Also configure

Yes, I've this done for nonpublic networks (more exactly for 172.26.0.0/16 which one we are using for network management). But netA is small ISP with about 1000 subscribers and we are not AS right now.
You're probably right, that I could simply add one route for each
our assigned C network, but than I have to reconfigure each tunnel
after each change.

I understand better what you are asking. I take it there is no NAT involved at all, these networks are ISP sites with fully routed Internet address space, then maybe you are looking for a policy route so that any traffic coming from the 172.26.3.0/24 subnet it routed down the tunnel. Since this address space is only used internally on the ISPs corporate network and should never escape into NetC.

I'd also advise / confirm you have an egress firewall entry facing NetC to drop any packets not confirming to NetB's public address space, this would also be your last barrier to stopping corporate management information leaking onto the Internet.

On the NetB router:

ip route add table 4 default dev tunl0
ip rule add from 172.26.3.0/24 table 4
ip route flush cache

Amend accordingly.

Quoted 4 lines

I could simply use OSPF and set it on netB gw (we are using OSPF on netA), but than all traffic to netA will go throught tunnel, what is not exactly what I need.

One solution maybe to use OSPF through the tunnel. Providing you can control the routes each end advertises and accepts, you only want to announce those routes down the tunnel that you want to be used down the tunnel and you only want the PrivateIP hosts of NetB to be affected by those routes, this last point sounds like a headache with OSPF.

Quoted 5 lines

One more difficulty is, that in netB are couple of clients on 172.26.3.0/24 (clients has addresses from .2 up and devices goes from 254 down).

You have to creativly work out a set of prefixes that cover all the IPs you want (172.26.3.240/28), Does anyone know of a tool to do this job ?

Just out of interest what do these clients do on these IPs since they can't use them on the Internet (NetC) anyway, what need do they have to have them routable past your tunnel box / default gateway to NetC ? An egress Firewall on the tunnel interface might elect to return these with ICMP.

Quoted 4 lines

As I'm writing now, I'm starting to understand your advice like this:
"You screwed up you address plan. If you are doing things right way, you could not have this problem at all."

This was only with regards to mixing your PrivateIP addr space of corporate network with your customers networks.

Quoted 6 lines

So one way is to simply move devices on netB to their own network 172.26.x.0/24 and all traffic from this network route to tunnel.

Is there any other way, how to "autoconfigure" routing through tunnel?

Ah this is what I just put above with the config. You can put in multiple policy routing rules in, however depending on how much throughput this router sees it maybe advisable to re-work your Private address space as you suggest so a single check is needed per routing decision, maybe this point is moot with the routing cache anyway.

IP Datagrams can record enroute information like this, think of it as Corporate policy routing, lookup DiffServ/TOS/DSMASK (on google), however once a datagram has gotten to its host some of this information may get lost, the only way it to test yourself with the hosts concerned and tcpdump.

This method means re-assigning the Precedence field of the IP header, maybe all networking stacks written honour this field and re-use it in the reply packet. I've never tried this so I can't be too sure, the IP specs may say a stack must do this, but in reality its not a well used feature, so using it between participating routers on a per datagram basis is one thing (ala DiffServ) and getting it echoed through hosts and back to the routers is another.

So maybe you can mark the IP header of the packet when it leaves the tunnel endpoint so that the host (hopefully) also keeps this marking in the reply packet coming back the other way. Providing your routing on the LAN is setup so that the tunnel endpoint gets to see all the traffic to vet it for this marking or not, before selecting it for the Public Internet (NetC) or to enter the tunnel. When it enters the tunnel you may need to strip this marking off, since its a locally applied policy that only the site of NetB knows about, it seems correct to undo it when it leaves this domain.

One solution for this would look like using ipchains rule to select and mark the packet when it arrive, then setup a policy route to use this marking to select it for routing via the tunnel. Maybe the policy routing rules allow isolation and selection of the precedence field of the packet.

Darryl

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/