remapping ip addresses: how?

Discussion in 'Linux Networking' started by Alessandro Russo, Sep 6, 2006.

  1. Hi,

    sorry if the question is silly for thus ng, but I have already
    tried to answer for the whole day without results.

    I need a way to remap an IP address to another, in such a way that
    all the traffic directed to, say,, will go to

    In particular, is an external ip while is my
    local ip.

    In other words, I need a way to specify that the traffic directed
    to a certain external ip will instead be routed to my local ip.

    I have Fedora Core 5.

    Thanks in advance for any help.

    Alessandro Russo, Sep 6, 2006
    1. Advertisements

  2. Yes, that's commonly called 'NAT' or Network Address Translations,
    see the IPTable documentation for DNAT (Destination NAT)

    Davide Bianchi, Sep 6, 2006
    1. Advertisements

  3. I have tried, but I don't understand what I have to do.
    I tried what I found at

    but no way.

    Any hints? Thanks again.

    Alessandro Russo, Sep 6, 2006

  4. The "Linux Home Server HOWTO" looks exactly like what you want
    and was updated to suit FC 5:

    As already mentioned "Destination NAT" is what you want, not that
    I have ever used this document but it seems from a short look
    well written.

    I'd urge you to check the chapter about yum, you can ease up
    installing/updating software pretty much if using 'yum'!

    Good luck

    Michael Heiming, Sep 6, 2006
  5. I tried

    iptables -t nat -A PREROUTING -d -j DNAT --to-destination

    with no effects.

    As far I understood, this should redirect to everything that
    was originally directed to Or I'm wrong?

    Alessandro Russo, Sep 6, 2006
  6. There is more then a single command needed and I can't look into
    your box. Did you worked through the documentation I pointed out
    to you?

    You can see your nat setup with '/sbin/iptables -t nat -nvL',
    again all this is in the howto, you just need to work trough it.

    Good luck
    Michael Heiming, Sep 6, 2006
  7. sbin/iptables -t nat -nvL says:

    Chain PREROUTING (policy ACCEPT 1607 packets, 84568 bytes)
    pkts bytes target prot opt in out source destination
    0 0 DNAT all -- * *


    where "to:" is on the right of

    It seems ok to me, but it should be wrong.

    Alessandro Russo, Sep 6, 2006
  8. It seems wrong to me. Please start reading and using the "Linux
    Home Server HOWTO" now!
    Michael Heiming, Sep 7, 2006
  9. Hello,

    Alessandro Russo a écrit :
    Try :

    iptables -t nat -A OUTPUT -d -j DNAT --to

    The OUTPUT chain sees locally generated packets whereas PREROUTING sees
    incoming packets.
    Pascal Hambourg, Sep 7, 2006
  10. Thanks a lot, it worked.

    Alessandro Russo, Sep 7, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.