我的 Raspberry Pi 上未显示 eth0 的静态 IP 地址

问题描述 投票:0回答:3

我正在使用带有 Raspbian Buster 的 Raspberry Pi 3 B。我用 Wifi 连接了它,它工作正常,没有任何问题。我想启用 eth0 接口,以便将我的 Raspbi 与 Profinet(工业协议)结合使用。 所以,我修改了文件/etc/dhcpcd.conf/:

/etc/dhcpcd.conf/.

但是“ifconfig”的输出是:

eth0

“route -v”的输出是: route

我希望接口“eth0”的 IP 地址是静态的并且能够显示并且能够被 ping 通。我在其他论坛上尝试了很多东西,例如thisone:修改文件/etc/network/interfaces。但这没有用。我还使用“sudo ifconfig eth0 [ipadress] netmask 255.255.255.0 up”设置 eth0 接口。在此之后,我的 wifi 崩溃了...有人可以帮助我吗?几周以来我一直坚持这个问题。多谢。如果您有任何疑问,我可以提供一些屏幕截图。

干杯

raspberry-pi raspberry-pi3 static-ip-address
3个回答
0
投票

自 Raspbian Stretch 起使用文件

/etc/dhcpcd.conf
而不是
/etc/network/interfaces

使用您选择的编辑器,编辑

/etc/dhcpcd.conf
,向下滚动到示例配置,如下所示,来自 mi Pi3B+,取消注释行并根据您的需要配置参数。

# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=xxxx:xxxx:xxxx:xxxx::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 xxxx:xxxx:xxxx:xxxx::1

0
投票

更新/etc/dhcpcd.conf

interface eth0
static ip_address=192.168.0.10/24

重新启动 dhcp 服务

 sudo service dhcpcd restart

如果您希望该路由器不将此 IP 分配给其他材料,请不要忘记向您的路由器通知 dhcp 租约,这样可以避免不稳定


0
投票

还调用

ethtool eth0
给出输出:

Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes:   10baseT/Half 10baseT/Full 
                        100baseT/Half 100baseT/Full 
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes:  10baseT/Half 10baseT/Full 
                        100baseT/Half 100baseT/Full 
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: Unknown!
Duplex: Unknown! (255)
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Cannot get wake-on-lan settings: Operation not permitted
Current message level: 0x00000007 (7)
               drv probe link
Link detected: no

这里有一些关于我的问题的更多细节。我将非常感谢您的帮助

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.