This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] Linux/AM5728:在操作系统启动 BeagleBoard X15 Arago Linux 上设置静态 IP 地址

Guru**** 2540720 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/601881/linux-am5728-set-static-ip-address-on-os-startup-beagleboard-x15-arago-linux

器件型号:AM5728

工具/软件:Linux

如何设置静态 IP 地址?

我从  网站下载了 am57xx-evm-linux-03.03.00.04.img.zip、但设置静态 IP 地址时遇到问题。

尝试#1:

修改/etc/network/interfaces

以下是我的接口文件:
#/etc/network/interfaces -- ifup(8)、ifdown(8)的配置文件

#环回接口
自动关闭
iface lo inet 环回

#无线接口
iface wlan0 inet DHCP
管理 Wireless_mode
Wireless_ESSID 任意
WPA 驱动程序 wext
wpa-conf /etc/wpa_supplicant.conf

iface tiwlan0 inet DHCP
管理 Wireless_mode
Wireless_ESSID 任意

iface atml0 inet DHCP

#有线或无线接口
auto-eth0
#iface eth0 inet DHCP
# pre-up /bin/grep -v -e "ip=[0-9]\+\.[0-9]\+.[0-9]\+.[0-9]\+"/proc/cmdline >/dev/null
# udhcpc_opts -R -b

自动 eth0
iface eth0 inet static
地址192.168.1.14
子网掩码255.255.255.0

iface eth1 inet DHCP
iface eth2 inet DHCP
iface eth3 inet DHCP
iface eth4 inet DHCP

# EtherNet/RNDIS 小工具(g_ether)
#。 或者在主机端、usbnet 和随机 hwaddr
iface usb0 inet DHCP

#蓝牙网络
iface bnep0 inet DHCP

尝试#2:

启动时在脚本中设置 IP 地址

我添加了/etc/init.d/customBoot

文件内容:

#!/bin/sh–e

ifconfig eth0 192.168.1.14

 

退出0

 

然后运行以下命令:

chmod 777 /etc/init.d/customBoot

 update-rc.d 定制引导 默认值

尝试3:

在 U-Boot 中设置 IP

setenv ipaddr 192.168.1.14

setenv ip_method 静态

保存

尝试4:

具有格式良好的引导脚本:

#! /bin/sh

#一些始终运行的内容
#touch /var/lock/blah

#执行系统要求的特定功能
中的案例"$1"
开始)
回显"正在启动脚本 blah"
ifconfig eth0 192.168.1.14

停止)
回显"停止脚本模糊"

*)
回显"用法:/etc/init.d/blah{start|stop}"
出口1

ESAC

退出0

尝试5:

将引导脚本设置为99

update-rc.d customBoot 默认值为99

什么都不起作用...

我是否只需重新编译内核即可获得静态 IP 地址?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!

    我在这里详细解释了这一点:
    e2e.ti.com/.../2035119

    请注意、最新的 TI SDK 使用 systemd、因此只修改 init.d 脚本就不够了。 您需要创建/修改 systemd 服务。

    此致、
    Yordan