Openwrt配置小记
手中有台Netgear WNR2000v3,一直想尝试Openwrt,于是刷机。官方最新固件的稳定版本为15.05.1,该版本自带luci,BUT,不能保存配置,上网查了很久,得出结论,是由于WNR2000v3的Flash太小(4M)导致,放弃。然后去尝试刷Snapshots版本,该版本将luci剪裁掉了,无所谓,我用CLI一样溜儿,哈哈!现将配置方法记录下来,以备失意时参考。
言归正传,首先如果刷成砖后,可尝试30/30/30大法。刷成功后,恭喜你,可以进坑了,通过由于没有luci提供的Web界面,所以只能通过ssh连接路由器,
# ssh root@192.168.1.1
1.配置宽带(WAN)
vim /etc/config/network ---------------------------------- config interface 'wan' option ifname 'eth0' option proto 'pppoe' option username '宽带账户' option password '宽带密码'
2.配置无线
vim /etc/config/wireless ---------------------------------------- config wifi-device 'radio0' option type 'mac80211' option channel '13' # option country 'VE' # for 23dBm
option country 'CN'
option hwmode '11ng' option path 'pci0000:00/0000:00:00.0' option htmode 'HT40-' option noscan '1'
option disabled '0' config wifi-iface option device 'radio0' option network 'lan' option mode 'ap' option ssid '无线SSID' option encryption 'psk2' option key '无线密码'
至此基本就能拿来用了,一下是我自己需要的,YMMV!
3.配置固定IP
vim /etc/ethers ------------------------- xx:xx:xx:xx:xx:xx 192.168.1.2 xx:xx:xx:xx:xx:xx 192.168.1.3
vim /etc/sysupgrade.conf
-------------------------
/etc/ethers
4.配置自定义DNS
vim /etc/config/dhcp ------------------------------ config dhcp 'lan' option interface 'lan' option start '100' option limit '150' option leasetime '12h' option dhcpv6 'server' option ra 'server'
option ra_management '2' # M-flag dhcpv6 list dhcp_option '6,192.168.1.6,119.29.29.29'
list dns '::ffff:192.168.1.6' # ipv6 dns
list dns '::ffff:119.29.29.29'
5.配置端口映射(Port Forwarding)
vim /etc/config/firewall ------------------------------- config redirect option src wan option src_dport 18081 option proto tcp option dest lan option dest_ip 192.168.1.6 option dest_port 8081
6.备份配置
sysupgrade -b config.tar.gz
Finished!
list dns '::ffff:192.168.1.6'