Simplest command to disable wan interface

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
ob2s
DD-WRT Novice


Joined: 04 Dec 2012
Posts: 16

PostPosted: Mon Jun 28, 2021 19:02    Post subject: Simplest command to disable wan interface Reply with quote
What is the simplest command line way of disabling and then reenabling the value `get_wanface`, in my case vlan2 ? Is it just an iptables command or is there something simpler ?
Thanks
Sponsor
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 1416

PostPosted: Mon Jun 28, 2021 22:08    Post subject: Reply with quote
Code:

ip link set eth0 down
ob2s
DD-WRT Novice


Joined: 04 Dec 2012
Posts: 16

PostPosted: Tue Jun 29, 2021 3:27    Post subject: Reply with quote
Wildlion wrote:
Code:

ip link set eth0 down

but I want to be able to login via the ethernet i/f to reenable the wan interface.
SurprisedItWorks
DD-WRT Guru


Joined: 04 Aug 2018
Posts: 1447
Location: Appalachian mountains, USA

PostPosted: Tue Jun 29, 2021 14:53    Post subject: Reply with quote
I'm not sure what routers people are on here, but eth0 isn't used the same way in all routers. In the "modern" Marvell/Linksys WRT**** routers, which is my world here (unfortunately), eth0 is the WAN and eth1 covers the LAN ports.

To tweak Wildlion's suggestion just a bit, is this what you are looking for?

ip link set $(get_wanface) down
ip link set $(get_wanface) up


If that $( ) notation is new to you, try the commands with "echo" (and a space) out front just to see what they would do.

_________________
2x Netgear XR500 and 3x Linksys WRT1900ACSv2 on 53544: VLANs, VAPs, NAS, station mode, OpenVPN client (AirVPN), wireguard server (AirVPN port forward) and clients (AzireVPN, AirVPN, private), 3 DNSCrypt providers via VPN.
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 1416

PostPosted: Tue Jun 29, 2021 22:48    Post subject: Reply with quote
@SurpisedItWorks

yeah I was being lazy

@ob2s

there are other ways like you said using an iptables command but it needs to be first to ensure that any other rules do not process

You could also just unplug the cable if it is in an easy location

You could set the default routes to be null

My original suggestion fit the term of "disable" and reenable the interface from the command line.
ob2s
DD-WRT Novice


Joined: 04 Dec 2012
Posts: 16

PostPosted: Wed Jun 30, 2021 5:02    Post subject: Reply with quote
very cool, very simple, thanks
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum