RCAM Posted September 6 Share Posted September 6 (edited) 遇到一个问题处理好了分享给大家。 问题描述: 使用lucky或其他ipv6 DDNS解决方案外网访问unraid时,当ipv6外网地址更新,老的ipv6地址在nginx中servers.conf不会更新ipv6地址;导致新的DNS生效后,445端口被nginx拒绝而无法在外网通过ipv6访问smb服务。典型症状就是外网可以打开web ui但无法使用smb服务且445端口closed,但没去深入研究为什么web ui服务没有被影响。(吐槽一下官方,似乎以前也会影响到web ui的访问但是修复了,但但是只修复了web ui,smb仍然存在问题,期待彻底修复这个问题)。 解决方案: ipv6地址变更后重启nginx和smb即可。 这里提供一个现成方案: #!/bin/bash IPV6_FILE="/home/past_ipv6.txt" declare -a CURRENT_IPV6 # 2409开头ipv6地址请按需修改 CURRENT_IPV6=($(ip -6 addr list scope global | grep 'inet6 2409' | awk '{print $2}' | cut -d '/' -f 1)) echo "Current IPv6 address is ${CURRENT_IPV6[0]}" if [ -f "$IPV6_FILE" ]; then PAST_IPV6=$(cat "$IPV6_FILE") else PAST_IPV6="" fi if [[ -z "${PAST_IPV6}" ]]; then echo 'Script first time running after restart, initializing PAST_IPV6' echo "${CURRENT_IPV6[0]}" > "$IPV6_FILE" else if [[ "${PAST_IPV6}" != "${CURRENT_IPV6[0]}" ]]; then /etc/rc.d/rc.samba restart /etc/rc.d/rc.nginx restart echo 'IPv6 address has changed, restarting samba and nginx services' else echo 'IPv6 address has not changed' fi echo "${CURRENT_IPV6[0]}" > "$IPV6_FILE" fi 大家拿回去自己设个cron,我搞1h感觉应该够用了。 如果其他大佬有更优雅的解决方案,不吝赐教。 Edited September 6 by RCAM Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.