I'm trying to create a script to connect my Hap AX3 to my apartment AP that is providing a wireless network for my unit. The reason I'm doing this is I originally had it connect to the ethernet port in my room which also created a network for my devices,servers and home-lab. At the moment, while I wait for the network to be diagnosed and fixed I'm actively looking for ways to get my stuff back connected to the internet. Without having it accessible to the whole apartment network.
At the moment I had a script created to do the process then see if I can ping google and other devices. At the moment it is based on the default configuration from MikroTIk. When I try to run this using the "import" command a get the following error. I have inquired to help of GPT but the error persist. [The line and column may be different as I've gone through numerous iterations] # Variables
:global apartmentWifi5GHzSSID "Astoria"
:global apartmentWifi24GHzSSID "Astoria_legacy"
:global apartmentWifiPassword "[Redacted]"
# Clear existing configuration
/system reset-configuration no-defaults=yes skip-backup=yes
# Set up the 5GHz WiFi (WiFi1)
/interface wifi set [find default-name=wifi1] mode=station ssid=$apartmentWifi5GHzSSID security.authentication-types=wpa2-psk security.passphrase=$apartmentWifiPassword disabled=no
# Set up the 2.4GHz WiFi (WiFi2)
/interface wifi set [find default-name=wifi2] mode=station ssid=$apartmentWifi24GHzSSID security.authentication-types=wpa2-psk security.passphrase=$apartmentWifiPassword disabled=no
# Create a bridge and add WiFi interfaces
/interface bridge add name=bridge-lan
/interface bridge port add bridge=bridge-lan interface=wifi1
/interface bridge port add bridge=bridge-lan interface=wifi2
# Assign IP address to the bridge
/ip dhcp-client add interface=bridge-lan disabled=no comment="Obtain IP from apartment Wi-Fi DHCP"
# Enable DNS for local resolution
/ip dns set allow-remote-requests=yes
# Configure basic firewall (LAN protection)
/ip firewall filter
add chain=input action=accept connection-state=established,related comment="Accept established and related connections"
add chain=input action=drop connection-state=invalid comment="Drop invalid connections"
add chain=input action=accept protocol=icmp comment="Accept ICMP (ping)"
add chain=input action=drop in-interface-list=!LAN comment="Drop all from WAN not destined to LAN"
add chain=forward action=accept connection-state=established,related comment="Accept established and related connections"
add chain=forward action=drop connection-state=invalid comment="Drop invalid connections"
add chain=forward action=drop in-interface-list=WAN comment="Drop all from WAN to LAN"
# Save configuration
/system script run defconf
At the moment I had a script created to do the process then see if I can ping google and other devices. At the moment it is based on the default configuration from MikroTIk. When I try to run this using the "import" command a get the following error. I have inquired to help of GPT but the error persist. [The line and column may be different as I've gone through numerous iterations] # Variables
:global apartmentWifi5GHzSSID "Astoria"
:global apartmentWifi24GHzSSID "Astoria_legacy"
:global apartmentWifiPassword "[Redacted]"
# Clear existing configuration
/system reset-configuration no-defaults=yes skip-backup=yes
# Set up the 5GHz WiFi (WiFi1)
/interface wifi set [find default-name=wifi1] mode=station ssid=$apartmentWifi5GHzSSID security.authentication-types=wpa2-psk security.passphrase=$apartmentWifiPassword disabled=no
# Set up the 2.4GHz WiFi (WiFi2)
/interface wifi set [find default-name=wifi2] mode=station ssid=$apartmentWifi24GHzSSID security.authentication-types=wpa2-psk security.passphrase=$apartmentWifiPassword disabled=no
# Create a bridge and add WiFi interfaces
/interface bridge add name=bridge-lan
/interface bridge port add bridge=bridge-lan interface=wifi1
/interface bridge port add bridge=bridge-lan interface=wifi2
# Assign IP address to the bridge
/ip dhcp-client add interface=bridge-lan disabled=no comment="Obtain IP from apartment Wi-Fi DHCP"
# Enable DNS for local resolution
/ip dns set allow-remote-requests=yes
# Configure basic firewall (LAN protection)
/ip firewall filter
add chain=input action=accept connection-state=established,related comment="Accept established and related connections"
add chain=input action=drop connection-state=invalid comment="Drop invalid connections"
add chain=input action=accept protocol=icmp comment="Accept ICMP (ping)"
add chain=input action=drop in-interface-list=!LAN comment="Drop all from WAN not destined to LAN"
add chain=forward action=accept connection-state=established,related comment="Accept established and related connections"
add chain=forward action=drop connection-state=invalid comment="Drop invalid connections"
add chain=forward action=drop in-interface-list=WAN comment="Drop all from WAN to LAN"
# Save configuration
/system script run defconf
Statistics: Posted by Death1Net — Wed Jan 08, 2025 7:42 am