Yun not connecting to Internet through Ethernet wired connection: Please observe

Hi Federico & All,

When I tried to connect Yun using Ethernet wire to Yun, Status says, Connected, but I am unable to Ping to any websites in the internet. How do I ensure Linino is connected to Internet?

I am using Putty ( windows) to telnet into to Yun. Please find the attached status of Arduino and ifconfig output.

My intention is to run
opkg update
opkg install openssh-sftp-server
Yun is not able to access the http://download.linino.org ( Attchecd screen shot for fYI)

Any help is highly appreciated and thanking you in advance.

Regards,

BREL

you have different ip ranges on wlan and ethernet
.240.
.1.
both must be in the same range

OttoF:
you have different ip ranges on wlan and ethernet
.240.
.1.
both must be in the same range

Well, strictly speaking, no. But the problem is that you can have an active gateway out of either LAN on only one of them. And it seems that the gateway on the WiFi LAN has a lower metric than then one one the wired LAN...

Ralf

I have the same behaviour reported by BREL when Ethernet is connected to router using DHCP and try to access the Internet fron this LAN Ethernet port regardless of use of the WiFi access point on the YUN.
I'm insted able to connect the Internet from the LAN Ethernet connected to router using DHCP if the WiFi of YUN is connected to the same router as a device.

I tried to solve this issue using "route" configuration but without success.
Can someone suggest a correct configuration to be set ?
Thanks in advance.
Valter.

When the problem exist run root@Arduino:~# route

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0
192.168.0.0     *               255.255.255.0   U     0      0        0 wlan0
192.168.0.0     *               255.255.255.0   U     10     0        0 eth1

eth1 is missing from default Destination.

fix method 1: root@Arduino:~#/etc/init.d/network restart
run root@Arduino:~# route again

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0
default         192.168.0.1     0.0.0.0         UG    10     0        0 eth1
192.168.0.0     *               255.255.255.0   U     0      0        0 wlan0
192.168.0.0     *               255.255.255.0   U     10     0        0 eth1

fix method 2: root@Arduino:~#route add default gw 192.168.0.1 metric 10 eth1

default         192.168.0.1     0.0.0.0         UG    10     0        0 eth1

Hi sonnyyu, thanks for yours suggestions but I tried with the following results :

fix method 1:
root@Arduino:~# /etc/init.d/network restart
root@Arduino:~# route again
... do not work for me as is..

fix method 2:
root@Arduino:~# route add default gw 192.168.0.1 metric 10 eth1
... work fine but use manual/fixed IP for the gateway.

I think anyone that connect eth1 to a router via DHCP hope to have eth1 access to the Internet using the gateway .
It is possible to automatically set route default gateway also on eth1 (not only wlan0) using the IP value of the router received via DHCP at any reboot ?

Thanks for any further suggestions.
Valter

The output of route?

How can I make sure that eth1 connects to the Internet through the router automatically after it has assigned a dynamic IP address?

Thanks for any further suggestions.
Valter

After hours testing, I think I found the problem. My router has DHCP lease time set as 120 mins, if I changes it to 2 mins, My Ethernet lost internet in few mins. It is the problem of Openwrt DHCP Client problem.

The fix is:

nano /lib/netifd/dhcp.script

setup_interface () {
        proto_init_update "*" 1
        proto_add_ipv4_address "$ip" "${subnet:-255.255.255.0}"
        # TODO: apply $broadcast

        for i in $router; do
                proto_add_ipv4_route 0.0.0.0 0 "$i"
                route add -net 0.0.0.0/0 gw "$i"
        done

The credit of OpenWrt Forum Archive

I'm sorry I could reproduce the issue.
I've just reflashed my yun and booted it with ethernet cable plugged in. Once ready, issued a opkg update and worked fine.
route said

root@Arduino:/# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    10     0        0 eth1
192.168.0.0     *               255.255.255.0   U     10     0        0 eth1
192.168.240.0   *               255.255.255.0   U     0      0        0 wlan0

Then I rebooted with ethernet cable UNplugged, issued opkg update and again worked fine. Route said

root@Arduino:/# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.240.0   *               255.255.255.0   U     0      0        0 wlan0

I confirm that eth1 metric is deliberately set to 10 because otherwise you would lose access to the yun just by plugging in the ethernet cable (yun disappearing from the IDE, stuck ssh connection)

Hi Federico,
what exactly you mean with "I've just reflashed my yun and booted it" ?

Thanks, Valter

My yun is the target of several experiments: I meant I've reset it to factory settings

produce the issue: only connect with Ethernet. I change Router's DHCP Address Lease Time from default 120 minutes to few minutes

Now after few minutes, issue shows up.

Thanks for the fix for /lib/netifd/dhcp.script sonnyyu. I was trying to log data to xively.com, but the arduino Yun was dropping the internet connection after a couple of hours. I connected a better power supply and edited /lib/netifd/dhcp.script like you showed and the problems are gone. I admit, I don't know if the better power supply helped too, but now that the problem's gone, I'm not going back to investigate.

Guys, can you just tell me if the above patch is still rocking or if some of you have encountered the issue anyway?

The above patch is positively closed for me.
Regards to all.

This fix is contained into newest yun image

Can you please explain this part? What is the "metric" parameter, how do I set it, and why does it affect IDE connection?

I have no wifi on the old desktop PC I'm using; connecting over ethernet allows me to see SD card contents (so I know connection is working), but Yun IP address does not appear in IDE menu, so I can't upload sketches and web pages.

jumpjack:
and why does it affect IDE connection?

I don't think it should affect the Yun appearing in the IDE. This thread is talking about problems accessing the Internet through a default gateway. You have a different issue, which is strictly limited to the local network, and does not involve the default gateway or the Internet. This thread is not applicable to your issue.

There are many other threads on your issue, this is one: Seeing Yun in IDE Port menu

jumpjack:
Can you please explain this part? What is the "metric" parameter, how do I set it,
...

Metrics are used to determine whether one particular route should be chosen over another