Ethernet Shield IP & Mac Address problems

:'(Just purchased an Arduino Ethernet Shield but really finding it difficult to understand how to set it up! When using the Web Client sketch should I use the same ip address as my computer and how do I give it a Mac address? Really would appreciate any time it may take for anyone to explain it to me or even a kick in the right direction :slight_smile: Thanks

I started with the sample sketches, and only changed the IP address. You can't use an address that is already in use on your network, which includes your computers and router. Try to ping* an address that's one number different at the end than your router address. (That is, if your router is 192.168.1.1, try 192.168.1.2.) If ping doesn't return any responses, you can use that address. If it does show a response, try the next one.

  • From a command prompt, just type ping 192.168.1.2 , for example.

:slight_smile: Thanks Jerry! Does this mean I don't have to enter a Mac address into the sketches ever? Will try the ping today. :).............Just tried it and got an IP address through your method but no luck executing the web client sketch :cry: tried turning all firewalls off but still no luck!.................................I'm using the official arduino ethernet shield by the way......That's why I thought I had to put a Mac address into the sketches!!....Will keep messing with it anyway and thanks for your help :slight_smile:

Yes, you must use a MAC address. the one in the example is fine, until you use more than one arduino ethernet on the same LAN. MAC addresses must be unique as well.

-j

::)Cool! For some reason I thought the Mac address in the sketches was some sort of generic blank that had to be filled in with one that you had to get from somewhere else! That makes more sense to me now.....Still can't get her going though.......... :).....Just tried a thousand variations on the IP, have router and macbook firewalls off and still nothing. Is there possibly anything else I'm leaving out? Thanks, Goatboy :-/

Here's how I had my mac laptop connected last night:

enable internet connection sharing, share airport to ethernet.

execute the command "ifconfig en0" and look for the internet address. mine was "inet 192.168.2.1".

pick an address in that same subnet (e.g. i chose 192.168.2.2) for the arduino.

use the IP of the powerbook (192.168.2.1) for the gateway address on the arduino. gateway is another (older) term for default router.

fire up the sketch and see if the powerbook can ping the arduino: ping 192.168.2.2

-j

;)I shall give that a whirl now!!

;D :smiley: ;D :slight_smile: That's the ticket!!! ;D Thank you too much!!.......Now to take over the world!!!!!

:smiley: If I may be so bold to ask if you have any advice on how to configure a macbook's firewall to allow the ethernet shield to communicate without having to turn it off all together :).......obviously not going to take over the world at this rate but extremely relieved that it indeed works.........Goatboy

:slight_smile: I have it sorted now! Thanks for every ones help :slight_smile:

The purpose of the MAC address is to distinguish devices on the physical network. (It has nothing to do with Macintosh.) Every device has its own MAC address, and the original thought was that every device would be globally unique. That's not strictly true, and all that is important is that it be unique for a given physical network. Real networking devices have embedded code that includes their own MAC address, and some allow the MAC to be changed on command. At this scale, though, your sketch is the embedded code that includes the MAC address for the device you're constructing.

The purpose of an IP address is to let software organize the physical devices into logical networks of devices. What's that difference? Software control. Administrators rarely fuss with the MAC addresses, but they configure related routers and related clients to have similar IP addresses. Again, IP addresses must be unique on a physical network, or devices will get confused. When the software on a computer wants to consider talking to another machine, it can do so according to the IP address of that far machine. The underlying hardware has to convert IP addresses to MAC addresses, but that happens without your programs realizing it. Big win here: if a machine breaks, the new replacement machine might not have the same MAC. But it can easily be configured to use the same IP address, and all of the routers can (nearly instantly) start sending messages to it. Also, certain IP addresses are reserved for special rules like broadcasting one message to many clients in a range of addresses. In the Arduino world, you're both hardware and software, and so a sketch must have both.

