如何在没有显示器的情况下,查看 Raspberry Pi 3的 IP 信息(Raspberry Pi 3 ,IP Address)
1.
如何在没有显示器的情况下,查看 Raspberry Pi 3的 IP 信息(Raspberry Pi 3 ,IP Address)
1
IP Address
Any device connected to a Local Area Network is assigned an IP address.
In order to connect to your Raspberry Pi from another machine using SSH or VNC, you need to know the Pi's IP address. This is easy if you have a display connected, and there are a number of methods for finding it remotely from another machine on the network.
Using the Pi with a display
If you boot to the command line instead of the desktop, your IP address should be shown in the last few messages before the login prompt.
Using the terminal (boot to the command line or open a Terminal window from the desktop), simply type
hostname -I
which will reveal your Pi's IP address.Using the Pi headless (without a display)
It is possible to find the IP address of your Pi without connecting to a screen using one of the following methods:
Router devices list
In a web browser navigate to your router's IP address e.g.
http://192.168.1.1
, which is usually printed on a label on your router; this will take you to a control panel. Then log in using your credentials, which is usually also printed on the router or sent to you in the accompanying paperwork. Browse to the list of connected devices or similar (all routers are different), and you should see some devices you recognise. Some devices are detected as PCs, tablets, phones, printers, etc. so you should recognise some and rule them out to figure out which is your Raspberry Pi. Also note the connection type; if your Pi is connected with a wire there should be fewer devices to choose from.nmap command
The
nmap
command (Network Mapper) is a free and open-source tool for network discovery, available for Linux, Mac OS, and Windows.
To install on Linux, install the
nmap
package e.g.apt-get install nmap
.To install on Mac OS or Windows, see the nmap.org download page.
To use
nmap
to scan the devices on your network, you need to know the subnet you are connected to. First find your own IP address, in other words the one of the computer you're using to find your Pi's IP address:
- On Linux, type
hostname -I
into a terminal window- On Mac OS, go to
System Preferences
thenNetwork
and select your active network connection to view the IP address- On Windows, go to the Control Panel, then under
Network and Sharing Center
, clickView network connections
, select your active network connection and clickView status of this connection
to view the IP addressNow you have the IP address of your computer, you will scan the whole subnet for other devices. For example, if your IP address is
192.168.1.5
, other devices will be at addresses like192.168.1.2
,192.168.1.3
,192.168.1.4
, etc. The notation of this subnet range is192.168.1.0/24
(this covers192.168.1.0
to192.168.1.255
).Now use the
nmap
command with the-sn
flag (ping scan) on the whole subnet range. This may take a few seconds:nmap -sn 192.168.1.0/24Ping scan just pings all the IP addresses to see if they respond. For each device that responds to the ping, the output shows the hostname and IP address like so:
Starting Nmap 6.40 ( http://nmap.org ) at 2014-03-10 12:46 GMT
Nmap scan report for hpprinter (192.168.1.2)
Host is up (0.00044s latency).
Nmap scan report for Gordons-MBP (192.168.1.4)
Host is up (0.0010s latency).
Nmap scan report for ubuntu (192.168.1.5)
Host is up (0.0010s latency).
Nmap scan report for raspberrypi (192.168.1.8)
Host is up (0.0030s latency).
Nmap done: 256 IP addresses (4 hosts up) scanned in 2.41 seconds
Here you can see a device with hostname
raspberrypi
has IP address192.168.1.8
.More tools
Also see lsleases
1. 推荐 windows 下,安装 nmap 软件![下载链接](https://nmap.org/dist/nmap-7.12-setup.exe)
nmap -sn 192.168.1.0/24
实测效果:
1
1
1. https://github.com/raspberrypi/documentation/blob/master/linux/usage/root.md
Root User / Sudo
The Linux operating system is a multi-user operating system which allows multiple users to login and use the computer. To protect the computer (and privacy of other users), users are restricted in what they can do.
Most users are allowed to run most programs, and to save and edit files stored in their own home folder. Normal users are not normally allowed to edit files in other users folders or any of the system files. There is a special user in Linux known as the superuser, which is usually given the username
root
. The superuser has unrestricted access to the computer and can do almost anything.Sudo
You will not normally log into to the computer as root, but can instead use the sudo command to provide access as the superuser. If you log into your Raspberry Pi as the
pi
user then you are logging in as a normal user. You can run commands as the root user by using thesudo
command before the program you want to run.For example if you want to install additional software on Raspbian then you normally use the
apt-get
tool. To be able to update the list of available software then you need to prefix theapt-get
command command with sudo.sudo apt-get update
Find out more about the apt commands
You can also run a superuser shell by using
sudo su
. When running commands as a superuser there is nothing to protect against mistakes that could damage the system. It is like disabling the safety guards on a machine. It makes it easier to access the insides, but the risk of damage is far greater. It is recommended that you only run commands as the superuser when required and to exit a superuser shell when it is no longer needed.Who can use Sudo?
It would defeat the point of the security if anyone could just put sudo in front of their commands, so only approved users can use sudo to gain administrator privileges. The
pi
user is included in the sudoers file. To allow other users to act as a superuser then you could add the user to thesudo
group or add them usingvisudo
.
1
1. https://github.com/raspberrypi/documentation/blob/master/remote-access/ssh/README.md
SSH (Secure Shell)
You can remotely gain access to the command line of a Raspberry Pi from another computer on the same network using
ssh
.Note you only have access to the command line, not the full desktop environment. For full remote desktop see VNC.
You can enable or disable the SSH server on your Raspberry Pi (it is enabled by default). This is done using raspi-config:
Enter
sudo raspi-config
in the terminal, then navigate tossh
, hitEnter
and selectEnable or disable ssh server
.SSH is built into Linux distributions and Mac OS, and a third-party SSH client is available for Windows. See the following guides for using SSH depending on the operating system used by the computer you are connecting from:
1
1.https://github.com/raspberrypi/documentation/blob/master/remote-access/web-server/README.md
Setting up a web server on a Raspberry Pi
You can use a web server on a Raspberry Pi to host a full website (locally on your network or globally on the internet), or just use it to display some information you wish to share to other machines on your network.
Various web servers are available, with different advantages for usage:
1
1. https://github.com/raspberrypi/documentation/blob/master/remote-access/ssh/sftp.md
SFTP
The SSH File Transfer Protocol is a network protocol that provides file access, file transfer, and file management functionalities over SSH.
By using SFTP you can easily change, browse and edit files on your Raspberry Pi. SFTP is easier to setup than FTP as Raspbian has SSH enabled by default.
FileZilla
Download the latest FileZilla Client version for your operating system from filezilla-project.org.
Launch FileZilla and go to
File > Site manager
.Fill in the IP address, user name and password (by default the user name is
pi
and the passwordraspberry
) of your Raspberry Pi in the dialog and chooseSFTP
as the protocol.Click
Connect
and you will see the home folder of the user.Ubuntu using Nautilus
Open Nautilus on the client machine
Select
File > Connect to Server
Type: SSH
Server: <The Pi's IP address>
Port: 22 (default)
User name: pi (default)
Password: raspberry (default)
1
1
1
1
1
1
1
1
1
1
1
1
1
1
如何在没有显示器的情况下,查看 Raspberry Pi 3的 IP 信息(Raspberry Pi 3 ,IP Address)的更多相关文章
- linux下查看指定进程的所有连接信息(转)
定位某个进程的网络故障时经常需要用到的一个功能就是查找所有连接的信息.通常查找某个端口的连接信息使用 ss 或者 netstat 可以轻松拿到,如果是主动与别的机器建立的连接信息则可以通过 lsof ...
- 不root手机的情况下查看Android数据库
最近写Android的时候发现想要读取数据库很不方便,使用adb工具的方法需要root手机,而华为手机root十分麻烦,需要解除密码,一些品牌手机即使root了也没有sqlite3命令,总之十分麻烦. ...
- 不root的情况下 查看App的数据表
一直以来查看sqlite的数据库都须要root才干查看,可是公司的好多測试机root起来比較麻烦~~~ 近期刚好项目上线,略闲, 于是决定写一个libraryproject便于以后调试代码 关键代码例 ...
- 如何在不使用try语句的情况下查看文件是否存在
如果你要确定文件存在的话然后做些什么,那么使用try是最好不过的 如果您不打算立即打开文件,则可以使用os.path.isfile检查文件 如果path是现有常规文件,则返回true.对于相同的路径, ...
- Linux下查看Nginx安装目录、版本号信息?
Linux环境下,怎么确定Nginx是以那个config文件启动的? 输入命令行: ps -ef | grep nginx 摁回车,将出现如下图片: master process 后面的就是 ngi ...
- Linux下查看Nginx安装目录、版本号信息及当前运行的配置文件
Linux环境下,怎么确定Nginx的安装路径 输入命令行: ps -ef | grep nginx 摁回车,将出现如下图片: master process 后面的就是的 /data/software ...
- linux下查看CPU、内存、磁盘信息
1.查看CPU信息# 总核数 = 物理CPU个数 X 每颗物理CPU的核数 # 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数 # 查看物理CPU个数cat /proc/c ...
- 【转】Linux下查看CPU、内存、磁盘信息
1.查看CPU信息# 总核数 = 物理CPU个数 X 每颗物理CPU的核数 # 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数 # 查看物理CPU个数cat /proc/c ...
- Linux下查看CPU、内存和硬盘信息命令
一.查看cpu信息 cat /proc/cpuinfo 相同physical id 的记录是属于同一个CPU的,对应于多核的信息. 二.查看内存的信息 cat /proc/meminfo 三.查看硬盘 ...
随机推荐
- JavaScript中的构造函数和原型!
JavaScript中的原型! 原型的内容是涉及到JavaScript中的构造函数的 每一个构造函数都有一个原型对象!prototype 他的作用是 共享方法!还可以扩展内置对象[对原来的内置对象进行 ...
- postgres多知识点综合案例
使用到的知识点: 1.使用with临时存储sql语句,格式[with as xxx(), as xxx2() ]以减少代码: 2.使用round()取小数点后几位: 3.使用to_char()将时间格 ...
- python基础之 列表、元组操作 字符串操作 字典操作 集合操作 文件操作 字符编码与转码
本节内容 列表.元组操作 字符串操作 字典操作 集合操作 文件操作 字符编码与转码 1. 列表.元组操作 列表是我们最以后最常用的数据类型之一,通过列表可以对数据实现最方便的存储.修改等操作 定义列表 ...
- 如何设计一个亿级网关(API Gateway)?
1.背景 1.1 什么是API网关 API网关可以看做系统与外界联通的入口,我们可以在网关进行处理一些非业务逻辑的逻辑,比如权限验证,监控,缓存,请求路由等等. 1.2 为什么需要API网关 RPC协 ...
- [每日电路图] 12、带自动烧写能力的 ESP8266 开发板制作
目录 前言 1.芯片先关信息 2.原理图介绍 2.1 供电电路 2.2 串口电路 2.3 自动烧写电路 3.PCB 效果展示 附录 前言 ESP8266 是乐鑫公司面向物联网应用的高性价比.高度集成的 ...
- UML——宏观总结
今天果断开始UML的学习,要不就要被12期赶超了.努力学习的效率 一.宏观导图把控 导图概要说明:RUP这块儿的内容相当于软件工程已经学过了,只不过这里换了个名词而已.面向对象,已经不再陌生,vb中早 ...
- jvm系列五-java内存模型初览(1)
本文转载自:再有人问你Java内存模型是什么,就把这篇文章发给他. 网上有很多关于Java内存模型的文章,在<深入理解Java虚拟机>和<Java并发编程的艺术>等书中也都有关 ...
- Pytest(10)assert断言
前言 断言是写自动化测试基本最重要的一步,一个用例没有断言,就失去了自动化测试的意义了.什么是断言呢? 简单来讲就是实际结果和期望结果去对比,符合预期那就测试pass,不符合预期那就测试 failed ...
- 一文入门Linux下gdb调试(二)
作者:良知犹存 转载授权以及围观:欢迎添加微信号:Conscience_Remains 总述 今天我们介绍一下core dump文件,Core dump叫做核心转储,它是进程运行时在突然崩溃的 ...
- Testing Beta Round (Unrated)
比赛链接:https://codeforces.com/contest/1390 A. 123-sequence 题意 给出一个只含有 $1,2,3$ 的数组,问使所有元素相同至少要替换多少元素. 题 ...