0

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 (?????????)

sees
  • 9
  • 3
  • 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 02: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) –  Nov 16 '11 at 02: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 02: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 –  Nov 16 '11 at 03: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 09:23
  • Yes, 100%. It works perfectly. The continuously-sending-arp may be the problem. Now, to solve the problem, I just want to know the current networking state of my Linux to restart it. Can not use ping because I don't where to ping at that time. – sees Nov 16 '11 at 10:33
  • The "continuously sending arp" is a symptom. I think it's more likely that the ARP reply is not getting through. If the whole system works when you power-cycle your router your router is likely the culprit -- Try replacing it? – voretaq7 Nov 16 '11 at 18:13
  • Yes, maybe it's the problem but still don't know why. Also try with other routers but no help. Can you tell me how to get wireless router's from the Linux machine by using some Linux command, shell or C? – sees Nov 17 '11 at 16:49

1 Answers1

0

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?

sarnold
  • 1,211
  • 7
  • 9
  • 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 02:29
  • Fixing whatever the underlying issue is would definitely be the best approach. – sarnold Nov 18 '11 at 02:47
  • Just figured out that after 448 requests from tablet, the problem occurred. Maybe there is something wrong with the socket processing – sees Nov 18 '11 at 06:04