Hostnames like "arduino.cc" or "localhost" are just a friendly dictionary lookup. Currently, no Arduino software can make use of these string names, but your computer can ask an authoritative name server (usually attached to your ISP's network) to convert string names to IP addresses. This happens every time you browse this forum. As with the IP/MAC conversion, this lets the arduino.cc folks switch machines, or even service providers, without becoming unreachable. You'd hate to browse the forum at http://216.38.50.214/ right?

Lastly, when dealing with TCP/IP, you have a socket number. This lets computers distinguish between multiple software programs at the same IP address. One socket number is common for web protocol, another socket number is common for file sharing, and so on.

Im sorry to say, but I have trouble to set up Arduino Ethernet Shield. I have a broadband cable connection which goes to my router. From router one cable is connected to my PC (with a fixed IP address) and other cable is connected to Ethernet Shield. I just tried to get one of Ethernet Library example sketches working (WebServer), but no success so far (this is the 3rd day Im trying it). :-[

What happens = the Arduino Ethernet Shield keeps jolly blinking its LINK, TX and RX LEDs in one rhythm with router`s LEDs, 100M and FULLD are steady on - seems nice, but it has no sense. To the MAC address in example sketch I added gateway and subnet addresses aswell, but the all IP addresses I tried to choose for Arduino are giving or not giving Ping replies with no difference if Arduino is connected to ethernet or not.

I dont understand what to do and how to solve it. Unfortunately there is very less about troubleshooting regarding EthernetShield on arduino`s website.

Maybe anyone of experienced users have a clue , what Im doing wrong? Is it possible that my internet connection isnt suitable for additional ( = not assigned from provider) IP address at all? Or something about TCP/IP stuff?

Am I the only one getting trouble with it?
I would appreciate any help.

Re: Ethernet Shield IP & Mac Address problems
Reply #5 - 26.03.2009 at 18:33:48
Here's how I had my mac laptop connected last night:

enable internet connection sharing, share airport to ethernet.

execute the command "ifconfig en0" and look for the internet address. mine was "inet 192.168.2.1".

pick an address in that same subnet (e.g. i chose 192.168.2.2) for the arduino.

use the IP of the powerbook (192.168.2.1) for the gateway address on the arduino. gateway is another (older) term for default router.

fire up the sketch and see if the powerbook can ping the arduino: ping 192.168.2.2

-j

This is what finally helped me!!! I had to stop the firewall on my macbook for this to work as well!

Another thing I`m confused is this one:
"A typical home network router possesses two IP addresses, one for the internal home (LAN) and one for the external Internet (WAN) connection"

Now, when I check my IP address with netstat -n, it gives me Local Address 10.10.49.22. If I check it with web-based lookup service http://checkip.dyndns.org/, it gives me 80.233.182.33.

Where is the truth?

Anybody else tried to connect Arduino EthernetShield via router?

Gj

Hey GoatBoy!

Big thanks for your advice, but unfortunately we are on different platforms = I don`t have Airport since I run IBM ThinkCentre / WinXP Professional here...

:slight_smile: sorry if this sounds dumb but have you tried typing the command line from above to get the the correct IP address? It sorted everything out for me! I feel your frustration though...I had two days of pulling my hair out!

Now, when I check my IP address with netstat -n, it gives me Local Address 10.10.49.22. If I check it with web-based lookup service http://checkip.dyndns.org/, it gives me 80.233.182.33.

Where is the truth?

the 10.10 address is your private network address behind the router. the 80.233 address is your router's external (public) IP address.

Anybody else tried to connect Arduino EthernetShield via router?

Yes. No problems.

-j

Just wanted to say that I solved the problem and now I can connect to Arduino via internet smoothly. :slight_smile:

The problem was in IP / subnet / gateway settings. One should be aware of the IP hierarchy. In my case there is ISP, my Router (which provides dynamic IP`s to my LAN and connects to my ISP trough WAN), my PC and my Arduino and each unit / instance got its own IP. I just swapped something. I guess it would be great, if such things were explained on Arduino website - just to make things clear for newbies like me.

Thanks for all inputs!

Gj