Failed to configure Ethernet using DHCP

Hi, I am new to networking. I am trying to connect to google.com using arduino ethernet shield + mega2560.
I am using linux. I got wi-fy internet access on my laptop. I am sharing it via eth0. (by edit connection >wired>name>IPV4>method = "shared to other computers".
Now when I am trying the example code DnsWebClient, rarely I will get the result. Most time, it shows "Failed to configure Ethernet using DHCP". Some time it may work....Most time the error only...

So, what exactly may be my problem?

edit connection >wired>name>IPV4>method = "shared to other computers".

Could it be the WIRELESS connection you want to be "shared with other computers"?

Yes I am sharing the net connection from wireless via lan (eth0). So I edited the wired connection settings as above.. It will work some time, but most time, it will show the DHCP error as above, but the net is not disconnected or hanged in the system...