当前位置:网站首页>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 .
边栏推荐
- Modify the contents of /etc/crontab file directly, and the scheduled task will not take effect
- Zabbix部署说明(Server+Win客户端+交换机(H3C))
- Fake constructor???
- SIG associé: toutes les routes mènent à ue5
- Redis主从复制以及哨兵模式
- Coggle 30 days of ML July competition learning
- All tutor information on one page
- Rust async: SMOL source code analysis -executor
- 参考 | 升级 Win11 移动热点开不了或者开了连不上
- 数字IC-1.9 吃透通信协议中状态机的代码编写套路
猜你喜欢
随机推荐
March into machine learning -- Preface
【每日一练】产品卡片动画效果的实现
Lvgl GUI guide porting code to stm32
See how much volatile you know
多网络设备存在时,如何配置其上网优先级?
关于放大器失真的原因你了解多少呢?
ZABBIX deployment instructions (server+win client + switch (H3C))
Summary of three basic interview questions
Lvgl description 3 about the use of lvgl Guide
Analysis of key technologies for live broadcast pain points -- second opening, clarity and fluency of the first frame
RMAN-08137 主库无法删除归档文件
oracle用一条sql查出哪些数据不在某个表里
Lvgl usage demo and instructions 2
That is, a one-stop live broadcast service with "smooth live broadcast" and full link upgrade
Rough reading DS transunet: dual swing transformer u-net for medical image segmentation
MATLAB小技巧(18)矩阵分析--熵权法
AQS underlying source code of concurrent programming JUC
我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!
Redis五种基本类型
Read datasets iteratively with xgboost









