Make IP and NETMASK configurable

User can now customize IP and Netmask of the router
This commit is contained in:
Victor Caldas 2023-07-11 10:08:14 +02:00 committed by GitHub
parent 9189e12e48
commit fbccafd76c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -204,6 +204,8 @@ function default_settings() {
MAC=$GEN_MAC
LAN_MAC=$GEN_MAC_LAN
LAN_BRG="vmbr0"
LAN_IP_ADDR="192.168.1.1"
LAN_NETMASK="255.255.255.0"
LAN_VLAN=",tag=999"
MTU=""
START_VM="yes"
@ -217,6 +219,8 @@ function default_settings() {
echo -e "${DGN}Using LAN MAC Address: ${BGN}${LAN_MAC}${CL}"
echo -e "${DGN}Using LAN Bridge: ${BGN}${LAN_BRG}${CL}"
echo -e "${DGN}Using LAN VLAN: ${BGN}999${CL}"
echo -e "${DGN}Using LAN IP Address: ${BGN}${LAN_IP_ADDR}${CL}"
echo -e "${DGN}Using LAN NETMASK: ${BGN}${LAN_NETMASK}${CL}"
echo -e "${DGN}Using Interface MTU Size: ${BGN}Default${CL}"
echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}"
echo -e "${BL}Creating a OpenWRT VM using the above default settings${CL}"
@ -469,8 +473,8 @@ send_line_to_vm "uci delete network.lan"
send_line_to_vm "uci set network.lan=interface"
send_line_to_vm "uci set network.lan.device=eth0"
send_line_to_vm "uci set network.lan.proto=static"
send_line_to_vm "uci set network.lan.ipaddr=192.168.2.1"
send_line_to_vm "uci set network.lan.netmask=255.255.255.0"
send_line_to_vm "uci set network.lan.ipaddr=${LAN_IP_ADDR}"
send_line_to_vm "uci set network.lan.netmask=${LAN_NETMASK}"
send_line_to_vm "uci set firewall.@zone[1].input='ACCEPT'"
send_line_to_vm "uci set firewall.@zone[1].forward='ACCEPT'"
send_line_to_vm "uci commit"