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
You need to disable wireless network when you connect by Ethernet.
Any OS and Ubuntu has a routing table where rules are set up where to send packets in order to reach Internet or specific network segments.
If your wireless network is enabled, default route is set up to wireless interface and you can't get access to Internet.
General rule is that you can't use more than one network interface in a system without setting up routing.
Best Answer
You can plug both in at the same time and be connected to both, but you can only use the Internet from one of them. The computer will prefer the cable.
So if you only have Internet access via one of them then yes you can be connected to both networks. But if both are capable of providing Internet access, then Ubuntu will prefer the cable (Ethernet) network to access the Internet (and not use the Wifi network to access the Internet).
The upside of using two connections that provide Internet access, is that if one is disconnected, you will keep on using the Internet without being affected.
I have asked a similar question on the site before, that you might find useful.