<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: S.Mohammad Emami Razavi</title>
    <description>The latest articles on DEV Community by S.Mohammad Emami Razavi (@emamirazavi).</description>
    <link>https://dev.to/emamirazavi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F394656%2F1d743e19-587d-4ff5-82b4-49098d7d613e.jpeg</url>
      <title>DEV Community: S.Mohammad Emami Razavi</title>
      <link>https://dev.to/emamirazavi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/emamirazavi"/>
    <language>en</language>
    <item>
      <title>How to set metric in OS moderated with NetworkManager</title>
      <dc:creator>S.Mohammad Emami Razavi</dc:creator>
      <pubDate>Mon, 08 Jun 2020 04:16:32 +0000</pubDate>
      <link>https://dev.to/emamirazavi/how-to-set-metric-in-networkmanager-system-4525</link>
      <guid>https://dev.to/emamirazavi/how-to-set-metric-in-networkmanager-system-4525</guid>
      <description>&lt;p&gt;Sometimes we want to have several connections at the same time, one to the ethernet (wired lan) and one other to the wireless router, with two different gateways. In this documentation i describe how to make wireless connection prior to ethernet connection in each linux OS using NetworkManager service to moderate network connections. I've tested these instruction in fedora 31 already.&lt;/p&gt;

&lt;h2&gt;
  
  
  List your connections
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; [m.emami@home ~]$ nmcli connection 
 NAME        UUID                                  TYPE      DEVICE               
 sample1     a16d1a96-2833-4876-a6c2-************  vpn       wlp0s20f0u11 
 bevaght     f46ba9ff-1114-4e79-9c8a-************  wifi      wlp0s20f0u11
 eth1        7648e3eb-c03f-46e9-b24e-************  ethernet  enp2s0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Edit the wireless connection
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[m.emami@home ~]$ nmcli connection edit bevaght

===| nmcli interactive connection editor |===

Editing existing '802-11-wireless' connection: 'bevaght'

Type 'help' or '?' for available commands.
Type 'print' to show all the connection properties.
Type 'describe [&amp;lt;setting&amp;gt;.&amp;lt;prop&amp;gt;]' for detailed property description.

You may edit the following settings: connection, 802-11-wireless (wifi), 802-11-wireless-security (wifi-sec), 802-1x, ethtool, match, ipv4, ipv6, tc, proxy
nmcli&amp;gt; set ipv4.route-metric 10
nmcli&amp;gt; save
nmcli&amp;gt; quit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Edit the ethernet connection
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[m.emami@home ~]$ nmcli connection edit eth1

===| nmcli interactive connection editor |===

Editing existing '802-3-ethernet' connection: 'eth1'

Type 'help' or '?' for available commands.
Type 'print' to show all the connection properties.
Type 'describe [&amp;lt;setting&amp;gt;.&amp;lt;prop&amp;gt;]' for detailed property description.

You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, dcb, sriov, ethtool, match, ipv4, ipv6, tc, proxy
nmcli&amp;gt; set ipv4.route-metric 2000
nmcli&amp;gt; save
nmcli&amp;gt; quit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Restart NetworkManager service
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[m.emami@home ~]$ sudo systemctl restart NetworkManager
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulation! routes related to the WiFi connection (named &lt;code&gt;bevaght&lt;/code&gt;) are prior to routes related to the Ethernet connection (named &lt;code&gt;eth1&lt;/code&gt;)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[m.emami@home ~]$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    10     0        0 wlp0s20f0u11
0.0.0.0         192.168.1.1     0.0.0.0         UG    2000   0        0 enp2s0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>networkmanager</category>
      <category>fedora</category>
      <category>nmcli</category>
      <category>metrics</category>
    </item>
  </channel>
</rss>
