Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ECN28J60 UDP gateway
22-01-2014, 06:21 AM,
#1
ECN28J60 UDP gateway
I used the following development tools.

Olimex PIC32-Pinguino-OTG
Olimex-MOD-ENC28J60
IDE X4 Rev685 & 960

I created a UDP server using the IDE library, it works fine to respond to ARP, PING and custom udp port within the same physical LAN regardless of the IP address.

However, when it is located at a different physical network over the routers, it failed to respond (or the response never reach the client/sender).

I checked the connectivity and firewall setup and confirmed working fine by placing a PC instead of Pinguino using the same IP address.

The possible problem I suspect is that there is no gateway configuration option available in the ethernet udp library and the router at the pinguino side is not routing back in the absence of gateway configuration at Pinguino.

I would appreciate if anyone has successfully deployed such environment.

DJ
Reply
22-01-2014, 11:21 AM,
#2
RE: ECN28J60 UDP gateway
(22-01-2014, 06:21 AM)djpark Wrote: The possible problem I suspect is that there is no gateway configuration option available in the ethernet udp library and the router at the pinguino side is not routing back in the absence of gateway configuration at Pinguino.

Not surprising. To reach a host on a different network, you need to :
- Compare the target IP with the network adress and network mask. You should see there that your're not on the same network
- Get the gateway IP, do an ARP resolution on it to get the MAC address.
- Send your paquet with the target IP and the gateway MAC address.

You should do a network capture on the network were the pinguino is, and open it with wireshark to get more infos on what is going on.
Reply
22-01-2014, 11:48 AM,
#3
RE: ECN28J60 UDP gateway
Your PC is confusing you, I think, as it probably has a lot more software running on it.

From what you posted, which is slightly hard to grasp as there are no IP addresses given, it looks like it ought to behave as you said. If you're wanting to route packets between nets then something needs to be there to do that and configured appropriately. Do you want or need a single Pinguino to do all that or were you just kind of hoping it would magically work as if by accident?

John
Reply
24-01-2014, 08:54 AM,
#4
RE: ECN28J60 UDP gateway
Thanks, koocotte. That part is missing in the ENC28J60 library in Pinguino IDE.

John,

I understand that it is too much for the P-IDE developers to prepare the feature rich working libraries for the peripherals while they have done a great job of bringing the IDE and core and many libraries working. I believe that's where we can help each other by contributing if some work has been done successfully.

Moving from CCS development environment to PIC32, I decided to go with Pinguino IDE instead of spending a long time learning MPLAB X development and that was a good move as it gave me fast learning curve and clean and lean output in addition to the convenience of USB bootloader.

When I needed to work on the Ethernet module first time, I kind of hoped to find a working library. The existing ENC28J60 library works fine except it is too stripped down or built to be bare bone and in some situation like I am in, it doesn't produce desired output. In this particular case, the ARP response from the Pinguino is not going over the router to the caller.

The question now is -- if I should learn the whole lot of tcp/ip stack and enhance the existing Pinguino library (I wish to), or just adapt Pinguino hardware to MLA or Harmony with expectation that the MLA is full featured -- within a short time available to complete the project.

DJ
Reply
24-01-2014, 10:33 AM,
#5
RE: ECN28J60 UDP gateway
(24-01-2014, 08:54 AM)djpark Wrote: In this particular case, the ARP response from the Pinguino is not going over the router to the caller.

ARP requests and responses are not supposed to cross router. You may have a misconfigured network.
Reply
25-01-2014, 07:30 AM,
#6
RE: ECN28J60 UDP gateway
I will need to include debug information in the code to check the src & dest MAC and IP.

When the library routines are responding to ARP, PING or UDP request, it sets the dst IP with sender's IP, dst MAC with sender's MAC while src MAC and IP are set of my device. If I determine the ARP src MAC is of the router, the library routines should work in normal condition.
Reply
07-02-2014, 10:08 AM,
#7
RE: ECN28J60 UDP gateway
I spent quite a lot of time and effort to find the problem of this issue including using the Microchip MLA and also creating a firewall router to trace the ethernet packets. The findings are quite shocking at first.

The ENC28J60 UDP library included in Pinguino IDE is returning ARP, echo and UDP to the sender. Even though there is no gateway configuration included, it works perfectly to respond to the incoming UDP request across subnet boundary.

The real problem was the Cisco router rejecting the ARP reply packets from the Pinguino with MAC address that didn't follow the manufacturer's ID (first 3 bytes of MAC address).

By setting the MAC id starting with 00-04-A3 solved the problem.
Reply
07-02-2014, 10:12 AM,
#8
RE: ECN28J60 UDP gateway
(07-02-2014, 10:08 AM)djpark Wrote: The ENC28J60 UDP library included in Pinguino IDE is returning ARP, echo and UDP to the sender. Even though there is no gateway configuration included, it works perfectly to respond to the incoming UDP request across subnet boundary.

So your Cisco is not working as a router, but as a bridge, and both side are on the same LAN.
Reply
07-02-2014, 03:19 PM,
#9
RE: ECN28J60 UDP gateway
The Cisco Catalyst Layer 3 Switch is working as router between 10.10.1.x and 192.168.20.x over a few different routers in between dedicated leased lines. The routing between the networks works fine.

The problem was this:
- UDP packet from 10.10.1.x arrives at Cisco router
- Cisco router sends ARP asking for 192.168.20.8
- Pinguino answers ARP with MAC 19-21-68-02-00-08
- Cisco router rejects the MAC and ignore
- Cisco router refuse to send the UDP packet to Pinguino

This happens because Cisco Catalyst series has 'Dynamic ARP Inspection' feature to validate the ARP and drop if unacceptable. It can be overcome by correct setting of switch/router or ACL, but they are beyond my control.

It doesn't happen with a cheaper router brands.

The simple solution was to change the MAC address to satisfy the switch using Microchip registered MAC 00-04-a3-...

I am sharing this information so that other don't have to scratch head to figure out to find the problem when everything should work.

DJ
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)