If I have an IP address x.x.x.x is there a way to map it at system level to another IP y.y.y.y?. In similar fashion to hostname mapping using /etc/host.

Both x.x.x.x and y.y.y.y refer to the same machine, but a software outside my control is sending the x.x.x.x IP instead of the y.y.y.y and passing it to another software outside my control. The x.x.x.x IP is not accessible from the server that I am using.

  • 1
    The title says "connections from ip" but after reading the body I think it's about "connections to". Please edit and clarify. Commented Oct 30, 2022 at 16:12

1 Answer 1


iptables is capable of rewriting the destination IP address:

iptables -t nat -A OUTPUT -j DNAT -d x.x.x.x --to-destination y.y.y.y

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .