# [SOLVED] Server disappearing from web

## flangemonkey

Hi, 

I need some direction for troubleshooting, my problem is this:

I have a LAMP / mail server attached to a (Netgear) switch, in turn connected (all over ethernet) to a (Belkin) router.

On boot, the computer successfully acquires it's (reserved) IP from the server by DHCP using dhcpcd and the net.eth0 init script automagic settings and the server is seen by everyone on the net accessing by IP or domain name...

After a while (not sure how long, but less than four hours) the server disappears and external traffic only gets a gateway timeout (504) error, whilst internal traffic can continue over NAT with no loss of service.

I have reduced the lease time to 30 mins and syslog indicates dhcpcd is successfully matching the lease time and re-requesting the IP

I am at a loss as how to narrow my search down further, although this problem only seems to have started since adding the switch, but as mentioned earlier can be solved by reboot... anyway, please add your thoughts and/or troubleshooting  :Smile: 

not sure what to add for config, so here's some of the basics:

```

syslog entries

Sep  1 22:27:05 morrigan dhcpcd[2979]: eth0: renewing lease of 192.168.2.4

Sep  1 22:27:05 morrigan dhcpcd[2979]: eth0: acknowledged 192.168.2.4 from 192.168.2.1

Sep  1 22:27:05 morrigan dhcpcd[2979]: eth0: leased 192.168.2.4 for 1800 seconds

```

```

/etc/dhcpcd.conf

 $ cat /etc/dhcpcd.conf

# A sample configuration for dhcpcd.

# See dhcpcd.conf(5) for details.

# Inform the DHCP server of our hostname for DDNS.

hostname morrigan

# To share the DHCP lease across OSX and Windows a ClientID is needed.

# Enabling this may get a different lease than the kernel DHCP client.

# Some upstream DHCP servers may also require a ClientID, such as FRITZ!Box.

#clientid

release

# A list of options to request from the DHCP server.

option domain_name_servers, domain_name, domain_search, host_name

option classless_static_routes

# Most distributions have NTP support.

option ntp_servers

# Respect the network MTU.

option interface_mtu

# A ServerID is required by RFC2131.

require dhcp_server_identifier

# A hook script is provided to lookup the hostname if not set by the DHCP

# server, but it should not be run by default.

nohook lookup-hostname
```

```

/etc/resolv.conf

$ cat /etc/resolv.conf

# Generated by dhcpcd from eth0

# /etc/resolv.conf.head can replace this line

domain mydomain.co.uk

nameserver 192.168.2.1

# /etc/resolv.conf.tail can replace this line

```

```

route

$ /sbin/route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

default         Belkin.domain.c 0.0.0.0         UG    202    0        0 eth0

loopback        localhost.local 255.0.0.0       UG    0      0        0 lo

192.168.2.0     *               255.255.255.0   U     202    0        0 eth0

```

```

ifconfig

$ /sbin/ifconfig

eth0      Link encap:Ethernet  HWaddr 00:22:15:b8:27:24

          inet addr:192.168.2.4  Bcast:192.168.2.255  Mask:255.255.255.0

          inet6 addr: fe80::222:15ff:feb8:2724/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:535898 errors:0 dropped:0 overruns:0 frame:0

          TX packets:641648 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:368980474 (351.8 MiB)  TX bytes:120367328 (114.7 MiB)

          Interrupt:41 Base address:0xe000

```

EDIT: Added [Solved] to titleLast edited by flangemonkey on Fri Sep 02, 2011 4:51 am; edited 1 time in total

----------

## eccerr0r

For static IP internal nets, I'd try to make the lease as long as possible.  No reason to have the ipaddress change, so don't poll for it :)

However, I'd more look into the router for issues.  This is where I'd suspect the problem lies.

Something that's botherring me: Which server is returning the 504?  AFAIK in normal setups, it either works or doesn't work, as in you get connection timeout if something happens on your server.  What does it return if you deliberately stop httpd, same error message?

Things to try:

1.  Can you access the webpage from another machine on your net (not localhost)?  If it works, more hints it's the router.

2.  Can you packet sniff on that machine?  See if when a request comes in, it actually forwards the packet to your server?  This may require two internet connections... could use a cellphone data plan to check...

3. What does the router do when bombed?  Some routers totally give up...

Do you have issues with ssh? (I suspect those with webpages also forward ssh to their server too :)

----------

## flangemonkey

I reduced the lease to see if this would make a difference, assuming that the reason for the server disappearing was a renewal problem, I'll extend it later  :Smile: 

the 504, I presume, is being reported by the router as gateway from outside.

Stopping the httpd daemon does yield the same issue (although I am still able to ssh in, which I am not able to do when the server 'disappears')

In answer to your questions:

 *Quote:*   

> 
> 
> Things to try: 
> 
> 1. Can you access the webpage from another machine on your net (not localhost)? If it works, more hints it's the router. 
> ...

 

1. All computers on the NAT are able to access the website and SSH all of the time

2. The log at /var/log/apache/access_log shows no packets arriving, not sure how else to check as when I ran netstat to watch it (and then killed my torrent app) everything started to work.

3. looks like even though the torrent app is limited to 20k upload after time x the router gives up routing, I'll leave my torrent app off and if needs be, submit a bug report against rtorrent / libtorrent

thanks eccerr0r, your troubleshooting has renewed my serving  :Wink: 

----------

## eccerr0r

Yeah I found a bunch of routers give up when bombed with connections, especially when someone's running bittorrent that constantly opens and closes connections.  Reducing number of connections, not amount of uploads, will help.  Unfortunately this may reduce your download throughput.

----------

## flangemonkey

Thanks  :Smile: 

I'll read the man page tomorrow at some point, bed now lol

----------

