Problem of connecting Ethernet shield

Hello everyone,

I have been trying to connect to a website with my Ethernet shiled for about two weeks. I searched everywhere and tried everything that I can found. This is the example code that I am trying to get worked (It is provided by Arduino);

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

byte mac = { 0xSS, 0xSS, 0xSS, 0xSS, 0xSS, 0xSS };
byte ip = { 139, 0, 0, 0};

EthernetClient client;

void setup()
Ethernet.begin(mac, ip);



if (client.connect(“”,80)) {
client.println(“GET /search?q=arduino HTTP/1.0”);
} else {
Serial.println(“connection failed”);

void loop()
if (client.available()) {
char c =;

if (!client.connected()) {

Note that I changed MAC adress and IP address to not share them in here :slight_smile: MAC address is already written on the shield, I guess it cannot create a problem. About IP address, I am trying to connect in an university network, therefore I have some unsureness about finding a valid IP adress since most of them should be occuppied by different computers in the campus. Another point that may cause a problem is Internet sharing. I am connected to Internet via Wifi. When I checked the box that says “allow other network users to connect through this computer’s Internet connection” and tried to connect to Internet with another computer which is connected to “server” computer with ethernet cable, it simply does not work. I cannot connect to Internet with second computer. Moreover, I tried different technique that is"bridge connections". That way I could connect to Internet with second computer. However, both of these methods could not work for arduino, client.connect method always returns false. What should I do?

Thank you if you read that much writing :slight_smile:


Change:   Ethernet.begin(mac, ip); To:   Ethernet.begin(mac);

See if the network will assign you an IP address via DHCP.

If you specify an IP address and don't specify the DNS Server Address, Gateway Address, and Subnet Mask then the .begin() is going to use a bunch of defaults. If those defaults are not correct for your network then nothing is going to work.