开发板通过网线连接电脑而上网

简介

关闭win11的防火墙(之前不关也可以的,很奇怪)
一句话:!!!dhcp能自动分配IP即可联通外网!!!
原理也不懂,或许有其他方法也不清楚,但只要在/etc/netplan/01-netcfg.yaml设置dhcp: true利用netplan自动分配ip则可解决所有ping外网不通、git访问不了,apt-get出现Err:1 http://mirrors.163.com/ubuntu-ports focal InRelease Temporary failure resolving 'mirrors.163.com'错误等等问题.

电脑WIFI共享给网口

在这里插入图片描述

在这里插入图片描述

route

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         orange.mshome.n 0.0.0.0         UG    100    0        0 eth0
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 eth0
192.168.137.0   0.0.0.0         255.255.255.0   U     100    0        0 eth0
192.168.137.0   0.0.0.0         255.255.255.0   U     100    0        0 eth0

link
路由表的问题

/etc/netplan/01-netcfg.yaml

# this file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: NetworkManager
  # renderer: networkd
  ethernets:
    eth0:
      dhcp4: true
      addresses: [192.168.137.23/24]
      gateway4: 192.168.137.1
      nameservers:
        addresses: [114.114.114.114, 192.168.137.1]

设置dhcp: true利用netplan自动分配ip的同时设置一个静态ip来实现ssh访问,而不用每次都是用串口来查看ip才能登录。
link:

  • 1
  • 2
  • 3
  • 校园网:(1) (2)

/etc/resolv.conf

自动生成的,dhcp不能分配IP时添加常见的DNS都不行!!

# Generated by NetworkManager
search mshome.net
nameserver 127.0.0.53

/etc/systemd/resolved.conf

#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
DNS=114.114.114.114
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=yes
#DNSStubListener=yes
#ReadEtcHosts=yes

虚拟机

若想虚拟机ping开发板,参考这个应该可以。

测试

开启win11防火墙

重新开启防火墙,reboot重启开发板

