zbx-sadman / zabbuino

Zabbix agent for Arduino
92 stars 14 forks source link

Gateway seems to not working #2

Closed Hy3n4 closed 8 years ago

Hy3n4 commented 8 years ago

Hi,

I've just tried 1.0.0 pre-release and it seem to not working from different network. However it is working within the same subnet. Looks like gateway issue, but it is correctly set. I've tried debug gw settings with: _SerialPrintP(PSTR("GW : ")); Serial.println(Ethernet.gatewayIP()); and it is set to correct value.

Version 0.9999 is working just fine.

I'm new to Arduino programming and my C++ knowledge is at the same level right now so I cannot help you more. But if you want to test something just let me know.

zbx-sadman commented 8 years ago

Let me guess - you use ENC28J60 network module.

I had same problem on 0.9999 , but pre-1.0.0 work fine. Really - i don't know what is make ENC28J60 stupid from time to time.

But i think that you can try replace UIPEthernet library what taken from master branch to another: https://github.com/ntruchsess/arduino_uip/tree/fix_errata12. Some problems of is fixed UIPEthernet in that release. Just download fix_errata12 branch as zip-file, delete all files from "C:\Program Files (x86)\Arduino\libraries\UIPEthernet\" (or where yours UIPEthernet is placed) and put content (.c, .h files and subdirs) to that dir.

So, i test two Zabbuino's now (via VPN link and four hops):

$ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:14:5e:5d:97:7a
          inet addr:172.16.100.230  Bcast:172.16.100.255  Mask:255.255.255.0
...

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

$ ping 192.168.0.227 -c 1
PING 192.168.0.227 (192.168.0.227) 56(84) bytes of data.
64 bytes from 192.168.0.227: icmp_req=1 ttl=59 time=142 ms

--- 192.168.0.227 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 142.677/142.677/142.677/0.000 ms

$ zabbix_get -s 192.168.0.227 -k "sys.cpuname"
ATmega328P

$ zabbix_get -s 192.168.0.227 -k "sys.netmodule"
Microchip ENC28J60

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

$ ping 192.168.0.228 -c 1
PING 192.168.0.228 (192.168.0.228) 56(84) bytes of data.
64 bytes from 192.168.0.228: icmp_req=1 ttl=126 time=81.1 ms

--- 192.168.0.228 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 81.119/81.119/81.119/0.000 ms

$ zabbix_get -s 192.168.0.228 -k "sys.cpuname"
ATmega328P

$ zabbix_get -s 192.168.0.228 -k "sys.netmodule"
WizNet 5xxx

As you see - all ok with gateway function. Don't try use "sys.netmodule" - i've add its just now for used ethernet library indication

Hy3n4 commented 8 years ago

And that is weird, because it is WizNet 5100. So it should work just fine.

zbx-sadman commented 8 years ago

So strange. Wiznet always works without any problem. I have one board with W5100 too. Do you use DHCP or Static IP configuration? 0.9999 and pre-1.0.0 have the same MAC/IP/Sub/GW ? May be network switch (or other equipment) expect to detect old MAC on port?

Hy3n4 commented 8 years ago

Well now I feel dumb. You were absolutely right. I have had a different MAC address in pre-1.0.0. When I changed it to previous MAC it all started to work.

Thank you and thank you for your great work.