Skip to contentSkip to conversation

catching DNAT'ed packet

LARTC Покотиленко Костик 1 participant 2 messages Dec 15, 2006 – Dec 19, 2006

lore
Share & tools
lore

Покотиленко Костик

#0 lore raw

Hi.

I have a Server's network with some servers in it, all with 192.168.1.0/25 ips. There is also a router in that network with ip 192.168.1.1. This router also connected to a client's network 10.10.0.0/16 with ip 10.10.100.1.

All services on each server are given their virtual address from one of two virtual networks 192.168.1.128/28 and 192.168.1.144/28. 192.168.1.128/28 is for freely available services, and 192.168.1.144/28 is for services available only to authenticated ips.

There is a DNAT working on the router to map virtual ip/port to realip/realport. That all works fine.

For axample:
users connecting to 192.168.1.129:80 are brought to 192.168.1.2:80 users connecting to 192.168.1.145:80 are brought to 192.168.1.2:81

I have to put all traffic I need for accounting to "-j ULOG --ulog-nlgroup 10". And, packets should have ips seen to users. For axample:

10.10.102.50 -> 192.168.1.145:80
192.168.1.145:80 -> 10.10.102.50
and
10.10.102.50 -> 192.168.1.129:80
192.168.1.129:80 -> 10.10.102.50

BUT, instead I have:

10.10.102.50 -> 192.168.1.145:80
192.168.1.2:81 -> 10.10.102.50
and
10.10.102.50 -> 192.168.1.129:80
192.168.1.2:80 -> 10.10.102.50

So, I can ulog the packet's in "state seen by users" only in client->server direction, and I was unable to do that in server-clients direction!

Here are iptables rules (I don't want to ulog packets to/from the router itself):

iptables -t mangle -A PREROUTING -i br0 -j IPCAD_out iptables -t mangle -A POSTROUTING -o br0 -j IPCAD_in

iptables -t mangle -A IPCAD_out -d 10.10.100.1 -j RETURN iptables -t mangle -A IPCAD_out -d 192.168.1.1 -j RETURN iptables -t mangle -A IPCAD_out -j ULOG --ulog-nlgroup 10

iptables -t mangle -A IPCAD_in -s 10.10.100.1 -j RETURN iptables -t mangle -A IPCAD_in -s 192.168.1.1 -j RETURN iptables -t mangle -A IPCAD_in -j ULOG --ulog-nlgroup 10

Is it possible to catch un-DNAT'ed packet???

Signature · 6 lines
Покотиленко Костик <[email protected]>

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
#1 lore raw

Maybe my question was too complex, I would try to make it simple...

Is it possible to catch un-DNAT'ed packet with -j ULOG target?

В Птн, 15/12/2006 в 19:44 +0200, Покотиленко Костик пишет:

Quoted 57 lines

Hi.

I have a Server's network with some servers in it, all with 192.168.1.0/25 ips. There is also a router in that network with ip 192.168.1.1. This router also connected to a client's network 10.10.0.0/16 with ip 10.10.100.1.

All services on each server are given their virtual address from one of two virtual networks 192.168.1.128/28 and 192.168.1.144/28. 192.168.1.128/28 is for freely available services, and 192.168.1.144/28 is for services available only to authenticated ips.

There is a DNAT working on the router to map virtual ip/port to realip/realport. That all works fine.

For axample:
users connecting to 192.168.1.129:80 are brought to 192.168.1.2:80 users connecting to 192.168.1.145:80 are brought to 192.168.1.2:81

I have to put all traffic I need for accounting to "-j ULOG --ulog-nlgroup 10". And, packets should have ips seen to users. For axample:

10.10.102.50 -> 192.168.1.145:80
192.168.1.145:80 -> 10.10.102.50
and
10.10.102.50 -> 192.168.1.129:80
192.168.1.129:80 -> 10.10.102.50

BUT, instead I have:

10.10.102.50 -> 192.168.1.145:80
192.168.1.2:81 -> 10.10.102.50
and
10.10.102.50 -> 192.168.1.129:80
192.168.1.2:80 -> 10.10.102.50

So, I can ulog the packet's in "state seen by users" only in client->server direction, and I was unable to do that in server-clients direction!

Here are iptables rules (I don't want to ulog packets to/from the router itself):

iptables -t mangle -A PREROUTING -i br0 -j IPCAD_out iptables -t mangle -A POSTROUTING -o br0 -j IPCAD_in

iptables -t mangle -A IPCAD_out -d 10.10.100.1 -j RETURN iptables -t mangle -A IPCAD_out -d 192.168.1.1 -j RETURN iptables -t mangle -A IPCAD_out -j ULOG --ulog-nlgroup 10

iptables -t mangle -A IPCAD_in -s 10.10.100.1 -j RETURN iptables -t mangle -A IPCAD_in -s 192.168.1.1 -j RETURN iptables -t mangle -A IPCAD_in -j ULOG --ulog-nlgroup 10

Is it possible to catch un-DNAT'ed packet???

Signature · 6 lines
Покотиленко Костик <[email protected]>

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc