linux - 通过交换机通过以太网将嵌入式系统连接到主机

标签 linux networking configuration embedded-linux ethernet

我有一个带千兆以太网的 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/

相关文章:

java - 如何管理客户端特定配置

configuration - 什么是快速 ssh 命令以了解系统信息/配置

linux - centos 7 用脚本替换systemd

linux - Linux 上的 R 包管理

java - 测量连接速度并在 Web 应用程序中显示

java - Netty 4 - 编码器不写入以下编码器

linux - 使用 CMake 创建二进制文件会删除运行时路径

windows - windows、gnu/linux、macosx 下的 CPU 标识符

networking - ZeroMQ 中的 DEALER 和 ROUTER 套接字原型(prototype)有什么区别?

java - 无法处理上下文配置的位置和类