1. Openwrt 官方固件下载地址
- https://downloads.openwrt.org/releases/21.02.0/targets/x86/64/
- 选择固件:
openwrt-21.02.0-x86-64-generic-ext4-combined-efi.img.gz
2. 下载后,解压后改名 openwrt.img
上传 PVE,建立 OpenWRT
编号 102
3. 使用 qm
软件, 直接转换openwrt的img文件为虚拟磁盘
qm importdisk 102 /var/lib/vz/template/iso/openwrt.img local
qm stop 102 # 可以使用 qm stop 停止虚拟机
4. OpenWRT 网络设置 和 DNS 设置
设置OP路由器网络 #
vi /etc/config/network
; 修改IP和添加网关config interface 'lan' option proto 'static' option ipaddr '192.168.1.99' option netmask '255.255.255.0' option gateway '192.168.1.1' option ip6assign '60' option device 'br-lan'
- 重启网络设置 #
ifup lan
添加临时 DNS #
vi /etc/resolv.conf
echo 'nameserver 8.8.8.8' >> /etc/resolv.conf
5. 查看软件源和修改软件源为中科大
cat /etc/opkg/distfeeds.conf
src/gz openwrt_core https://downloads.openwrt.org/releases/21.02.0/targets/x86/64/packages src/gz openwrt_base https://downloads.openwrt.org/releases/21.02.0/packages/x86_64/base src/gz openwrt_luci https://downloads.openwrt.org/releases/21.02.0/packages/x86_64/luci src/gz openwrt_packages https://downloads.openwrt.org/releases/21.02.0/packages/x86_64/packages src/gz openwrt_routing https://downloads.openwrt.org/releases/21.02.0/packages/x86_64/routing src/gz openwrt_telephony https://downloads.openwrt.org/releases/21.02.0/packages/x86_64/telephony
因为原始固件没有
ca-certificates
,所以修改国内源,改http下载sed -i 's/downloads.openwrt.org/mirrors.ustc.edu.cn\/openwrt/g' /etc/opkg/distfeeds.conf sed -i 's/https/http/g' /etc/opkg/distfeeds.conf
6. 安装中文语言包和常用工具
opkg update
opkg install luci-i18n-base-zh-cn
opkg install wget tmux ca-certificates htop tar bash
7. 查询可安装的软件包
opkg list | grep -e libev -e ray