Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the following problem and really need your help
I'm implementing a small server to receive request from client on port 18999(just sample) using TCP socket.
When I tested my server by using a lot of requests from a tablet through a router,
I got the ARP problem(?)

My net work just like:

TABLET <-------> WIRELESS ROUTER <-------> MY SERVER (LINUX)

Problems:
1. Can not connect to my Linux any more ( telnet, ping v.v...unreachable)
2. I use serial cable to connect to my Linux machine and
use Wiresharp (from Windows) to catch the send message from Linux.
It says that Linux keeps sending out continuously every 3 seconds ARP messages
like the following:

xx:xx:99:77:ff:69 ff:ff:ff:ff:ff:ff ARP 60 Who has 192.168.10.2? Tell 192.168.10.3

In the above message:
xx:xx:99:77:ff:69 my Linux MAC address
192.168.10.2 my Tablet address
192.168.10.3 my Linux IP address

Can you help me figure out the problem?
Or tell me the way to detect the problem and reset the network back to normal (maybe restart Linux but I want to detect problem and restart automatically)

UPDATE:
1. The above network works normally if tablet sends messages to my LINUX in normal speed (but also down after 48 hours)
2. The router works again after I unplugged my Linux ethernet cable (RJ45) from router.
3. The wireless network still works ( I can browser the router page from tablet)
4. When I use:

ifconfig down

then

ifconfig up

, the Linux restarts (?????????)

share|improve this question

migrated from stackoverflow.com Nov 16 '11 at 5:08

This question came from our site for professional and enthusiast programmers.

closed as off topic by Shane Madden, Chris S, voretaq7, MDMarra, Iain Nov 21 '11 at 14:45

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Does your tablet respond with the IP address that it owns? I'd suggest double-checking the netmask and default router settings on all machines in the network. –  sarnold Nov 16 '11 at 2:17
    
"IP address"? no, the Linux was in the state of keeping sending out arp message to get the MAC address of the tablet but could not. Note that: my server still worked normally in around two minutes before dead (even the entire network in my router dead, too) –  sees Nov 16 '11 at 2:29
    
Sigh, I'm well past the five-minute edit window. :) I meant, "Does your table respond with the MAC address it owns?" -- the Linux machine is begging to know the MAC and if the Tablet doesn't generate the is-at reply -- or if the router drops those packets -- then the Linux machine will never know which MAC to use when sending packets to the tablet. –  sarnold Nov 16 '11 at 2:38
    
I checked the subnet and default. All are OK. DHCP are enabled in all machines. When problem happened, I even can not ping my other PCs connected to the router. I meant the router doesnot work anymore. It seems the router can not receive ARP response when sending to my Linux –  sees Nov 16 '11 at 3:24
1  
Are you sure about update point #2: The router works again after I unplugged my Linux ethernet cable (RJ45) from router. ?? That sounds very strange. –  sarnold Nov 16 '11 at 9:23
show 3 more comments

1 Answer

It sounds like you want some mechanism to reboot your Linux machine when its networking goes away.

I wouldn't try to solve this off the Linux machine, because you're having trouble connecting to it, but instead solve it on the machine.

You could run as root:

while true ; do ping -i 2 -c 5 192.168.10.1 || shutdown -r now "lost networking" ; done

This fairly brutally reboots the machine whenever it cannot ping the router. If the router gets unplugged, this reboots the Linux machine. If the network cable gets yanked, this reboots the Linux machine.

There must be a better solution to the problems you're having, though. Does your router need a firmware update?

share|improve this answer
    
I tried it already but the problem is I don't always know my router IP address. It also can be changed automatically by dhcp. It's not fixed. Is there any other solution? –  sees Nov 16 '11 at 11:32
    
Your router's address changes too? Even the "internal" address, as I've guessed here? How on earth would any machine know to update its gateway address when the router's address changes? –  sarnold Nov 16 '11 at 11:47
    
Was just a quick thought. Maybe I'm wrong with the DHCP. But in my system, I'm just working on the Linux machine, don't control router and its settings. By using your method, I'm afraid it can only work when the Linux machine is using DHCP to get IP address, default gateway, etc. If a user sets static IP, default gateway v.v.. I don't know how to get router's IP. Do you know how to get the router's IP automatically? (shell, C?) –  sees Nov 17 '11 at 17:41
    
Well, in general might be difficult -- a machine might be connected to dozens of routers -- but ip route show | awk '/default/ {print $3;}' will print out the address of a default router, if one has been set. –  sarnold Nov 17 '11 at 22:19
    
I also wrote C code to get default gateway but maybe there are times an user may set default gateway wrongly(not exist?), and my program breaks –  sees Nov 18 '11 at 2:29
show 2 more comments

Not the answer you're looking for? Browse other questions tagged or ask your own question.