Ubuntu – use Wi-Fi and cable (Ethernet) networking at same time

networkingwireless

I am on an intranet that is not connected to the Internet and a Wi-Fi router with connection to the Internet. When I am connected to the wireless network, I can browse the Internet, but I cannot browse my LAN with my Ethernet cable connected.

How can I browse the Internet via my Wi-Fi router and at the same time browse my local LAN web application via my connected Ethernet cable?

Best Answer

You sure can. You didn't specify it, but I'm assuming you get the IP address automatically (via DHCP) both on wireless and wired connection.

Wired Ethernet is faster than wireless, so if there are two ways to get somewhere, wired will takes precedence over Wi-Fi by default. With that said, when you connect to both links, both DHCP servers by default will advertise themselves as the default gateway for all of the traffic.

So now your computer thinks it has two ways to connect to the Internet, and since wired is preferred it'll send traffic for the Internet via Ethernet. If that's the case, you would see two gateways for default networks 0.0.0.0 in your routing table, route -n, one with your wireless router as a gateway and one for the wired.

But the Metric for the Ethernet gateway would be lower than wireless, so your PC will send the packets there. Now that your Ethernet router gets them, it doesn't know what to do with them, so it just drops them. The order where you connected first shouldn't matter.

As far as fixing (this assumes the DHCP case), the correct way would be to tell the LAN router to stop advertising itself as the default gateway. You need to log in to the router and look through settings. If you have no control over the router, you can remove it from your end with:

route del default gw eth.router.ip.address