My HTPC has a wireless and a wired connection. When I start ubuntu both get an IP-adress. I don't see any inherent problem with this, but XBMC seems to default to the wireless, even if the wired is available.
How can I force precedence of the wired connection above the wireless?
- I'm not looking to shutdown/disable the wireless: I do use both, but not at the same time per se.
- There shouldn't be any interaction for this, as I don't have a keyboard connected. Currently I ssh to the box to shut down wireless manually if needed, but that's ridiculous :)
Basically what I expected was that when the wired connection gets an IP, the wireless releases it's connection, and as soon as the wired IP is gone, wireless comes in again. But that doesn't seem to happen :(
You can create a script and put it in the
/etc/NetworkManager/dispatcher.d
folder; the scripts in that folder will be executed every time a connection is (dis)established. The number with which you start the filename determines the order of execution, so we will give our script the number 99 to make sure that it is executed last.Run the following command in a terminal
then copy the following, save and close.
you should replace "eth0" with your network device (e.g., the one you see when you type
ifconfig
. it could be "eth1" for instance).Make the script executable by running
Now if a wired connection is established the wireless will be turned off, if the wired connection is disestablished the wireless will be turned back on.
Acknowledgment: credit to this superuser answer,