Skip to content

Instantly share code, notes, and snippets.

@pniaps
Last active April 28, 2021 17:38
Show Gist options
  • Save pniaps/15787655611ac1f61eb9c569ff6640e0 to your computer and use it in GitHub Desktop.
Save pniaps/15787655611ac1f61eb9c569ff6640e0 to your computer and use it in GitHub Desktop.
Apuntes OpenWRT

Cambiar rango de la red del router

uci set network.lan.ipaddr=192.168.2.1;
uci commit;
/etc/init.d/network restart

Permitir WebUI desde WAN

uci add firewall rule
uci set firewall.@rule[-1].name='Allow-WEB-wan'
uci set firewall.@rule[-1].src=wan
uci set firewall.@rule[-1].dest_port=80
uci set firewall.@rule[-1].target=ACCEPT
uci set firewall.@rule[-1].proto=tcp
uci commit

/etc/init.d/firewall restart

Permitir SSH desde WAN

uci add firewall rule
uci set firewall.@rule[-1].name='Allow-SSH-wan'
uci set firewall.@rule[-1].src=wan
uci set firewall.@rule[-1].dest_port=22
uci set firewall.@rule[-1].target=ACCEPT
uci set firewall.@rule[-1].proto=tcp
uci commit

/etc/init.d/firewall restart

Ver ips

ifconfig | grep "inet addr"

Actualizar HTTPS

opkg update; opkg install libustream-openssl ca-bundle ca-certificates;

#!/bin/sh
SUFFIX=$(cat /sys/class/net/eth0/address | awk -F ':' '{print $5$6}' | awk '{print toupper($0)}')
old_ssid=$(uci get wireless.@wifi-iface[0].ssid 2>/dev/null)
old_mode=$(uci get wireless.@wifi-iface[0].mode 2>/dev/null)
if [ "$old_mode" = "ap" -a -n "$old_ssid" ]
then
uci set wireless.@wifi-iface[0].ssid="OpenWrt-0-$SUFFIX"
fi
old_ssid=$(uci get wireless.@wifi-iface[1].ssid 2>/dev/null)
old_mode=$(uci get wireless.@wifi-iface[1].mode 2>/dev/null)
if [ "$old_mode" = "ap" -a -n "$old_ssid" ]
then
uci set wireless.@wifi-iface[1].ssid="OpenWrt-1-$SUFFIX"
fi
uci set wireless.@wifi-device[0].disabled=0;
uci set wireless.@wifi-device[1].disabled=0;
uci commit wireless
/etc/init.d/network restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment