openwrt/defaults/49-network
Peter Surda ffc564720c
Typo
- this is self-explanatory, the typo prevented the script from running,
  this script is needed to reconfigure the default network system,
  basically swapping eth0 and eth1, so that eth0 is wan and eth1 is lan.
  This means that if there is only one ethernet interface, it doesn't
  assign it a fixed IP address and start responding to DHCP requests on
  it. It was broken for a long time but I didn't have time to investigate
  until now.
2023-05-23 12:47:00 +08:00

29 lines
738 B
Plaintext

VERSION=1
[ "$(uci -q get defaults.version.network)" -ge "$VERSION" ] && exit
# save version
/sbin/uci set defaults.version.network="$VERSION"
# switch LAN to eth1
/sbin/uci set network.@device[0].ports='eth1'
# set WAN to eth0
/sbin/uci set network.wan=interface
/sbin/uci set network.wan.device=eth0
/sbin/uci set network.wan.proto=dhcp
# firewall allow SSH
/sbin/uci add firewall rule
/sbin/uci set firewall.@rule[-1].name='Allow-SSH'
/sbin/uci set firewall.@rule[-1].src='wan'
/sbin/uci set firewall.@rule[-1].dest_port='22'
/sbin/uci set firewall.@rule[-1].proto='tcp'
/sbin/uci set firewall.@rule[-1].target='ACCEPT'
/sbin/uci commit
/sbin/service network restart
/sbin/service firewall restart
/sbin/service dnsmasq restart