【问题标题】:Connect embedded system to host via ethernet over a switch通过交换机通过以太网将嵌入式系统连接到主机
【发布时间】:2012-10-13 18:44:12
【问题描述】:

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

【问题讨论】:

  • 能否提供“route”的输出?
  • 已添加。网关是空的...嗯
  • 星号表示是直连的(没有跳数),但是没有默认路由,你是如何测试连接的? 192.168.1.0是交换机上接口的ip吗?
  • 我想设置连接,以便我可以双向 ping。据我了解,192.168.1.0 应该是交换机的默认 IP。我不确定如何验证交换机的地址。
  • 交换机(假设它是第 3 层)应该有一个具有特定 ip 的 vlan,并针对嵌入式系统和 pc 连接的端口(物理)进行配置。要查看取决于交换机的 ips 列表,可能是“show ip”,在那里你会看到 vlan,然后你可以输入“show vlans ”来查看端口。

标签: linux networking configuration embedded-linux ethernet


【解决方案1】:

这很糟糕

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

其中后两者可以根据地址和网络掩码自动计算,因此不会写入配置文件

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-26
    • 1970-01-01
    相关资源
    最近更新 更多