# # # 查看ifconfig 没问题 # # # 
root@rong-virtual-machine:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.137.155  netmask 255.255.255.0  broadcast 192.168.137.255
        ether 00:22:33:44:55:66  txqueuelen 1000  (Ethernet)
        RX packets 115  bytes 20392 (20.3 KB)
        RX errors 0  dropped 13  overruns 0  frame 0
        TX packets 117  bytes 13373 (13.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 87  base 0x2000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 248  bytes 19900 (19.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 248  bytes 19900 (19.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
# # # 155为dhcp分配的ip 23为设置的静态ip # # #
root@rong-virtual-machine:~# hostname -I
192.168.137.155 192.168.137.23
# # # ping外网ip # # #
root@rong-virtual-machine:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=100 time=70.1 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=100 time=76.1 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=100 time=70.9 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 70.093/72.364/76.065/2.639 ms
# # # ping百度域名 # # #
root@rong-virtual-machine:~# ping www.baidu.com
PING www.a.shifen.com (120.232.145.185) 56(84) bytes of data.
64 bytes from 120.232.145.185 (120.232.145.185): icmp_seq=1 ttl=51 time=10.3 ms
64 bytes from 120.232.145.185 (120.232.145.185): icmp_seq=2 ttl=51 time=13.4 ms
64 bytes from 120.232.145.185 (120.232.145.185): icmp_seq=3 ttl=51 time=11.6 ms
^C
--- www.a.shifen.com ping statistics ---
4 packets transmitted, 3 received, 25% packet loss, time 9272ms
rtt min/avg/max/mdev = 10.289/11.751/13.409/1.281 ms

😨 😨 😨 居然没问题 😨 😨 😨
但是要ping通主机,还是需要打开防火墙才行

自测(插回电脑网口)

怀疑是电脑网口坏了,折腾了两天都不行,换到拓展坞的网口上,吃了个饭回来就好了😢 😢 😢
简介中的图片所示的以太网 2即拓展坞网口
更改为电脑上的以太网
在这里插入图片描述
重启开发板

root@rong-virtual-machine:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.137.207  netmask 255.255.255.0  broadcast 192.168.137.255
        ether 00:22:33:44:55:66  txqueuelen 1000  (Ethernet)
        RX packets 93  bytes 14302 (14.3 KB)
        RX errors 0  dropped 13  overruns 0  frame 0
        TX packets 81  bytes 8422 (8.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 87  base 0x2000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 184  bytes 14969 (14.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 184  bytes 14969 (14.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@rong-virtual-machine:~# hostname -I
192.168.137.207
root@rong-virtual-machine:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=100 time=71.7 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=100 time=71.0 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=100 time=76.4 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=100 time=71.9 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 71.020/72.746/76.352/2.108 ms
root@rong-virtual-machine:~# ping www.baidu.com
PING www.a.shifen.com (120.232.145.144) 56(84) bytes of data.
64 bytes from 120.232.145.144: icmp_seq=1 ttl=51 time=13.6 ms
64 bytes from 120.232.145.144: icmp_seq=2 ttl=51 time=14.1 ms
64 bytes from 120.232.145.144: icmp_seq=3 ttl=51 time=12.1 ms
64 bytes from 120.232.145.144: icmp_seq=4 ttl=51 time=11.6 ms
^C
--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 12028ms
rtt min/avg/max/mdev = 11.586/12.857/14.089/1.029 ms

其中

root@rong-virtual-machine:~# hostname -I
192.168.137.207

只显示一个ip了,netplan配置文件中的静态ip没了

无静态ip

尝试执行netplan apply,静态ip生效,但是另一个又变回之前的155了 😳 😳 😳

root@rong-virtual-machine:~# netplan apply
root@rong-virtual-machine:~# hostname -I
192.168.137.155 192.168.137.23

老天爷 为什么 😭 😭 😭
what can I say!!

再次reboot

再次重启开发板

root@rong-virtual-machine:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.137.155  netmask 255.255.255.0  broadcast 192.168.137.255
        ether 00:22:33:44:55:66  txqueuelen 1000  (Ethernet)
        RX packets 96  bytes 14248 (14.2 KB)
        RX errors 0  dropped 12  overruns 0  frame 0
        TX packets 90  bytes 9701 (9.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 87  base 0x2000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 184  bytes 15321 (15.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 184  bytes 15321 (15.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@rong-virtual-machine:~# hostname -I
192.168.137.155 192.168.137.200 192.168.137.23

出现了3个ip
执行netplan apply

root@rong-virtual-machine:~# netplan apply
root@rong-virtual-machine:~# hostname -I
192.168.137.155 192.168.137.23
root@rong-virtual-machine:~#

无敌了。兄弟 😮 😮 😮

开发板断电

root@rong-virtual-machine:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.137.155  netmask 255.255.255.0  broadcast 192.168.137.255
        ether 00:22:33:44:55:66  txqueuelen 1000  (Ethernet)
        RX packets 167  bytes 23894 (23.8 KB)
        RX errors 0  dropped 11  overruns 0  frame 0
        TX packets 156  bytes 15179 (15.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 87  base 0x2000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 38  bytes 3871 (3.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 38  bytes 3871 (3.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@rong-virtual-machine:~# hostname -I
192.168.137.155 192.168.137.71 192.168.137.23
root@rong-virtual-machine:~# netplan apply
root@rong-virtual-machine:~# hostname -I
192.168.137.155 192.168.137.23

搞不懂了 😦 😦 😦

可以上网

root@rong-virtual-machine:~# wget zhihu.com
--2024-04-24 21:21:36--  http://zhihu.com/
Resolving zhihu.com (zhihu.com)... 103.41.167.234
Connecting to zhihu.com (zhihu.com)|103.41.167.234|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.zhihu.com/ [following]
--2024-04-24 21:21:36--  https://www.zhihu.com/
Resolving www.zhihu.com (www.zhihu.com)... 120.240.101.173, 111.45.69.246, 183.240.47.143, ...
Connecting to www.zhihu.com (www.zhihu.com)|120.240.101.173|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: //www.zhihu.com/signin?next=%2F [following]
--2024-04-24 21:21:36--  https://www.zhihu.com/signin?next=%2F
Reusing existing connection to www.zhihu.com:443.
HTTP request sent, awaiting response... 200 OK
Length: 40094 (39K) [text/html]
Saving to: ‘index.html’

index.html          100%[===================>]  39.15K  --.-KB/s    in 0.1s

2024-04-24 21:21:37 (271 KB/s) - ‘index.html’ saved [40094/40094]

断电后拔插网线

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/573461.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

采用php vue2 开发的一套医院安全(不良)事件管理系统源码(可自动生成鱼骨图)

采用php vue2 开发的一套医院安全&#xff08;不良&#xff09;事件管理系统源码&#xff08;可自动生成鱼骨图&#xff09; 医院安全&#xff08;不良&#xff09;事件管理系统采用无责的、自愿的填报不良事件方式&#xff0c;有效地减轻医护人员的思想压力&#xff0c;以事件…

项目上线流程(保姆级教学)

01&#xff1a;注册阿里云账户 02&#xff1a;登录阿里云 03&#xff1a;在桌面新建记事本保存个人账号密码等信息 04&#xff1a;完成重置密码 05&#xff1a;安装宝塔面板 命令行 yum install -y wget && wget -O install.sh http://download.bt.cn/install/instal…

Maya vs Blender:制作3D动画首选哪一个?

就 3D 动画而言&#xff0c;有两款3D软件引发了最多的争论&#xff1a;Blender 与 Maya。这两个强大的平台都提供强大的工具集&#xff0c;使动画故事和角色栩栩如生。但作为一名3D动画师&#xff0c;您应该投入时间学习和创作哪一个呢&#xff1f;下面我将从以下六点给您一个清…

spring boot中的标注@Component、@Service等

让我告诉你什么叫水货。 一、水货横行 一直以来&#xff0c;我对Spring Boot项目中的标注&#xff0c;像Component啦、Service啦、Configuration啦&#xff0c;甚至Autowired啦&#xff0c;等等&#xff0c;都似懂非懂。Autowired与Resource有什么区别也不清楚。 个中原因&a…

分享:抖音阳哥说的人力RPO项目有哪些优势?

在数字化浪潮的推动下&#xff0c;人力资源行业也迎来了前所未有的变革。抖音平台上&#xff0c;阳哥以其独到的见解和丰富的经验&#xff0c;对人力RPO(招聘流程外包)项目进行了深入解读。今天&#xff0c;我们就来探讨一下人力RPO项目究竟有哪些优势。 人力RPO项目的一大优势…

get和post的区别?get不安全-post安全|面试官:好,你走吧

get和post的区别&#xff1f;get不安全-post安全|面试官&#xff1a;好&#xff0c;你走吧 开个小玩笑&#xff0c;面试官肯定是想知道更详细的内容&#xff0c;那面下面就是相对详细的内容&#xff0c;请收下吧(*&#xffe3;︶&#xffe3;) 1、url可见性 get&#xff0c;参…

瀑布VS敏捷,看看哪种研发管理模式更适合你的团队

软件开发是一个复杂且极具挑战性的过程&#xff0c;需要有合适的研发管理模式。瀑布模型和敏捷开发是两种常见的研发管理模式&#xff0c;它们在项目管理和团队合作方面有着截然不同的理念和实践方式。本文将介绍这两种开发模式的特点、优缺点及对比&#xff0c;提供如何选择适…

【论文速读】|大语言模型(LLM)智能体可以自主利用1-day漏洞

本次分享论文&#xff1a; LLM Agents can Autonomously Exploit One-day Vulnerabilities 基本信息 原文作者&#xff1a;Richard Fang, Rohan Bindu, Akul Gupta, Daniel Kang 作者单位&#xff1a;无详细信息提供 关键词&#xff1a;大语言模型, 网络安全, 1-day漏洞, …

“我也想和月牙一样,把不满写在脸上”

贪吃蛇的初级实现 1. Win32 API介绍1.1 Win32 API1.2 控制台程序1.3 控制台屏幕上的坐标COORD1.4 GetStdHandle1.5 GetConsoleCursorInfo1.5.1 CONSOLE_CURSOR_INFO 1.6 SetConsoleCursorInfo1.7 SetConsoleCursorPosition1.8 GetAsyncKeyState 2. 贪吃蛇游戏设计与分析2.1 地图…

替换windows11 c:/windows/system32/下的dll

找到注册表中的这一项 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\icssvc\Settings 添加 WifiMaxPeers dword 值 32位 最大值是128 设置完成后重启icssvc服务 sc stop icssvc sc start icssvc 由于win11不小心装了preview版本&#xff0c;貌似这个8个最大的已经限定…

输入influx但是无法进入influxdb

问题描述&#xff1a; 博主想通过DockerJmeterInfluxDBGrafana搭建性能测试可视化平台&#xff0c;但是按照别的教程输入influx却无法进入inluxdb&#xff0c;输入输出如下&#xff1a; NAME:influx - Influx ClientUSAGE:influx [command]HINT: If you are looking for the I…

Cgicc搭建交叉编译环境(移植到arm)

Cgicc GUN Project官网连接&#xff1a;Cgicc- GNU Project - Free Software Foundation 1. 下载源码 Cgicc下载地址&#xff1a; [via http] Index of /gnu/cgicc [via FTP] ftp://ftp.gnu.org/gnu/cgicc/ 目前最新版&#xff1a;3.2.20 2. 源码构建原理 一般&#xff…

冰箱、保险柜门不要对准外面

风水真的和我们的生活息息相关&#xff0c;它会影响到我们的事业财运、婚姻感情、健康平安等等。很多人在不知情的情况下&#xff0c;触犯了风水里的禁忌&#xff0c;那结果可想而知&#xff01; 峰民特别提示您&#xff1a;千万不要将冰箱、保险柜的门对准外面。冰箱是不能与…

虚拟化与Docker基本概念与Docker的安装

Docker Docker 是一个开源的应用容器引擎&#xff0c;它最初是用 Go 语言开发的。Docker 允许开发者将应用程序及其依赖、库和环境打包到一个可移植的容器中&#xff0c;这个容器可以在任何支持 Docker 的 Linux 或 Windows 机器上运行&#xff0c;保证了应用在不同环境之间的…

JdbcTemplate详解

1 概述 为了使JDBC更加易于使用&#xff0c;Spring在JDBC API上定义了一个抽象层&#xff0c;以此建立一个JDBC存取框架。 作为Spring JDBC框架的核心&#xff0c;JDBC模板的设计目的是为不同类型的JDBC操作提供模板方法&#xff0c;通过这种方式&#xff0c;可以在尽可能保留…

主食冻干哪个国家的好?全网热销款品控好的主食冻干必买

主食冻干哪个国家的好&#xff1f;谈及主食冻干哪款好&#xff0c;进口的主食冻干总是能被提名。不论是在哪个电商平台搜索“主食冻干”&#xff0c;都会发现那些备受推崇是进口主食冻干。从销售数据上看&#xff0c;这些进口冻干在大型促销活动如双11、618中的销量一直居高不下…

【面试题】java后端开发实习(含答案)

java后端开发实习生-常见面试题 1&#xff09;JDK,JRE,JVM的关系 JDK JRE java开发工具JRE JVM java核心类库 2&#xff09;String类的常用方法 1.关于字符串获取方面 length 获取长度charAt 获取指定索引的字符indexOf 获取字符所在的索引位置lastIndexOf 获取字符所在…

printjs打印表格的时候多页的时候第一页出现空白

现象&#xff1a;打印多页的时候第一页空白了&#xff0c;一页的时候没有问题 插件&#xff1a;printjs 网上搜索半天找到的方式解决&#xff1a; 1. 对于我这次的现象毫无作用。其他情况不得而知&#xff0c;未遇见过。&#xff08;这个应该是大家用的比较多的方式&#xf…

像人脑一样工作!在量子计算机上运行强大的人工智能

内容来源&#xff1a;量子前哨&#xff08;ID&#xff1a;Qforepost&#xff09; 文丨王珩 浪味仙 排版丨沛贤 深度好文&#xff1a;2500字丨8分钟阅读 摘要&#xff1a;Transformer 确实可以在简单的量子硬件上工作&#xff0c;这至少从理论上表明&#xff1a;量子人工智能的…

库存数据可视化分析按这个做,赚大了!

今天我们来看一张库存数据可视化分析驾驶舱&#xff0c;全面了解库存资金占用情况&#xff0c;物料周转情况&#xff0c;库存趋势情况、以及占库存金额最高的商品有哪些等。 为更好地实现以上效果&#xff0c;并且增强报表的可读性、易读性&#xff0c;我们采用了按分析场景选…