iptables SNAT & DNAT won't accept name

Discussion in 'Linux Networking' started by Ming-Ching Tiew, Oct 8, 2004.

  1. I would like to use ***NAME*** instead of IP address
    in the "--to NAME:port" part of iptable command, but
    it fails, example :-

    iptables -t nat -A PREROUTING ..... -j SNAT NAME:port

    does not work. However,

    iptables -t nat -A PREROUTING ..... -j SNAT IP:port

    works. So now, is it expected behaviour and how do I work
    around it ?
     
    Ming-Ching Tiew, Oct 8, 2004
    #1
    1. Advertisements

  2. Ming-Ching Tiew

    lfree Guest

    I would like to use ***NAME*** instead of IP address
    check DNS¡£
     
    lfree, Oct 8, 2004
    #2
    1. Advertisements

  3. I won't post here if it is due to DNS.

    You got to try it yourself,

    iptables -t nat -A PREROUTING ... -j SNAT --to NAME:port

    is wrong syntax,

    iptables -t nat -A PREROUTING ... -j SNAT --to IP:port

    is correct syntax,

    iptables -t nat -A PREROUTING -s NAME1 -d NAME2 ....

    is also correct syntax.
     
    Ming-Ching Tiew, Oct 8, 2004
    #3
    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.