Searching \ for '[PIC] UDP, ENC28J60 and Microchip stack question' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'UDP, ENC28J60 and Microchip stack question'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] UDP, ENC28J60 and Microchip stack question'
2006\08\02@151024 by Kenneth Lumia

picon face
Hello,



Sorry everyone, this is going to be a little long.



First off, let me say that I have very little knowledge

about networking.  That said, I'm attempting to use

the Microchip stack to send UDP packets to the

internet.  My hardware configuration is an ENC28J60

and several PCs connected to a LYNKSYS router/hub,

the WAN side of the router connected to a cable modem.



It appears to me from reading the documentation for

the stack (AN833) that to send a UDP packet to the

Internet, I need local and remote port numbers, IP address

AND a MAC address.  I know the ports and IP address;

however, the MAC address is unknown.



>From reading a few documents on the internet as

primers (RFC 1180 included), I don't really know what

to use for the MAC address.  My experiments so far

have shown that if I use the MAC address from the

LAN side of the LYNKSYS router (IP 192.168.1.1), I can

access the internet server.  I can also use ARP with just

the internet server's IP address to return a MAC (not the

same as my LYNKSYS MAC), which also allows

access to the server.  So, several questions:



1. Is the MAC address returned with ARP the actual
   server, or is it a computer between the router and the server?

2. Which MAC should I use, and why?

3. How often should I use ARP to get a new address?  I
imagine that unless the internet breaks, the server computer
is replaced or similar, that the MAC will remain the same.  
Should I just ARP once and store it in eeprom, or when
the server stops talking for a period of time, or at every
power cycle, or once/day...?  What is "standard"?

4. Does using the MAC not associated with the router
"bypass" or in anyway open me up to virus/hacking issues?

5.Is it "normal" to have to ARP for a MAC to send a UDP
packet ( it appears to be required in the microchip stack)?
In my limited past network forays, I used a class
library that encapsulated all this, I just needed to send in
the port numbers and the domain name (yes, I still need
to figure out how to access a DNS server for IP resolution).


Thanks for any help.



Ken

spam_OUTklumiaTakeThisOuTspamadelphia.net

2006\08\02@155536 by Herbert Graf

flavicon
face
On Wed, 2006-08-02 at 15:10 -0400, Kenneth Lumia wrote:
> 1. Is the MAC address returned with ARP the actual
>     server, or is it a computer between the router and the server?

Depends on how your network is set up. But off hand, an ARP of an IP
outside of your local segment will correctly return the MAC of the
gateway to that external network.

> 2. Which MAC should I use, and why?

You should use the MAC returned to ARP. If it's wrong then the device
giving you the wrong MAC is at fault. You shouldn't have to "check" if
the MACs are correct.

> 3. How often should I use ARP to get a new address?  I
> imagine that unless the internet breaks, the server computer
> is replaced or similar, that the MAC will remain the same.  
> Should I just ARP once and store it in eeprom, or when
> the server stops talking for a period of time, or at every
> power cycle, or once/day...?  What is "standard"?

I don't know about "standard". For "easiest" I would do it every time,
it doesn't take much time to do.

> 4. Does using the MAC not associated with the router
> "bypass" or in anyway open me up to virus/hacking issues?

No.

> 5.Is it "normal" to have to ARP for a MAC to send a UDP
> packet ( it appears to be required in the microchip stack)?
> In my limited past network forays, I used a class
> library that encapsulated all this, I just needed to send in
> the port numbers and the domain name (yes, I still need
> to figure out how to access a DNS server for IP resolution).

Yes. Remember, you are dealing with multiple layers here. IP addresses
are good for the whole internet (ignoring private addresses). MACs are
addresses specific only to your local segment, they have no meaning
outside of your local segment. There are transports that IP ride on that
don't even use MACs. TTYL

2006\08\02@164116 by Charles Craft

picon face

>1. Is the MAC address returned with ARP the actual
>    server, or is it a computer between the router and the server?

There are some routers that do proxy arp by default. Check your router config.


>3. How often should I use ARP to get a new address?  I
>imagine that unless the internet breaks, the server computer
>is replaced or similar, that the MAC will remain the same.  
>Should I just ARP once and store it in eeprom, or when
>the server stops talking for a period of time, or at every
>power cycle, or once/day...?  What is "standard"?
>

Run an "arp -a" on a PC or Unix box. This show the contents of the arp cache.
Most are dynamic entries that have a default life - some unix servers are 20 minutes.
Check the man page for arp to see examples of using static arp entries.


More... (looser matching)
- Last day of these posts
- In 2006 , 2007 only
- Today
- New search...