整理在OpenWRT实际操作中遇到的一些问题:
1. ping百度的IP可以ping通,但是ping baidu.com出现错误 “bad address”
解决方案:增加配置文件/var/etc/dnsmasq.conf,内容如下
# auto-generated config file from /etc/config/dhcp
conf-file=/etc/dnsmasq.conf
dhcp-authoritative
domain-needed
localise-queries
read-ethers
bogus-priv
expand-hosts
local-service
domain=lan
server=/lan/
dhcp-leasefile=/tmp/dhcp.leases
resolv-file=/tmp/resolv.conf.auto
addn-hosts=/tmp/hosts
conf-dir=/tmp/dnsmasq.d
stop-dns-rebind
rebind-localhost-ok
dhcp-broadcast=tag:needs-broadcast
2. 国内无法访问OpenWRT源的问题
修改OpenWRT源文件
vi /etc/opkg/distfeeds.conf
把地址
downloads.openwrt.org
改为
mirror.sjtu.edu.cn/openwrt
还有其它比较完整的OpenWRT源
mirrors.tuna.tsinghua.edu.cn/openwrt
mirrors.aliyun.com/openwrt
mirrors.cloud.tencent.com/openwrt
3. 编译第一个ipk程序
可以参考“openwrt/package/utils/fbtest”,新建一个自己的测试项目,比如helloworld;然后使用make menuconfig将helloworld选为“M”,保存config;最后使用命令“make package/utils/helloworld/compile V=99”编译。