树莓派双网卡在不同网段下冲突

树莓派,wlan0连10网段,该网段能通外网,eth0连192网段,该网段不能通外网。

当只连wlan的时候一切正常,当同时插网线的时候不能访问且树莓派无法curl到公网。

 

发现当wlan和eth0同时接通时候默认路由自动加了一条道eth0。

解决方法:修改dhcpcd.conf

interface eth0
nogateway
static ip_address=192.168.1.20/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.1.1
#static domain_name_servers=114.114.114.114

interface wlan0
static ip_address=10.252.33.93/24
static routers=10.252.33.1
static domain_name_servers=223.5.5.5

 

posted @ 2020-12-28 18:45  ellennet123  阅读(687)  评论(0)    收藏  举报