Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to forward internal packets to outside without success.

iptables -t nat -A PREROUTING -i eth0 -p icmp -d "internal IP" -j DNAT --to-destination "external IP"
iptables -t nat -A PREROUTING -i eth0 -p icmp -d 192.168.1.1 -j DNAT --to-destination 192.168.1.100

ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.1 icmp_seq=1 Destination Host Unreachable

Can I forward virtual IP address which doesn't exist?

iptables -t nat -A PREROUTING -i eth0 -p icmp -d 192.168.1.? -j DNAT --to-destination 192.168.1.100

Thanks.

share|improve this question
    
Where are you running the ping command from? The same computer where you have the iptables running? If that is the case, then those packets won't go through PREROUTING chain. Locally generated packets use the OUTPUT chain in the nat table. –  Tero Kilkanen May 4 at 0:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.