It's not a DNS issue, which is why your various attempts to fix it didn't work. However, you can manually configure a DNS solution, which is what you did when you added the entry to your hosts file. The issue with that is it works only on that one computer, and only until the Yun's address changes (which it will tend to do from time to time unless you took special steps to make the address static.)
Charly86:
so my understanding is that when Arduino success to LOCALLY resolve arduino.local then it request the bonjour service and is able to find all YUN on the same network.
You've got cause and effect backwards. It does not resolve the address locally, then request the bonjour service. Bonjour is the service that locally resolves the address.
"Bonjour" is French for "Hello." (OK, it literally translates to "good day" but it's commonly used as a greeting.) Bonjour is an implementation of mDNS, a way for computers to greet each other and locally identify themselves. Computers identify themselves by sending out broadcast messages with their name and address. Other computers receive that broadcast and make note of it.
In this case, the Yun is periodically sending out a broadcast that essentially says "Hello, my name is arduino.local, and I'm at aaa.bbb.ccc.ddd." Your computer receives that, and makes an entry into its address resolution file. The IDE also adds an entry to its port menu.
Of course if you are Wifi connected to YUN it works, but when you connect YUN to your LAN and if your main DHCP/DNS server is not the YUN it does not work every time.
In my case it's exactly the opposite: when the Yun is WiFi only, I can't use arduino.local from my computer, but over Ethernet I can. The reason for both our problems is the same, and the reason why our behaviors are different is due to the way things are connected.
As just discussed, finding arduino.local (and showing up in the port menu) depends on your computer receiving broadcasts from the Yun. Broadcasts generally only travel on one network segment; they tend not to make hops through bridges or routers. In my case, my computer is on the wired Ethernet, and I have a bridge to a wireless network. When the Yun is only on the a WiFi network, the broadcasts don't make it to the Ethernet network, so my computer can't resolve arduino.local. It can still access the Yun by its address (since addressed packets do make the jump through bridges and routers) but it can't find the name and it doesn't show up on the IDE port menu. If I connect the Yun to Ethernet, then it is on the same network segment, the broadcasts go through, and I can access it by name and from the IDE.
Now, for your case, I'm assuming your computer is on the wireless network. When the Yun is also on the wireless, the broadcasts go through, and everything works. When the Yun is on Ethernet, the broadcasts don't make the hop between network segments, and now you have your issues.