{"id":615,"date":"2018-07-04T10:35:40","date_gmt":"2018-07-04T08:35:40","guid":{"rendered":"http:\/\/itso.dk\/?p=615"},"modified":"2018-07-04T11:11:53","modified_gmt":"2018-07-04T09:11:53","slug":"ubuntu-select-primary-network-interface","status":"publish","type":"post","link":"https:\/\/blog.itso.dk\/?p=615","title":{"rendered":"Ubuntu \u2013 Select Primary network interface"},"content":{"rendered":"<p>Sometimes you want to have a default primary interface or network configured.<\/p>\n<p>Most modern Linux distributions, like ubuntu today uses Network-Manager. You can control that from the terminal using either nmcli og nm-tui<\/p>\n<p>To display current connections configured, with priority:<\/p>\n<pre>nmcli -f NAME,UUID,AUTOCONNECT,AUTOCONNECT-PRIORITY c<\/pre>\n<p>To display the primary route to the internet<\/p>\n<pre>route -n<\/pre>\n<p>You can set a temporary connection priority, by install ifmetric. (Lower number is higher priority)<\/p>\n<pre>apt install ifmetric\r\nifmetric wlp6s0 50<\/pre>\n<p>For a more permanent fix, i have chosen to write the above command, and run it as a service.<\/p>\n<pre>\/etc\/systemd\/system\/ifmetric.service\r\n\r\n[Unit]\r\nDescription= Set ifmetric to use WIFI as primary route\r\nAfter=multi-user.target\r\n[Service]\r\nType=forking\r\nUser=root\r\nExecStart=\/bin\/setwifidefault<\/pre>\n<p>Then create a script in \/bin<\/p>\n<pre>\/bin\/setwifidefault\r\n\r\n#!\/bin\/sh\r\nifmetric wlp6s0 50<\/pre>\n<p>Make the script executable<\/p>\n<pre>chmod +x \/bin\/setwifidefault<\/pre>\n<p>Enable the script at startup<\/p>\n<pre>systemctl enable ifmetric.service<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you want to have a default primary interface or network configured. Most modern Linux distributions, like ubuntu today uses Network-Manager. You can control that from the terminal using either nmcli og nm-tui To display current connections configured, with priority: nmcli -f NAME,UUID,AUTOCONNECT,AUTOCONNECT-PRIORITY c To display the primary route to the internet route -n You &#8230;<\/p>\n<p><a href=\"https:\/\/blog.itso.dk\/?p=615\" class=\"more-link\">Continue reading &lsquo;Ubuntu \u2013 Select Primary network interface&rsquo; &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":528,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-615","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-tip"],"_links":{"self":[{"href":"https:\/\/blog.itso.dk\/index.php?rest_route=\/wp\/v2\/posts\/615","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.itso.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.itso.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.itso.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.itso.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=615"}],"version-history":[{"count":7,"href":"https:\/\/blog.itso.dk\/index.php?rest_route=\/wp\/v2\/posts\/615\/revisions"}],"predecessor-version":[{"id":622,"href":"https:\/\/blog.itso.dk\/index.php?rest_route=\/wp\/v2\/posts\/615\/revisions\/622"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.itso.dk\/index.php?rest_route=\/wp\/v2\/media\/528"}],"wp:attachment":[{"href":"https:\/\/blog.itso.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.itso.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.itso.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}