Skip to contentSkip to conversation

Static NAT Mappings

DISCUSSION John Black 2 participants 2 messages Oct 6, 2004

lore
Share & tools
lore

John Black

author
#0 lore raw

I'm trying to setup static NAT mappings.

this is what i did, but it doesn't work:
public address 1.2.3.4/24
ifconfig eth0:0 1.2.3.4 netmask 255.255.255.0

then in my firwall script:
iptables -t nat -A POSTROUTING -s 192.168.0.4 \
-o eth0 -j SNAT --to 1.2.3.4

i tried this also:
iptables -t nat -A POSTROUTING -s 192.168.0.4/24
-o eth0 -j SNAT --to 1.2.3.4

i have read the howto on the netfilter web site.
but i'm still lost.

thanks
john

#1 lore raw
Quoted 5 lines · John Black

I'm trying to setup static NAT mappings.

this is what i did, but it doesn't work:
public address 1.2.3.4/24
ifconfig eth0:0 1.2.3.4 netmask 255.255.255.0

ip address add 1.2.3.4 dev eth0

Quoted 3 lines

then in my firwall script:
iptables -t nat -A POSTROUTING -s 192.168.0.4 \
-o eth0 -j SNAT --to 1.2.3.4

OK--looks good.

Quoted 3 lines

i tried this also:
iptables -t nat -A POSTROUTING -s 192.168.0.4/24
-o eth0 -j SNAT --to 1.2.3.4

that's nonsense. .4 is not the network address, .0 is.

Quoted 2 lines

i have read the howto on the netfilter web site.
but i'm still lost.

do you have filter rules in place that could be blocking the traffic?

have you enabled IP forwarding (sysctl -w net.ipv4.ip_forward=1)?

-j

Signature · 1 line
Jason Opperisano <[email protected]>