我有一个带千兆以太网的 arm 平台,我想连接到我的 ubuntu 机器上 测试以太网端口。
网络不是我的强项。
我在嵌入式系统上修改了/etc/network/interfaces:
# Configure Loopback
auto lo
iface lo inet loopback
#auto eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.0
在我的 ubuntu 机器上我设置了(通过网络连接窗口):
IP: 192.168.1.1
netmask: 255.255.255.0
gateway: 192.168.1.0
当我测试连接时, ARM 系统无法识别任何连接。
eth0 端口产生以下输出:
eth0: link up, 10 Mb/s, half duplex, flow control disabled
ip: RTNETLINK answers: Invalid argument
ifconfig 显示:
# ifconfig
eth0 Link encap:Ethernet HWaddr 02:50:43:C5:C5:75
inet addr:192.168.1.2 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST RUNNING 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)
Interrupt:11
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)
谁能指出我最有可能犯的明显错误? 如果我需要提供更多信息,请告诉我。
编辑:我在嵌入式系统上运行 busybox 1.18.5。
编辑 2:
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
最佳答案
这很糟糕
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.0
192.168.1.0 是您的网络地址。当然,它不能成为您的网关。通常你有这样的配置
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0
broadcast 192.168.1.255
后两者可以根据地址和网络掩码自动计算,因此不写入配置文件
关于linux - 通过交换机通过以太网将嵌入式系统连接到主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13037146/