首页 文章

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

提问于
浏览
0

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

当我测试连接时,臂系统上没有识别出连接 .

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

1 回答

  • 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
    

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

相关问题