Connecting Arduino Yun Rev2 to pc with Ethernet

Hi
I am busy with a project where an Arduino YunRev2 needs to communicate to a pc via ethernet cable (and doesnt need to connect to the internet).
I plugged in Arduino to pc with ethernet and pinged its IP address but the request times out. I changed the IP address of pc ethernet to be static as suggested here. but result is the same.

This network stuff is still a bit greek to me. Im not even sure if the board can be pinged. If anyone can suggest me ways to better test the connection between the pc and arduino I’d appreciate it.

What sketch have you loaded onto the Yun? Without a sketch it may not initialise the Ethernet (not sure since I don’t have a Yun though). What ip address and network mask is being set in the sketch?

Is the ethernet cable you used a straight through or crossover? problems can occur using a straight through cable (most common) with some ethernet interfaces. If you have a spare ethernet switch plugging both PC and Yun ethernet cables into that is often a simple solution.

On the PC if you create a command prompt and type ipconfig it should give you details of its Ethernet connection. If you have previously has the PC connected to a network and just removed the ethernet plug and connected the Yun directly it could still have the old IP address. You state you have followed the suggestion of using a static address which is probably safer so hopefully the old address is gone. Can you tell us what ipconfig states as the ip address, gateway address, DNS address and network mask?

There is no sketch on the Yun. So the Yun is a bit weird, it has two precessors, the normal ATmega arduino processor and another one running a linux os. The Linux one has access to the ethernet network. So you cant program the arduino(with a sketch) to directly access the ethernet port, you have to use Bridge . But I was hoping if I plugged the arduino I could ping it without writing any sketch.

The ethernet cable is straight across, and I dont have another switch.
For the ipconfig the Ethernet ip and gate way is:
IPv4 Address. . . . . . . . . . . : 10.1.2.220
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.1.2.1
There is no DNS address

If the ethernet on the Yun is accessible from Linux, try typing
ifconfig
on the linux command prompt. This should give similar information to that you have from the PC. Post the results for ip address etc. on here.

You should see information for wifi connection as well as Ethernet connection.

eth1 Link encap:Ethernet HWaddr A8:40:41:11:9B:40
inet6 addr: fe80::aa40:41ff:fe11:9b40/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1679 errors:0 dropped:5 overruns:0 frame:0
TX packets:985 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:203875 (199.0 KiB) TX bytes:327188 (319.5 KiB)
Interrupt:4

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:448 errors:0 dropped:0 overruns:0 frame:0
TX packets:448 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:30464 (29.7 KiB) TX bytes:30464 (29.7 KiB)

wlan0 Link encap:Ethernet HWaddr A8:40:41:19:9B:40
inet addr:192.168.240.1 Bcast:192.168.240.255 Mask:255.255.255.0
inet6 addr: fd3c:e0d9:3614::1/60 Scope:Global
inet6 addr: fe80::aa40:41ff:fe19:9b40/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:10549 (10.3 KiB)

I can’t see an ip4 address for the ethernet, it may be that it is trying to use DHCP and not getting a address issued (I assume your PC does not run a DHCP server).
If you try and ping the PC from the linux prompt I presume it fails?

I think you will have to manually configure a static ip address for the ethernet interface. I suggest you use 10.1.2.221 as a starting address and see if that then allows you to communicate. You should then be able to ping each machine from the other.

Pinging the pc from the linux fails.
So I should try configure a static ip address for the interface for the linux?

If that is plain old ethernet cable, I wouldn’t expect it to work if you run it between the Yun and the PC. You need a patch cable if it isn’t going through a switch.

Sorry, yes that is what I was suggesting, using a static ip address on linux for the ethernet interface.

At present your linux does not have an ip4 address for Ethernet, so any ping attempts will be sent out over Wifi where it is very unlikely to find a host with the same address as your PC. You will need to use 255.255.255.0 as the netmask so that it can work out which interface to use (Wifi or ethernet).

So I have set a static IP and tried to ping the pc from the linux os but no packets come back. But if I ping from the pc to the linux it works, the packets come back.

What are the settings now on box - can you rerun ifconfig and post the results?

Do you have a firewall on the PC - since it is not on the Internet, it may be worth disabling the firewall whilst trying to ping the PC from Linux