Automatically attach client to LAN interface?

Hi I’m looking to automatically attach my client network in AP+STA (repeater mode) to the lan network, this is because I regularly switch networks and as the repeater only assigns to lan, I have to go to LUCI and check the lan box each time so it follows my custom firewall rules.

lan

I am wondering if there is a simple modification I can make to the code to achieve this? I’ve posted some of the code I was looking at below:



<form id="form-wan-repeater"><input name="wan-proto" type="hidden" value="wifi" />

<input name="action" type="hidden" value="updatewan" />

<input id="wan-encryption" name="wan-encryption" type="hidden" value="" />

<input id="wan-channel" name="wan-channel" type="hidden" value="auto" />

<input id="wan-mac" name="wan-mac" type="hidden" value="" />
<div>

&nbsp;

&nbsp;

&nbsp;

<select id="wan-ssid" class="form-control" name="wan-ssid"></select>

&nbsp;

&nbsp;

</div>

 



<code><script>// <![CDATA[
fill_wan_settings(); //get wan settings from server //change mode: cable, repeater, 3g, phone $("input[name='wan-mode']").change( function(){ var wan_mod=$("input[name='wan-mode']:checked").val(); if(wan_mod=="wifi") { scanwifi(); } }); //submit information $("#submit_wan").click(function(){ console.log("check validity"); $("#wan-message").text(""); var wan_mod=$("input[name='wan-mode']:checked").val(); var data; if(wan_mod=="wifi"){ data=$("#form-wan-repeater").serialize(); console.log("data="+data); } console.log("start to update"); $.ajax({ type: "POST", url: "/cgi-bin/router_cgi", data: data, dataType: 'json', success: function(result){ console.log("update success"); if(result.success){ close_modal(); }else{ $("#wan-message").text(result.error); } }, error: function(xhr, textStatus, errorThron){ $("#wan-message").text(textStatus); console.log("update error"); } }); }); //choose scanned stations $("#wan-ssid").change(function(){ var index=$("#wan-ssid").get(0).selectedIndex; $("#wan-encryption").val( stations[index].Encryption ); $("#wan-channel").val(stations[index].Channel); $("#wan-mac").val(stations[index].MAC); });
// ]]></script>

 

 

</form>

</form>

</form>

</form>

</form>

Hi, the pic is not clear from my side.

Actually I am not quite sure what you want to achieve. Can you state it more clearly so that I can help?

Do you want to bridge the WAN (via sta) and LAN (ap) so that your mobile devices can get IP from your main router directly? I think you can just implement a script to do that. And if you are using AR150 you can use the switch to trigger that script.

Hi @alzhao thanks for the reply.

Basically, when I set up a repeater it connects to the wan interface but I have to manually go to Luci > Network > WiFi and select edit under the repeated network and check the lan option so that the repeater follows the rules I’ve set up in my firewall.

I was wondering if it was possible for lan to be automatically checked? Also, please click here for a link for the image so you can see it clearer.

Thanks :slight_smile:

 

The image I saw is still unclear. Seems the service you used have restriction on this.

But I understand your meaning. Yes, it is possible. The only problem is that when bridging LAN and WAN, your router will have a dynamic IP address so that you don’t know where to connect to it.