luckfox pico plus 上移植了alpine linux,怎么配置网络服务上电自启动
Posted: 2024-07-16 3:37
移植完成后,在interfaces中配置了静态ip ,同时在rc.conf文件中启用了
rc_depend_strict="YES"
rc_hotplug="net.*"
上面这两个配置。
interfaces的配置如下
auto lo
iface lo inet loopback
atuo eth0
iface eth0 inet staic
address 192.168.66.42
netmask 255.255.252.0
gateway 192.168.66.1
dns-nameservers 8.8.8.8 8.8.4.4
up ifconfig eth0 up
为什么重新上电后还需要手动重启网络服务才能获取到静态ip,而不能开机自启就自动获取到静态ip
(networking服务也配置了开机自启,每次上电重启后,rc-update show 查看后可以看到networking是有启动的
cronie | default
devfs | boot
local | default
networking | default
openntpd | default
procfs | boot
sshd | default
sysfs | boot
)
--------------------------------------------------------------------------
根据官方文档配置了自启动脚本,配置如下。 但是还是无法开机自启动
Luckfox:~# cat S99auto_network
#!/bin/sh
case $1 in
start)
ifconfig eth0 up
ifconfig eth0 192.168.66.42 netmask 255.255.252.0
route add default gw 192.168.66.1
echo "nameserver 192.168.66.1" > /etc/resolv.conf
;;
stop)
;;
*)
exit 1
;;
esac
rc_depend_strict="YES"
rc_hotplug="net.*"
上面这两个配置。
interfaces的配置如下
auto lo
iface lo inet loopback
atuo eth0
iface eth0 inet staic
address 192.168.66.42
netmask 255.255.252.0
gateway 192.168.66.1
dns-nameservers 8.8.8.8 8.8.4.4
up ifconfig eth0 up
为什么重新上电后还需要手动重启网络服务才能获取到静态ip,而不能开机自启就自动获取到静态ip
(networking服务也配置了开机自启,每次上电重启后,rc-update show 查看后可以看到networking是有启动的
cronie | default
devfs | boot
local | default
networking | default
openntpd | default
procfs | boot
sshd | default
sysfs | boot
)
--------------------------------------------------------------------------
根据官方文档配置了自启动脚本,配置如下。 但是还是无法开机自启动
Luckfox:~# cat S99auto_network
#!/bin/sh
case $1 in
start)
ifconfig eth0 up
ifconfig eth0 192.168.66.42 netmask 255.255.252.0
route add default gw 192.168.66.1
echo "nameserver 192.168.66.1" > /etc/resolv.conf
;;
stop)
;;
*)
exit 1
;;
esac