在 Alpine Linux 中,ndppd 需要从源代码编译,因为官方存储库不包含预编译的 ndppd 包。以下是安装步骤:
1.安装编译工具和依赖:
apk add build-base git musl-dev linux-headers
2.克隆 ndppd 源代码:
git clone https://github.com/hugangba/alpine-ndppd.git
cd ndppd
3.编译并安装:
make all && make install
验证安装:
which ndppd
应该返回类似 /usr/sbin/ndppd 的路径。
创建配置文件:
创建 /etc/ndppd.conf 文件并添加以下内容,替换为你的实际子网和接口:
route-ttl 30000
address-ttl 30000
proxy eth0 {
router yes
timeout 500
autowire no
keepalive yes
retries 3
promiscuous no
ttl 30000
rule 2001:db8:1234:64:ff9b::/96 {
static
autovia no
}
}
启动 ndppd 服务:
ndppd -d -c /etc/ndppd.conf
如果返回以下代码说明ndppd启动成功
(notice) ndppd (NDP Proxy Daemon) version 0.2.5
(notice) Using configuration file '/etc/ndppd.conf'
(warning) Low prefix length (64 <= 120) when using 'static' method
将 ndppd 添加到系统启动,创建服务文件以确保开机启动:
cat <<EOF > /etc/init.d/ndppd
#!/sbin/openrc-run
description="NDP Proxy Daemon"
command="/usr/local/sbin/ndppd"
command_args="-d -c /etc/ndppd.conf"
pidfile="/var/run/ndppd.pid"
depend() {
need net
after firewall
}
EOF
赋予执行权限并启用服务:
chmod +x /etc/init.d/ndppd
rc-update add ndppd default
rc-service ndppd start
以下是彻底卸载 ndppd 的步骤
rc-service ndppd stop
rc-update del ndppd default
rm /etc/init.d/ndppd
rm /usr/local/sbin/ndppd
rm /etc/ndppd.conf