Operating System - Linux
1826460 Members
3153 Online
109692 Solutions
New Discussion

Re: Port Address Translation -- plz help

 
SOLVED
Go to solution
Maaz
Valued Contributor

Port Address Translation -- plz help

Hello Dear Gurus

I have configured the server(Gateway server) to do NAT.
Gateway server has two interfaces
external interface: a.b.c.d(public ip)
internal interface: 192.168.1.255

I did the following on Gateway
#echo 1 >/proc/sys/ipv4/ip_forward
and
#iptables -t nat -A POSTROUTING -o ppp0 -j SNAT --to a.b.c.d

Its working Perfect.
Now I want to know whats Port Address Translation is ? any example plz

Regards
Maaz
3 REPLIES 3
Ivan Ferreira
Honored Contributor
Solution

Re: Port Address Translation -- plz help

Port Address translation is when you redirect one port to another port or host:port, for example:

iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j DNAT --to-destination 192.168.0.14:8080
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Delrish
Trusted Contributor

Re: Port Address Translation -- plz help

First of all, pleae check you internal interface ip address. 192.168.1.255 is broadcast address and you cannot use it for your interface.
Second, you can use port translation, for nating just one port from external to internet or from internet to external network. for example if you use iptables -t nat -A POSTROUTING -p tcp --dport 80 -o ppp0 -j SNAT --to a.b.c.d
your box just nat the traffics that are destinated to port 80 (web).
Maaz
Valued Contributor

Re: Port Address Translation -- plz help

Dear Ivan Ferreira, I m highly Thankfull to you for ur kind and prompt response
And Dear Alireza Many thanks to u also for the help.... and esp thanks for pointing the mistake. yes i know 192.168.1.255 is not a valid ip for host... and i have assigned 192.168.1.254, but mistakenly i have wrote 255 instead of 254

Thanks Forum
Maaz