OpenWrt Forum Archive

Topic: How to set switch port status to down

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi!

I need to change the LAN configuration dynamically, without restarting the system. This is not a problem, but it is very important, that the connected clients detects this change (typically DHCP clients, I change the LAN IP range) and request a  new IP address from the new pool. I tought, that I stop the LAN ports for 5-10 secs (I set it to down), but I cannot make this:

root@OpenWrt:/root# swconfig dev switch0 port 2 get link
port:2 link:up speed:100baseT full-duplex auto

root@OpenWrt:/root# swconfig dev switch0 port 2 set link down
failed

What I am doing wrong? I need this functionality on a TP-Link TL-WDR3600 model. Turning off and on the whole switch is a good solution too, because I run this in a shell script.

Thanks,

vargalex

Have you found an answer ?

you dont quite need to bring switch down

/etc/init.d/network restart

and all is restarted.. wan lan wifi

or if you want a bigger brake

/etc/init.d/network stop
sleep 30
/etc/init.d/network start

(Last edited by makarel on 12 Sep 2015, 21:59)

Tks makarel, but what i need is  a way to bring down the LAN port 4 (Used as WAN2).
The cable modem will only deliver a NEW IP address via DHCP if the port is down for a few seconds.
Even if i release the IP and try to get another, it will send the same.

try this..

disable: swconfig dev switch0 port 4 set disable 1
enable: swconfig dev switch0 port 4 set disable 0

ps: be sure you can safemode or ttl before changing network setings

(Last edited by makarel on 13 Sep 2015, 00:01)

The discussion might have continued from here.