Install OpenWRT on Proxmox: Difference between revisions
No edit summary |
No edit summary |
||
| (14 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:Proxmox VE]] | |||
[[Category:OpenWRT]] | |||
== Prequisites == | == Prequisites == | ||
1. Download OpenWRT: | 1. Download and extract OpenWRT image: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
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 | 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 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 10: | Line 15: | ||
== Install == | == Install == | ||
1. Create an empty virtualmachine | |||
No hdd, at least 2 interfaces, etc... | |||
2. Add image to vm: | |||
<syntaxhighlight lang="bash"> | |||
qm importdisk 100 /tmp/openwrt.img local-lvm | |||
</syntaxhighlight> | |||
3. Start vm and open console | |||
== | 4. Set WAN and LAN interfaces: | ||
<syntaxhighlight lang="bash"> | |||
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' | |||
</syntaxhighlight> | |||
4. Allow access from WAN and edit default ports: | |||
<syntaxhighlight lang="bash"> | |||
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 | |||
</syntaxhighlight> | |||
== Final steps == | |||
1. Add extra interfaces and firewall rules if you need them | |||
== Sources == | |||
Latest revision as of 10:00, 27 August 2025
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