Ethernet Server

In case of DhcpAddressPrinter.
I get this message :
Failed to configure Ethernet using DHCP
any idea how to fix this ?

ipconfig /all gives me the physical address that i put in mac[].
it also says "dhcp enabled : no "

in case of ethernet server code :
i cant open my ip address in web browser, the page doesn't load.
when i ping the ip, it says "destination host unreachable".

Connect the ethernet shield directly to a router that has a dhcp server enabled.

And don't set the Arduino's MAC address to the one you get from ifconfig ipconfig. It has to be unique.

@SurferTim: I connected the ethernet shield to dhcp enabled server, still getting problem.

@Elijahg: Just to know the mac address i connected ethernet with my pc and ran ipconfig /all
command which then shows its physical address(when i disconnect it from pc, ipconfig /all doesnt show these details). Then i copied that address to mac[] in the code and disconnected the shield from pc and plugged it to my dhcp enabled router.

Even if i assign any random mac[], the problem persists.

kaushalKishor:
i cant open my ip address in web browser, the page doesn't load.
when i ping the ip, it says "destination host unreachable".

Where're you getting the IP address to ping? If the Arduino has no IP from the DHCP server, you can't ping it.

kaushalKishor:
@SurferTim: I connected the ethernet shield to dhcp enabled server, still getting problem.

@Elijahg: Just to know the mac address i connected ethernet with my pc and ran ipconfig /all
command which then shows its physical address(when i disconnect it from pc, ipconfig /all doesnt show these details). Then i copied that address to mac[] in the code and disconnected the shield from pc and plugged it to my dhcp enabled router.

Even if i assign any random mac[], the problem persists.

The MAC address you see in ipconfig is the MAC of your PC, not the Arduino. It only shows up when you have the Ethernet cable plugged in to something, be it the Arduino or your router. The MAC has to be unique, and definitely NOT the one you see in ifconfig.

Post the code you're using, inside code tags. You're definitely plugging the Arduino into your router?

Hello Elijahg,
yes you are right, i had a miscoception.
After lot of attempts what i observed now is when i connect the ethernet shield to pc, i am able to create a server and the browser also shows it in the ip address i assigned(as per the ip address of pc's ethernet ipv4) in the web server code.
But, when i edit the ip(in the code) as per the wifi router(set in AP mode) i am connecting the ethernet shield to, its not working. The web browser doesn't show the page.

when i connect the ethernet shield to pc

This implies you're connecting the shield to your PC directly. That won't work without extra configuration on your PC. As stated before, it must be plugged into your router.

also shows it in the ip address i assigned

You're setting the IP manually now? Or are you using DhcpAddressPrinter? What do you mean by "as per the ip address of pc's ethernet ipv4"? You've set the Arduino's address to the same as the one assigned to your PC's Ethernet port?

But, when i edit the ip(in the code) as per the wifi router(set in AP mode) i am connecting the ethernet shield to, its not working. The web browser doesn't show the page.

I'm not quite sure how you're connecting the Ethernet shield to the Wifi router. Are you going Ethernet > wifi access point > wifi router? Or are you still connecting the shield to your PC directly via Ethernet? Or do you just mean you're connecting the shield to the wifi router via Ethernet?

I think you need to read up on networks a bit before attempting a web server with an Arduino, especially on how the addressing works.

Hi Elijahg,
Let me be elaborate stepwise.

  1. I connected ethernet shield to my pc's ethernet port.

  2. I uploaded code of dhcpAddressPrinter, i got ip address in serial monitor 192.168.137.x (where x is different everytime i upload the code)

  3. I opened 192.168.137.x in google chrome. i got the desired page.

  4. I uploaded code of webServer in which i set ip 192.168.137.254.

  5. I opened 192.168.137.254 in google chrome. i got the desired page.

  6. My wireless router of d-link. its ip address is 192.168.0.1. I connected my pc to this router through wifi.

  7. I uploaded code of webServer in which i set ip 192.168.137.254.

  8. I opened 192.168.137.254 in google chrome. i didn't get the desired page.

  9. I uploaded code of webServer in which i set ip 192.168.0.254.

  10. I opened 192.168.0.254 in google chrome. i still didn't get the desired page.

  1. I connected ethernet shield to my pc's ethernet port.

What gateway IP address are you using in your arduino code? Have you configured the pc to be a gateway for connected network devices?

Hi zoomkat,

I did nothing to the pc configuration

You seem to be ignoring what people have repeatedly told you regarding plugging the Ethernet shield into your router, NOT your PC. Your router is not your PC, why do you insist on plugging it into your PC despite what everyone keeps saying?

Elijahg:
You seem to be ignoring what people have repeatedly told you regarding plugging the Ethernet shield into your router, NOT your PC. Your router is not your PC, why do you insist on plugging it into your PC despite what everyone keeps saying?

have you tried decaf...?

I did nothing to the pc configuration

If your computer is running windows, then you might Google "internet connection sharing" or "ics" and do some reading.

zoomkat:
have you tried decaf...?

Yes, doesn't work so well :frowning:

I've explained to kaushalKishor quite a few times that he needs to connect his Ethernet shield directly to his router, but then he replies saying "I've connected the shield to my PC and I can't access the page in Google Chrome"... Connection sharing is beyond the scope of Arduino Ethernet discussion imo, and there's plenty of resources online about it without repeating it all here.

i was trying my best to explain the issue...anyway problem solved.

The same code is working fine with this hardware http://www.mouser.in/ProductDetail/WIZnet/WIZ810MJ/?qs=b%252bXOOdUOuvaAbEffaKaCgA%3D%3D

my ethernet shield might be faulty...thank you guys for help!

kaushalKishor:
i was trying my best to explain the issue...anyway problem solved.

I understand the language barrier makes it difficult, but you've got it connected up incorrectly at a very fundamental level, before you even get close to any programming.

If you've got a SD card in the shield, you need to make sure to drive whichever pin it's attached to (4 usually) high. If you've got it working with the same setup as you had before (shield attached to the PC via Ethernet without internet sharing enabled) it's likely to stop working at some point since it's not a correct setup, whether the shield is malfunctioning or not.