<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[linux设置优先使用网络]]></title><description><![CDATA[<p dir="auto">需求：网卡和有限同时存在，有限使用网卡进行上网</p>
<p dir="auto">解决方案：</p>
<h3>找出网卡的ip</h3>
<pre><code>$ route -n

目标            网关            子网掩码        标志  跃点   引用  使用 接口
0.0.0.0         192.168.0.1     0.0.0.0         UG    100    0        0 enp2s0
0.0.0.0         192.168.43.1    0.0.0.0         UG    600    0        0 wlx488ad24da84d
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlx488ad24da84d
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-33ef4c5f1f95
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 enp2s0
192.168.43.0    0.0.0.0         255.255.255.0   U     600    0        0 wlx488ad24da84d
</code></pre>
<h3>看到 enp2s0（有线）wlx488ad24da84d（网卡）看到网卡活跃点600，设置网卡的活跃点</h3>
<h4>删除</h4>
<pre><code>$ sudo ip route del default via 192.168.43.1
</code></pre>
<h4>新增</h4>
<pre><code>$ sudo ip route add default via 192.168.43.1 metric 80
</code></pre>
<h4>查看</h4>
<pre><code>$ route -n
目标            网关            子网掩码        标志  跃点   引用  使用 接口
0.0.0.0         192.168.43.1    0.0.0.0         UG    80     0        0 wlx488ad24da84d
0.0.0.0         192.168.0.1     0.0.0.0         UG    100    0        0 enp2s0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlx488ad24da84d
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-33ef4c5f1f95
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 enp2s0
192.168.43.0    0.0.0.0         255.255.255.0   U     600    0        0 wlx488ad24da84d
</code></pre>
]]></description><link>http://an.forum.genostack.com/topic/934/linux设置优先使用网络</link><generator>RSS for Node</generator><lastBuildDate>Sat, 13 Jun 2026 12:33:52 GMT</lastBuildDate><atom:link href="http://an.forum.genostack.com/topic/934.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 30 Jun 2023 02:49:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to linux设置优先使用网络 on Fri, 30 Jun 2023 07:39:13 GMT]]></title><description><![CDATA[<p dir="auto">sudo ip route replace default via 192.168.43.1 metric 80</p>
]]></description><link>http://an.forum.genostack.com/post/2240</link><guid isPermaLink="true">http://an.forum.genostack.com/post/2240</guid><dc:creator><![CDATA[zhangfanglin]]></dc:creator><pubDate>Fri, 30 Jun 2023 07:39:13 GMT</pubDate></item></channel></rss>