当前位置:网站首页>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 .
边栏推荐
猜你喜欢

关联GIS:条条道路通UE5城

枚举?构造器?面试Demo

How Oracle converts strings to multiple lines

That is, a one-stop live broadcast service with "smooth live broadcast" and full link upgrade
![[batch dos-cmd command - summary and summary] - parameters%0,%1,%2,%[0-9],%0-9 in the batch command and batch command parameter position switching command shift, operator% usage in the DOS command](/img/05/19299c47d54d4ede95322b5a923093.png)
[batch dos-cmd command - summary and summary] - parameters%0,%1,%2,%[0-9],%0-9 in the batch command and batch command parameter position switching command shift, operator% usage in the DOS command

MySQL lock details

并发编程JUC的AQS底层源码

Reference | upgrade win11 mobile hotspot can not be opened or connected

Read datasets iteratively with xgboost

MySQL锁详解
随机推荐
A classic interview question covering 4 hot topics
并发编程JUC的AQS底层源码
【原创】TypeScript字符串utf-8编码解码
100% understanding of 5 IO models
Redis transactions
Chapter 11 signal (I) - concept
lvgl 说明3关于lvgl guider的使用
ZABBIX deployment instructions (server+win client + switch (H3C))
Filter filter
Reference | upgrade win11 mobile hotspot can not be opened or connected
JS EventListener
数字IC-1.9 吃透通信协议中状态机的代码编写套路
[MySQL basic] general syntax 1
oracle用一条sql查出哪些数据不在某个表里
SIG associé: toutes les routes mènent à ue5
【每日一练】产品卡片动画效果的实现
Five basic types of redis
All tutor information on one page
Object contains copy method?
JVM层次上的对象的创建过程和内存布局