Finding the IP of my Arduino w/ Ethernet?

I recently obtained and Ethernet Shield and decided to start playing with it. however I can’t seem to figure out the IP the Arduino is using. First of all, I can’t plug the other end of the cable into my router because there’s only one port on it that is being occupied by something else. So I just plugged it into my laptop’s port which should work the same I believe. But when I use the “DhcpAddressPrinter” sketch, I keep receiving the error “Failed to configure Ethernet using DHCP”. If the problem is connecting it to my laptop, what steps might I take to get the desired result? Here is the code by the way.

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {  
  0x90, 0xA2, 0xDA, 0x0D, 0x50, 0x9A };  // My MAC address that came with the shield

// Initialize the Ethernet client library
// with the IP address and port of the server 
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
  // this check is only needed on the Leonardo:
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for(;;)
      ;
  }
  // print your local IP address:
  Serial.print("My IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
    Serial.print("."); 
  }
  Serial.println();
}

void loop() {

}

It does not appear that your laptop is offering DHCP service on the ethernet port.

Search for Internet Connection Sharing and you may find guidance for your system that will make that setup work.

-br

JackSac67:
So I just plugged it into my laptop’s port which should work the same I believe.

Why would you believe that?

As billroy suggests, you need to enable something like Internet Connection Sharing so your computer will, effectively, act as a router.

JackSac67: So I just plugged it into my laptop's port which should work the same I believe.

No, it is unlikely this will work, even if you have internet sharing and DHCP set up on your laptop. Laptops generally do not have automatically (or even manually) reconfigurable RJ45 jacks. You would need a crossover Ethernet cable or a hub/switch.

BillO: Laptops generally do not have automatically (or even manually) reconfigurable RJ45 jacks.

That's simply not correct. All modern PHY chips support automatic crossover, including the W5100 that is used by the Arduino Ethernet (and Shield). So it wouldn't matter if the computer didn't support it.

Well, I’m not going to try to verify your second statement so I’ll take your word for it, but as to your third, the W5100, yes, it indeed does support auto MDI/MDIX. My mistake.

Not to worry all, got it working. I was under the impression that connecting through ethernet automatically shared the internet directly. Just had to turn on internet sharing through an ethernet/wifi connection and it worked.