当前位置:网站首页>When multiple network devices exist, how to configure their Internet access priority?
When multiple network devices exist, how to configure their Internet access priority?
2022-06-27 08:32:00 【Wuhan Vientiane Aoke】
Common Internet peripherals include wired Ethernet 、WIFI、4G/5G Such as the interface , A hardware motherboard often carries multiple networks to access hardware resources . How to configure the use priority of different network peripherals ? This article will introduce you to Linux Common configuration methods under the system .
Test environment :HDG2L-IOT Assessment Kit , Equipped with dual Gigabit network 、4G CAT1 module ; function Ubuntu System , Kernel version 5.10 . See the following for specific operation steps .

chart 1 HDG2L-IOT Kit
1、 obtain IP Address
Network device acquisition IP Address . Fix IP Skip this step in mode , Automatically IP Perform the following operations in mode .
- Connect Ethernet ,wifi Connect to the network
- Use udhcpc -i eth0 -q command , Let the ether automatically find IP
- Enter into /home/wifi Catalog , perform wifi.sh, Give Way wifi Access router ; One gigabit network port is normally connected to the router .
2、 View the routing information table
Use route Command to view routing information , You can see Ethernet eth0 and wifi The Internet wlan0 The routing information of is generated automatically , And there are two default gateways . If you visit the Internet , The system will be based on the principle of optimal routing cache information and speed , Access through faster gateways .

chart 2 Routing table
3、 Modify gateway priority
Linux The system supports setting the priority of the default gateway , You need to use mteric This parameter . When there are multiple default gateways in the system , Packets will pass metric Lower interface transport , Usually , default metric All for 0, So the priority is the same .
Configure gateway priority is to configure the priority of network devices metric value , Let's do this for eth0 and wlan0 Set priorities separately .
- First of all, will metric The value is 0 The default gateway for is deleted :

- Then reset the default gateway and metric:

- Finally using route Command view gateway , You can see wifi Of wlan0 And the ether eth0 Of metric The values of are 10 and 20, Configuration priority succeeded .

chart 3 Priority configuration
4、 Verification priority
There are many ways to verify priorities , Here is an easy-to-use method .
Use ping 114.114.114.114 -I wlan0 and ping 114.114.114.114 -I eth0 Commands can be obtained separately wlan0、eth0 Network delay , Use ping 114.114.114.114 You can get the network delay of the current default Internet device , The comparison of the two values can verify the configuration conclusion .
Be careful : This method has limitations ,wlan0、eth0 Do not use this method when the network delay of is approaching .
边栏推荐
- ZABBIX deployment instructions (server+win client + switch (H3C))
- Filter filter
- ThreadLocal digs its knowledge points again
- 内存泄露的最直接表现
- [batch dos-cmd command - summary and summary] - environment variables, path variables, search file location related instructions - set, path, where, what if there are spaces in the path parameters of
- 正确的理解MySQL的MVCC
- MySQL lock details
- SPARQL basic introductory exercise
- 一种太阳能电荷泵供电电路的方案设计
- 冒牌构造函数???
猜你喜欢
随机推荐
冒牌构造函数???
浏览器的markdown插件显示不了图片
See how much volatile you know
2022.6.26-----leetcode.710
Eight misunderstandings, broken one by one (final): the cloud is difficult to expand, the customization is poor, and the administrator will lose control?
使线程释放锁资源的操作/方法重载一点注意事项
静态代码块Vs构造代码块
ThreadLocal再次挖掘它的知识点
2022.06.26 (LC Luo 6101 Luo determines whether the matrix is an X matrix)
MySQL环境变量配置的教程
[original] typescript string UTF-8 encoding and decoding
100% understanding of 5 IO models
即构「畅直播」,全链路升级的一站式直播服务
webrtc入门:12.Kurento下的RtpEndpoint和WebrtcEndpoint
JVM常见的垃圾收集器
【每日一练】产品卡片动画效果的实现
2022.6.26-----leetcode. seven hundred and ten
[batch dos-cmd command - summary and summary] - environment variables, path variables, search file location related instructions - set, path, where, what if there are spaces in the path parameters of
Rust async: SMOL source code analysis -executor
内存泄露的最直接表现








