|
树莓派系统升到最新的9.0,版本号:Debian Stretch,设置静态ip和之前有所不同。
1,使用ssh登录。如果要启用ssh登录,需要把tf卡插在win电脑下面,在boot目录下面新建一个空的文件夹,名字为ssh。用户名和密码:pi/raspberry
2,查看网卡名称。sudo ifconfig
请注意,第一行,之前都是eth0,现在变了,是一串字符:enxb827eb561445
- pi@raspberrypi:/etc/ssh $ sudo ifconfig
- enxb827eb561445: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
- inet 192.168.0.176 netmask 255.255.0.0 broadcast 192.168.255.255
- inet6 fe80::cb2b:c153:b018:103e prefixlen 64 scopeid 0x20<link>
- ether b8:27:eb:56:**:** txqueuelen 1000 (Ethernet)
- RX packets 3202 bytes 186394 (182.0 KiB)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 367 bytes 53098 (51.8 KiB)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
- inet 127.0.0.1 netmask 255.0.0.0
- inet6 ::1 prefixlen 128 scopeid 0x10<host>
- loop txqueuelen 1 (Local Loopback)
- RX packets 0 bytes 0 (0.0 B)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 0 bytes 0 (0.0 B)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
- ether b8:27:eb:03:**:** txqueuelen 1000 (Ethernet)
- RX packets 0 bytes 0 (0.0 B)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 0 bytes 0 (0.0 B)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
复制代码 3,静态IP设置如下。debian 9.0的静态ip设置有所不同,是在/etc/dhcpcd.conf下面修改
sudo nano /etc/dhcpcd.conf
interface enxb827eb561445
static ip_address=192.168.0.3/24
static routers=192.168.0.1
static domain_name_servers=114.114.114.114 192.168.0.2
4,重启一下
sudo reboot
|
|