Subject: Re: setkey and 0.0.0.0/0
To: Martti Kuparinen <email@example.com>
From: Jochen Kunz <firstname.lastname@example.org>
Date: 12/22/2004 00:36:03
On Tue, 21 Dec 2004 20:28:30 +0200 (EET)
Martti Kuparinen <email@example.com> wrote:
> I'm debating with someone about setkey's spdadd syntax. Here's an
> spdadd 10.0.0.0/24 0.0.0.0/0 any -P out ipsec
> Which one is true:
> 1) 0.0.0.0/0 is "any of my local addresses"
> 2) 0.0.0.0/0 is "any address, local or foreign"
> I'd say #2 so I read the above rule as "outgoing traffic from anyone
> in the 10.0.0.0/24 network to any destination must be tunneled and
> outer header's src=3D10.0.0.10 and dst=3D10.0.0.1".
> I also read it that 10.0.0.10 is my address and 10.0.0.1 is the
> security gateway's address.
> Am I right or wrong?
You are right. The above may not work as the tunnel endpoints are in the
same subnet as the source address range. This may confuse the IPsec
code. (Or the user of it. ;-) ) But I am no IPsec expert.
I use this:
spdadd 192.168.1.0/24 192.168.1.0/24 any -P in none;
spdadd 192.168.1.0/24 192.168.1.0/24 any -P out none;=20
spdadd 192.168.100.0/24 192.168.100.0/24 any -P out ipsec
spdadd 192.168.100.0/24 192.168.100.0/24 any -P in ipsec
spdadd 0.0.0.0/0 192.168.1.0/24 any -P in ipsec
spdadd 192.168.1.0/24 0.0.0.0/0 any -P out ipsec
192.168.1.0/24 is the LAN with all my machines. It is connected to a
router 192.168.1.254 with a second interface 192.168.100.253.
192.168.100.0/24 is a special subnet only for transporting non-local
trafic to the DSL router (192.168.100.254) by WLAN.
Note that you need the first two rules. 0.0.0.0/0 means everything,
including 192.168.1.0/24. Obviously. So if you omit the first two rules
the machine wants to tunnel every packet, even those from the local
Ethernet that don't have to be tunneld. Yes I have learned this the hard