我是网络新手。我有一台 FC16 机器,它有两个网络接口 em1 和 p3p1。em1 连接到外部世界。p3p1 是我想要连接到嵌入式主板的接口。我已将 p3p1 配置为静态 IP 地址 - 详情如下。问题是嵌入式设备无法获取 DHCP 服务器发送的 IP 地址。我也看不到发现、提供、请求和确认消息。这里可能是什么问题?
gvim ifcg-p3p1
HWADDR=cc:b2:55:ba:b6:a4
BOOTPROTO=none
#IPADDR=10.0.0.1
#NETMASK=255.255.255.0
#NETWORK=10.0.0.0
ONBOOT=yes
NM_CONTROLLED=no
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
IPADDR=10.0.0.10
NETMASK=255.255.255.0
GATEWAY=10.0.0.1
PREFIX=24
现在,在 ifconfig 上,它向我显示了这个。
p3p1 Link encap:Ethernet HWaddr CC:B2:55:BA:B6:A4
inet addr:10.0.0.10 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
我已经在 dhcp 配置文件中给出了额外的参数。
gvim /etc/sysconfig/dhcpd
DHCPDARGS="p3p1"
现在,这是 dhcpd.conf 文件。
# gvim /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see dhcpd.conf(5) man page
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
ddns-update-style none;
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.1 10.0.0.14 ;
}
然而,在运行 dhcp 服务器时
作为
#sudo service dhcpd restart
Redirecting to /bin/systemctl restart dhcpd.service
我发现没有 DORA(发现、提供、请求、确认)程序。
来自我的嵌入式设备的消息。
CFE> ifconfig eth0 auto
External phy address 4
Auto-negotiation timed-out...check cable/connection
10 Mbps Half-Duplex
Device eth0: hwaddr E0-B7-B1-23-60-D0, ipaddr not set, mask not set
gateway not set, nameserver not set
*** command status = 0
来自 dhcpd 的消息 -
dhcpd: Sending on Socket/fallback/fallback-net
dhcpd: Internet Systems Consortium DHCP Server 4.2.4-P2
dhcpd: Copyright 2004-2012 Internet Systems Consortium.
dhcpd: All rights reserved.
dhcpd: For info, please visit https://www.isc.org/software/dhcp/
dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
dhcpd: Wrote 0 leases to leases file.
dhcpd: Listening on LPF/p3p1/cc:b2:55:ba:b6:a4/10.0.0.0/24
dhcpd: Sending on LPF/p3p1/cc:b2:55:ba:b6:a4/10.0.0.0/24
dhcpd: Sending on Socket/fallback/fallback-net
答案1
我能够配置 DHCP。以下是设置 DHCP 的链接 -
http://www.tune2wizard.com/dynamic-host-configuration-protocol-dhcp-networking/