ethernet shield problem

Dear sir,

I am new to this arduino so i need some clarification from you sir,i am using arduino board with Ethernet shield ..i compiled web server code with arduino mega 2560..then i have connected arduino and Ethernet shield together ..then i checked in browser .it was worked at first time .after reset button pressed it does not shows anything ,then i checked from command prompt..it shows destination host unreachable.so sometimes it is working .. then it shows destination host unreachable...after that i removed LAN cable from Ethernet shield .then i connected one laptop to another laptop..then i got reply from same ip address ....so problem might be in Ethernet shield..so please guide me to complete my project.............Thanks in advance......

It should work.
Do you use this example?

Do you use DHCP ?
If you change this: Ethernet.begin(mac, ip);
into this: Ethernet.begin(mac); // use DHCP
then you will use DHCP.

Perhaps you can try another ethernet cable.
How do you power it ? with the USB cable ? You might have to try a power supply for the Arduino Mega board.

so problem might be in Ethernet shield

What Ethernet shield are you using? There are several different types.