I'm in the process of updating a few scripts to automatically set wireless card configuration but am getting stuck on band and channel width selection.
In winbox there is a dropdown list which tells you the available bands for the card you're using and in terminal you can get a printout by using:
Code: Select all
/interface wireless info hw-info wlan1
By comparison if I'm using something like monitor-traffic and I want to grab certain values I can do so like this:
Code: Select all
/interface monitor-traffic [find name=$iface] once do={
:set rxThisBits ($"rx-bits-per-second")
:set txThisBits ($"tx-bits-per-second")
}
Anyone else run into this and if so how did you work around it? My current solution (as I want to use the highest options available) is to run through like so:
Code: Select all
:foreach i in=[/interface wireless find] do={
:if ([/interface wireless get $i band] ~"2ghz") do={
:do {:global wififrequency2ghz; /interface wireless set $i frequency=$"wififrequency2ghz"} on-error={:log error "Failed to Set initial wireless frequency"}
:do {/interface wireless set $i band=2ghz-b/g/n } on-error={:log warning "wireless frequency and band limit reached"}
}
:if ([/interface wireless get $i band] ~"5ghz") do={
:do {:global wififrequency5ghz; /interface wireless set $i frequency=$"wififrequency5ghz" } on-error={:log error "Failed to Set initial wireless frequency"}
:do {/interface wireless set $i band=5ghz-a } on-error={:log warning "wireless band limit reached"}
:do {/interface wireless set $i band=5ghz-a/n } on-error={:log warning "wireless band limit reached"}
:do {/interface wireless set $i band=5ghz-a/n/ac } on-error={:log warning "wireless band limit reached"}
:do {/interface wireless set $i channel-width=20/40mhz-Ce } on-error={:log warning "wireless channel-width limit reached"}
:do {/interface wireless set $i channel-width=20/40/80mhz-Ceee } on-error={:log warning "wireless channel-width limit reached"}
}
}