Install OpenWRT on Proxmox
(Redirected from Install OpenWRT for NAT)
Prequisites
1. Download and extract OpenWRT image:
curl https://downloads.openwrt.org/releases/23.05.4/targets/x86/64/openwrt-23.05.4-x86-64-generic-ext4-combined-efi.img.gz -o /tmp/openwrt.img.gz
gzip -d /tmp/openwrt.img.gz
Install
1. Create an empty virtualmachine
No hdd, at least 2 interfaces, etc...
2. Add image to vm:
qm importdisk 100 /tmp/openwrt.img local-lvm
3. Start vm and open console
4. Set WAN and LAN interfaces:
uci set network.wan.device='eth0'
uci set network.wan.proto='static'
uci set network.wan.ipaddr=172.16.16.254
uci set network.wan.netmask='255.255.255.0'
uci set network.wan.gateway=172.16.16.1
uci set network.wan.dns=213.133.98.98
uci set network.lan.device='eth1'
uci set network.lan.ipaddr=10.0.0.254
uci set network.lan.netmask='255.255.255.0'
4. Allow access from WAN and edit default ports:
uci add firewall rule
uci set firewall.@rule[-1].name='Allow-Admin'
uci set firewall.@rule[-1].enabled='true'
uci set firewall.@rule[-1].src='wan'
uci set firewall.@rule[-1].proto='tcp'
uci set firewall.@rule[-1].dest_port='22 8080 40443'
uci set firewall.@rule[-1].target='ACCEPT'
sed -i 's/0.0.0.0:80/0.0.0.0:8080/' /etc/config/uhttpd
sed -i 's/\[::]:80/\[::]:8080/' /etc/config/uhttpd
sed -i 's/0.0.0.0:443/0.0.0.0:40443/' /etc/config/uhttpd
sed -i 's/\[::]:443/\[::]:40443/' /etc/config/uhttpd
uci commit firewall
uci commit network
reboot
Final steps
1. Add extra interfaces and firewall rules if you need them