2

I want to transfer some files from my Mac to my Raspberry Pi via SSH, but when I try to find the Raspberry Pi's IP address with the ifconfig command in the lx terminal, the line which everyone says tells you the IP address is not there!, it's just gone. My terminal looks like this:

      eth0      Link encap:Ethernet  HWaddr b8:27:eb:63:40:b8
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:27224 errors:0 dropped:0 overruns:0 frame:0
      TX packets:733 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:2801074 (2.6 MiB)  TX bytes:107019 (104.5 KiB)

      lo        Link encap:Local Loopback
      inet addr:127.0.0.1  Mask:255.0.0.0
      UP LOOPBACK RUNNING  MTU:16436  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Because this is not from my actual Raspberry Pi, please don't make deductions from it. It's just since I can't transfer files from the Raspberry Pi I can't get a copy of the actual text.

Sorry for the code mess up, it looks exactly like this website: http://learn.adafruit.com/adafruits-raspberry-pi-lesson-3-network-setup/finding-your-pis-ip-address

Except without line 2 in ethO.

4

4 回答 4

9

您可以使用以下命令添加 IP 地址(直到下次重新启动):

sudo ip addr add 192.168.0.100/32 dev eth0
于 2013-07-22T19:17:38.153 回答
4

将 Raspberry Pi 上的 inet 配置为自动 ( DHCP )。然后,使用路由器为 Raspberry Pi 分配一个固定的 IP 地址。这非常方便,在考虑 Raspberry Pi 的默认配置时,您无需修改​​任何内容。

适当的行/etc/network/inferfaces是:

iface eth0 inet dhcp

关于路由器配置:这取决于您的设备,但手册应涵盖它。

于 2014-06-10T09:39:18.533 回答
1

您还可以通过在 cmdline.txt 末尾添加“ip = 192.168.0.4”来为您的 Raspberry Pi 提供 IP 地址

使用以下命令执行此操作:

sudo nano /boot/cmdline.txt

确保您没有添加任何其他内容,甚至没有添加空格或回车。之后,重新启动您的 Raspberry Pi 并键入hostname -I以查看是否设置了 IP 地址。

于 2013-07-22T19:46:33.200 回答
0

我的 Raspberry Pi 4 也遇到了类似的问题。通过以太网电缆连接,它没有从路由器获取 IP。分配静态 IP 并没有为我解决问题。

解决方案:这是一个旧的 100Mbit 路由器,将 Raspberry Pi 连接到一个 1 Gbit 路由器修复它。

于 2021-01-28T14:20:11.353 回答