工具/软件: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 地址?