LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 03-21-2004, 03:26 AM   #1
ckenshol
LQ Newbie
 
Registered: Oct 2003
Location: Portland, OR
Posts: 17

Rep: Reputation: 0
iptables - Sudden loss of connectivity


Having computer problems. Anyone have an idea what is wrong? My landlords did some work thing where they had to cut off power. When the power came back on something was screwed up, my main system no longer has a connection. It was working just fine, I had rebooted the computer a few times earlier with no problem, but I hadn't rebooted the server.

I use iptables to route the traffic through the server (which I am typing this on now) to my main system using:

ifconfig eth1 192.168.0.1 broadcast 192.168.0.255 netmask 255.255.255.0
iptables -P FORWARD ACCEPT
iptables -A POSTROUTING -t nat -s 192.168.0.1/24 -j MASQUERADE

The server has an internet connection fine. ifconfig shows the above command fine. I have my main system set to 192.168.0.2 with the gateway of 192.168.0.1. From the server I can ping .0.2 just fine (when the main system is on), but the main computer can not ping .0.1.

I added some prerouting to forward the port so I could stream my webcam, and I thought that might be the problem:

iptables -A FORWARD -p tcp --dport 8080 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp --dport 8080 -j DNAT --to-destination 192.168.0.2

I have the connection coming straight from my cable modem to eth0 then from eth1 to the main computer. The only changes that I made recently was to ass the rule to forward the port as listed above, but it was working just fine, and even forwarding the port fine, until the server was rebooted.

so I left that off when I rebooted the server and still nothing. I'm just about to say screw it and reinstall the server, but then I would lose my webpage and all of that, which would be a hassle.

Anyone think of anything I am doing wrong?
 
Old 03-21-2004, 03:40 AM   #2
phek
Member
 
Registered: Jul 2001
Location: California, US
Distribution: Slackware
Posts: 196

Rep: Reputation: 30
its an obvious question, but just in case... did you load the iptables rules? also on your main system are you sure its set up to use 192.168.0.1 as your gateway? maybe theres no route on your gateway to find your lan?
 
Old 03-21-2004, 03:45 AM   #3
ckenshol
LQ Newbie
 
Registered: Oct 2003
Location: Portland, OR
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by phek
its an obvious question, but just in case... did you load the iptables rules? also on your main system are you sure its set up to use 192.168.0.1 as your gateway? maybe theres no route on your gateway to find your lan?
yeah, I actually never have to reboot my server, so I never got around to making it load the iptables info automatically since it takes like 30 seconds to type that in. So I do the ifconfig and the iptables commands whenever I boot up the server, so I'm pretty sure it's loading.

Also when I do an iptables -L -t nat it lists the pre and postrouting there.

And I'm pretty sure the gateway information was fine since it has always worked before. I'm at a loss because one minute it was working fine, then the server got rebooted and now all of a sudden nothing.
 
Old 03-21-2004, 03:54 AM   #4
phek
Member
 
Registered: Jul 2001
Location: California, US
Distribution: Slackware
Posts: 196

Rep: Reputation: 30
well another thing to check is to make sure /proc/sys/net/ipv4/ip_forward is 1, other than that maybe you could post your routing table ( /sbin/route -n ) and your firewall script.
 
Old 03-21-2004, 04:33 AM   #5
ckenshol
LQ Newbie
 
Registered: Oct 2003
Location: Portland, OR
Posts: 17

Original Poster
Rep: Reputation: 0
it was the ip_forward. For some reason it decided to get pissy with me and set itself to 0. It never had done that before and I had forgotten about that little setting. What would cause it to randomly go from 1 to 0?

Thanks for reminding me by the way.
 
Old 03-21-2004, 02:41 PM   #6
phek
Member
 
Registered: Jul 2001
Location: California, US
Distribution: Slackware
Posts: 196

Rep: Reputation: 30
/proc doesn't actually exist on your hard disk, it's a virtual filesystem so files in there are not automatically saved on a reboot. There are programs such as sysctl that will save some data from /proc when the machine is shutting down, then reload it when the machine starts back up, but since your machine didnt get to run init 0/6 when the power went off,
the data couldn't be reloaded. It would be a good idea to put
echo "1" > /proc/sys/net/ipv4/ip_forward
into your firewall script.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Slack 10.1, 2.6: Sudden Network Loss?? Kenkudaki Linux - Networking 2 09-06-2005 11:11 AM
Sudden Downloads D00 Linspire/Freespire 1 11-16-2004 11:27 AM
sudden connection loss Jeebizz Slackware 7 10-17-2004 10:09 PM
ping loss w/ iptables ridertech Linux - Networking 2 02-18-2004 08:32 PM
Network Packet Loss and IPTABLES weazy Linux - Networking 7 04-24-2003 03:20 PM


All times are GMT -5. The time now is 02:21 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration