LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 12-25-2004, 09:49 PM   #1
varun_saa
Member
 
Registered: Dec 2004
Posts: 188

Rep: Reputation: 30
NAT not working


Hello,
My server is on Mandrake 10.1 off.
eth0 is WAN with static IP connected 512 DSL
eth1 is LAN.

I went to webmin->networking ->linus firewall
and did a NAT on eth0. I applied and rebooted.

On clients system I am not getting the internet.
But I am able to ping my server's static IP from
clients.

How to troubleshoot ?

My iptables file is as follows :

Generated by iptables-save v1.2.9 on Sun Dec 26 08:51:30 2004
*nat
:OUTPUT ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Sun Dec 26 08:51:30 2004
# Generated by iptables-save v1.2.9 on Sun Dec 26 08:51:30 2004
*mangle
:PREROUTING ACCEPT [387458:22182653]
:INPUT ACCEPT [387217:22168730]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [386761:22141899]
:POSTROUTING ACCEPT [386489:22126327]
COMMIT
# Completed on Sun Dec 26 08:51:30 2004
# Generated by iptables-save v1.2.9 on Sun Dec 26 08:51:30 2004
*filter
:INPUT ACCEPT [415163:23768840]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [414645:23738052]
COMMIT
# Completed on Sun Dec 26 08:51:30 2004

Thanks

Varun
 
Old 12-26-2004, 12:48 AM   #2
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
cat /proc/sys/net/ipv4/ip_forward
1

If that shows a zero then you need to change it..

echo 1 > /proc/sys/net/ipv4/ip_forward

And put that in your startup scripts somewhere.

You need to set the dns servers on the clients and also be sure that they can access them.

You could try an ip address on the internet to see if it works.
 
Old 12-27-2004, 09:41 PM   #3
varun_saa
Member
 
Registered: Dec 2004
Posts: 188

Original Poster
Rep: Reputation: 30
Thanks David it worked
 
Old 12-28-2004, 02:32 PM   #4
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
Awesome

 
Old 12-28-2004, 09:03 PM   #5
varun_saa
Member
 
Registered: Dec 2004
Posts: 188

Original Poster
Rep: Reputation: 30
Hello David,
Can you tell me howto do the same using
shorewall.

Thanks

Varun
 
Old 12-28-2004, 11:22 PM   #6
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
hi there

for shorewall just add the followind line to the masq file
ppp0 192.168.0.0/24

where ppp0 is my external device i.e modem and and i am masquarading my netwrk 192.168.0.0

regards
 
Old 12-29-2004, 03:26 AM   #7
varun_saa
Member
 
Registered: Dec 2004
Posts: 188

Original Poster
Rep: Reputation: 30
Hello David,
I have :

eth0 is WAN with static IP connected 512 DSL
eth1 is LAN - 192.168.0.0 / 255

Any changes or I should do what you posted

Thanks

Varun
 
Old 12-29-2004, 03:35 AM   #8
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
u shoud make an entry like this

eth0 192.168.0.0/24

regards
 
Old 12-29-2004, 03:44 AM   #9
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
u shoud make an entry like this

eth0 192.168.0.0/24

regards
 
Old 12-29-2004, 07:05 AM   #10
varun_saa
Member
 
Registered: Dec 2004
Posts: 188

Original Poster
Rep: Reputation: 30
Can you explain me :

eth0 192.168.0.0/24

Thanks

Varun
 
Old 12-29-2004, 08:49 AM   #11
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
if u have look at the masq file

then
#INTERFACE SUBNET ADDRESS PROTO PORT(S)
eth0 192.168.0.0/24

this specifies that th interface "eth0" is maquerading the subnet 192.168.0.0/24


regards
 
Old 12-29-2004, 11:19 AM   #12
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
My post above is only to insure that the machine is forwarding traffic. The proceedure for testing this and also for fixing the problem is the same.

enter this command..

cat /proc/sys/net/ipv4/ip_forward


If you do not see a "1" as in if you see a "0" then you will not have any ip traffic forwarded.

If this is true then you enter this command..


echo 1 > /proc/sys/net/ipv4/ip_forward

If your configuration and startup scripts are not setting this automatically at boot then you would need to add the command to one of your startup scripts.


Most of the mainstream distros have network and firewall configuration tools that have this option and would setup the option to be enabled for you.

You can put the command in your /etc/rc.local file if you have one and it will be executed on every boot. Your other option could be to search for your distros built in method for setting the option if there is one. The end result would be the same either way.


If the value is set to 1 then the kernel will forward ip packets. Other firewall related configuration will also determine if it will do what you expect.

Normally pinging a known ip address would be my first test if I have a problem. Then I would move on to DNS if that works.

If you are not using your distros iptables scripts and shorewall or whatever else your using does not set the ip forwarding option then I would go with /etc/rc.local.

Last edited by DavidPhillips; 12-29-2004 at 11:25 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
dnsmasq problem, nat not working tank728 Slackware 9 05-26-2006 04:15 PM
Working with NAT, need help with source code and technical specs Sparticus Linux - Networking 1 07-10-2004 02:50 AM
Working with NAT, need help with source code and technical specs Sparticus Linux - Networking 1 07-10-2004 01:55 AM
nat not working! the_y_man Linux - Networking 4 03-13-2004 12:41 AM
What's the difference between Linux-NAT and Sygate-NAT? yuzuohong Linux - Networking 0 08-07-2002 04:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva

All times are GMT -5. The time now is 10:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration