红联Linux门户
Linux帮助

linux连接树莓派

发布时间:2017-03-25 10:08:58来源:linux网站作者:Android_chunhui
之前发现ubuntu老是连不上树莓派,后来将连接设备选择有线网卡(可通过ifconfig查询),连接方式从DHCP 改成本地连接,因为只是网络设备连入,并不是接入网络嘛。提示连接成功
linux连接树莓派
 
通过ifconfig查看电脑所有网络设备,主要是看网卡号。
$ifconfig
ens4  Link encap:以太网  硬件地址 00:15:58:cc:5d:91  
    inet6 地址: fe80::8405:a301:8db7:ded8/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST  MTU:1500  跃点数:1
    接收数据包:164 错误:0 丢弃:0 过载:0 帧数:0
    发送数据包:1320 错误:0 丢弃:0 过载:0 载波:0
    碰撞:0 发送队列长度:1000 
    接收字节:51019 (51.0 KB)  发送字节:246643 (246.6 KB)
    中断:18
lo   Link encap:本地环回  
...
 
然后查看该网卡下所有连接的ip地址。
$arp-scan -interface ens4 --localnet
Interface: ens4, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.8.1 with 65536 hosts (http://www.nta-monitor.com/tools/arp-scan/)
169.254.149.126 b8:27:eb:49:95:34   (Unknown)
1 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.8.1: 65536 hosts scanned in 262.927 seconds (249.26 hosts/sec). 1 responded
 
一般来说,这个硬件地址是b8:27:eb的就是树莓派了。
 
通过ssh连接树莓派:
ssh 用户名@ip
$ssh pi@169.254.149.126
The authenticity of host '169.254.149.126 (169.254.149.126)' can't be established.
ECDSA key fingerprint is SHA256:8I40FaaQKTx4FbblEm3y/3CX0R+rnt7u8Pnm4bo69WY.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '169.254.149.126' (ECDSA) to the list of known hosts.
pi@169.254.149.126's password: 
 
输入密码(默认raspberry)就可以连接了。
 
本文永久更新地址:http://www.linuxdiyf.com/linux/29466.html