Files
dhcp-dns-manager/TROUBLESHOOTING.md
T
CNBUGS AI 8ad4c3576d Fix DHCP client unable to get IP and config not persisting
- Fixed verifyAssignment being too strict for new clients
- Fixed parseRequestedIP string conversion bug
- Fixed response sent to 0.0.0.0 instead of broadcast address
- Added SO_BROADCAST support for UDP socket
- Fixed session persistence after page refresh (localStorage)
- Added in-memory session store for auth middleware
- Added config reloader so DHCP server picks up web UI changes dynamically
2026-04-24 16:03:54 +08:00

203 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ⚠️ 安装问题解决方案
## 你遇到的错误
```
go: github.com/google/gopacket@v1.2.3: reading github.com/google/gopacket/go.mod at revision v1.2.3: unknown revision v1.2.3
```
## ✅ 已修复
这个问题已经解决!原因是 `go.mod` 文件中包含了一个不存在的依赖版本。
### 修复内容
1. **删除了无效依赖** - `github.com/google/gopacket`(实际未使用)
2. **添加了正确的 SQLite 驱动** - `github.com/mattn/go-sqlite3`
3. **更新了 `go.mod`** - 使用稳定版本
---
## 🚀 现在这样安装
### 方法 1:重新运行安装脚本(推荐)
```bash
cd /path/to/dhcp-dns-manager
sudo ./install.sh
```
### 方法 2:运行修复脚本
```bash
cd /path/to/dhcp-dns-manager
./fix-deps.sh
```
然后编译:
```bash
go build -o dhcp-dns-manager ./cmd
```
### 方法 3:手动修复
```bash
# 1. 进入项目目录
cd /path/to/dhcp-dns-manager
# 2. 删除旧的依赖文件
rm -f go.sum
# 3. 清理模块缓存
go clean -modcache
# 4. 重新下载依赖
go mod download
go mod tidy
# 5. 编译
CGO_ENABLED=1 go build -o dhcp-dns-manager ./cmd
```
---
## 📋 完整安装步骤(从零开始)
### 1. 安装系统依赖
```bash
# Debian/Ubuntu
sudo apt update
sudo apt install -y git build-essential libsqlite3-dev
# RHEL/CentOS
sudo yum install -y git gcc make sqlite-devel
```
### 2. 安装 Go(如果未安装)
```bash
# 下载 Go 1.21
wget https://go.dev/dl/go1.21.0.linux-amd64.tar.gz
# 解压
sudo tar -C /usr/local -xzf go1.21.0.linux-amd64.tar.gz
# 添加到 PATH
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
# 验证
go version
```
### 3. 安装项目
```bash
# 进入项目目录
cd /path/to/dhcp-dns-manager
# 运行修复脚本(如果有依赖问题)
./fix-deps.sh
# 运行安装脚本
sudo ./install.sh
```
---
## 🔍 验证安装
### 检查服务状态
```bash
systemctl status dhcp-dns-manager
```
应该显示:
```
● dhcp-dns-manager.service - DHCP & DNS Manager Service
Active: active (running)
```
### 检查端口
```bash
sudo netstat -ulpn | grep -E ':(53|67|8080)'
```
应该看到:
- UDP 53 - DNS
- UDP 67 - DHCP
- TCP 8080 - Web UI
### 访问 Web 界面
浏览器打开:`http://your-server-ip:8080`
默认账号:`admin` / `admin`
---
## ❓ 其他常见问题
### 问题:`gcc: command not found`
**解决:**
```bash
sudo apt install build-essential
```
### 问题:`sqlite3.h: No such file or directory`
**解决:**
```bash
sudo apt install libsqlite3-dev
```
### 问题:`port 8080 already in use`
**解决:**
1. 查找占用进程:
```bash
sudo lsof -i :8080
```
2. 停止占用进程或修改 `configs/config.json` 中的端口
### 问题:`permission denied` 绑定端口
**解决:**
DHCP (67) 和 DNS (53) 需要 root 权限:
```bash
sudo systemctl restart dhcp-dns-manager
```
或使用 Docker 部署(自动处理权限)。
---
## 📞 还是不行?
1. **查看详细日志:**
```bash
journalctl -u dhcp-dns-manager -f
```
2. **检查 Go 环境:**
```bash
go version
go env
```
3. **查看构建指南:**
阅读 [BUILD.md](BUILD.md) 获取详细帮助
4. **提交 Issue**
提供以下信息:
- 操作系统版本
- Go 版本
- 完整错误日志
- 已尝试的解决方案
---
**祝你安装顺利!** 🎉