LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Inquiry:How to enable "NAT" on my Linux server? (https://www.linuxquestions.org/questions/linux-newbie-8/inquiry-how-to-enable-nat-on-my-linux-server-770923/)

hadimotamedi 11-23-2009 02:53 AM

Inquiry:How to enable "NAT" on my Linux server?
 
Dear All
On my Red Hat 7.2 , I installed the Asterisk 1.4.13 and DECT application software and then when I want to try for "NAT" I issue as the followings :
#iptables -t nat -A POSTROUTING -s 10.20.30.0/24 -o eth0 -j MASQUERADE
But it didn't get through . So I checked if the "NAT" is enabled on my Red Hat 7.2 server , as the followings :
#echo "1" > /proc/sys/net/ipv4/ip_forward
But still I cannot try for "NAT" . Can you please let me know which other setings maybe influenced and need to be checked for enabling the "NAT" ?
Thank you in advance

TB0ne 11-23-2009 09:05 AM

Quote:

Originally Posted by hadimotamedi (Post 3766435)
Dear All
On my Red Hat 7.2 , I installed the Asterisk 1.4.13 and DECT application software and then when I want to try for "NAT" I issue as the followings :
#iptables -t nat -A POSTROUTING -s 10.20.30.0/24 -o eth0 -j MASQUERADE
But it didn't get through . So I checked if the "NAT" is enabled on my Red Hat 7.2 server , as the followings :
#echo "1" > /proc/sys/net/ipv4/ip_forward
But still I cannot try for "NAT" . Can you please let me know which other setings maybe influenced and need to be checked for enabling the "NAT" ?
Thank you in advance

As others have pointed out to you in your past posts, RedHat 7.2 is very, VERY old. There are going to be many things you want to do, but won't be able to do.

That said, there are some IPtables commands that might help:

To show the NAT rules in effect
iptables -nvL -t nat

To Enable SNAT functionality on eth0 (example)
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -o eth0 -j SNAT --to-source x.y.z.c

SNAT (Source NAT) is used to map private source IP numbers of
interfaces on the internal LAN to one of my public static IP numbers.
SNAT performs this mapping when a client running on one of the
internal hosts (x.y.z.c) initiates a TCP connection (SYN) through eth0.

There's lots more on Google for this. And when you post a problem, some actual details would help, instead of saying "it didn't get through". We have no idea what you mean, what it did, or what results you're getting.

chrism01 11-23-2009 05:11 PM

This might be useful http://www.redhat.com/docs/manuals/l...-iptables.html.
However, as pointed out, 7.2 hasn't been updated in years which means terrible security and you won't be able to run modern sw as the compilers & kernels have changed so much. similar issue with modern hw.
I do hope this system is not visible from the internet.

landysaccount 11-23-2009 05:51 PM

NAT can also be enabled this way:

$iptables -t nat -A POSTROUTING -o $EXT_IFACE -j MASQUERADE


Now, you need to allow ports 5060-5065 and ports in /etc/asterisk/rtp.conf opened both ways (in and out) in order for asterisk to work. Also make sure you have nat=yes in sip.conf.....


All times are GMT -5. The time now is 11:32 PM.