Forwarding von IPSec Verbindungen

Dietmar Goldbeck dietmar.goldbeck at schotterweg.de
Tue Jul 27 23:29:30 CEST 2004


On Tue, Jul 27, 2004 at 10:24:36PM +0200, Markus Wigge wrote:
> 
> nur wie muß ich jetzt die Forward-Regeln setzten, damit nur noch
> IPSec gesicherter Traffic weitergleitet wird?
> Wenn ich einfach nur die Netze akzeptiere gilt das auch für nicht
> gesicherte Leitungen... bei der 2.4er IPSec Implementierung hatte
> man noch ein "ipsec*" Interface dass man als Incomming Interface (-i)
> angeben konnte.
> 

Das fehlende logische Interface hat mich auch schon genervt.
Es geht mit netfilter mark.

Siehe http://www.spenneberg.com/867.html

When using IPsec tunnel mode on a gateway:
INPUT sees the incoming encrypted traffic
FORWARD sees the decrypted traffic
POSTROUTING sees the outgoing encrypted traffic

To reach your internal network you need a rule in the FORWARD chain
allowing the traffic through. Since the traffic is decrypted it is
hard to distinguish between VPN and non-VPN traffic. You can use
netfilter fwmark for this.
[...]
# Allow ESP Traffic from/to Gateway
iptables -A INPUT -i $EXTERNAL_INTERFACE -p esp -j ACCEPT
iptables -A OUTPUT -o $EXTERNAL_INTERFACE -p esp -j ACCEPT

# Tag Incoming IPSec Traffic. 'mark' sticks after processing.
iptables -t mangle -A PREROUTING -i $EXTERNAL_INTERFACE
-p esp -j MARK --set-mark 1

# Forward Authenticated Traffic to LAN.
iptables -A FORWARD -i $EXTERNAL_INTERFACE -m mark --mark 1
-d $LAN_ADDRESSES -j ACCEPT


-- 
 Alles Gute / best wishes  
     Dietmar Goldbeck         E-Mail: dietmar.goldbeck at acm.org
Reporter (to Mahatma Gandhi): Mr Gandhi, what do you think of Western
Civilization?  Gandhi: I think it would be a good idea.



More information about the Linux mailing list