Skip to contentSkip to conversation

How to use DNAT

DISCUSSION Italo Valcy 3 participants 5 messages Feb 17, 2011

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Guys!

I'm in doubt about the correct use of DNAT, if I should use an alias interface (like eth0:0) with the original target IP address or I should use something to advertise the arp-reply for that IP (like farpd).

I'm asking this because when I tried to use the alias interface I've got *some* packages being processed by INPUT chain of the filter table...

Do you guys have any ideia?

Thank you so much for any help!

- --
Saudações,

Italo Valcy :: http://wiki.dcc.ufba.br/~ItaloValcy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1dbSwACgkQfidLqjN6RNHb6wCeKUDzLjJiGKNVfM1H3W7EQxjA V9wAnjaRmU/OLFQnGJ86N5vepct2TINz
=fokt
-----END PGP SIGNATURE-----

#1 lore raw
Quoted 7 lines · Italo Valcy

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Guys!

I'm in doubt about the correct use of DNAT, if I should use an alias interface (like eth0:0)

eth0:0 is not an interface. That is ifconfig misleading you. Avoid this old and unmaintained tool.

#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Jan,

Em 17-02-2011 16:03, Jan Engelhardt escreveu:

Quoted 2 lines

eth0:0 is not an interface. That is ifconfig misleading you. Avoid this old and unmaintained tool.

Thank you so much for your quickly reply and tip. I change the configuration according to your tip and I use "ip addr add" to add a secondary ip address (the target IP for DNAT), but unfortunately that does not help: the packets are still going to INPUT chain, even with the DNAT rule changing the DESTINATION of the packet.

Kind Regards, Italo.

- --
Saudações,

Italo Valcy :: http://wiki.dcc.ufba.br/~ItaloValcy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1ddFoACgkQfidLqjN6RNGBWgCfbva8mT/PyPkmzGg+OM1+lOad UKkAniJ5wzWi2vq9qPsJAKuwpAStiTZx
=knvD
-----END PGP SIGNATURE-----

#3 lore raw
In reply to Italo Valcy

Hello,

Quoted 3 lines · Italo Valcy

I'm in doubt about the correct use of DNAT, if I should use an alias interface (like eth0:0) with the original target IP address

Target ? Do you mean the original destination address ?

Quoted 2 lines

or I should
use something to advertise the arp-reply for that IP (like farpd).

As long as incoming packets reach the interface, it does not matter how.

Quoted 2 lines

I'm asking this because when I tried to use the alias interface I've got *some* packages being processed by INPUT chain of the filter table...

Please provide some details about the rule, packets... Note that iptables' NAT ignores packets in the INVALID state.

#4 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Pascal,

Em 17-02-2011 17:05, Pascal Hambourg escreveu:

Quoted 2 lines

Target ? Do you mean the original destination address ?

Yes, that's it! ;)

Quoted 1 line

As long as incoming packets reach the interface, it does not matter how.

Yes, it just have to know how to reach the interface. Beacause of this either I have to use the original destination address as a secondary address of my firewall (machine running iptables) or start answer the arp request for that IP. Right now, I'm using the secondary IP address approach.

Quoted 3 lines

Please provide some details about the rule, packets... Note that iptables' NAT ignores packets in the INVALID state.

Well... so could be this: INVALID state... The packets are about a netflow traffic (9996/UDP) comming to the firewall, which should be redirected to a internal host (through the DNAT). How can I debug these possible INVALID packets?

Thanks!

- --
Saudações,

Italo Valcy :: http://wiki.dcc.ufba.br/~ItaloValcy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1dk4oACgkQfidLqjN6RNG2tACglYQeFkqjl2HMXpzzLh0tJ3bY aWwAoJj6t8t3v8q9vU14kO3m7dof0O5s
=ORCq
-----END PGP SIGNATURE-----