How to get interface port names?
-
Hi there.
Let's say I want to execute in the shell script the following:
/sbin/ifconfig rl0 down
to bring LAN interface down.
But I do not want to use the specific port (i.e. rl0, vr1 etc.) here. Otherwise if I move this script to another pfSense box, I will have to edit it in order to adjust interface port on that box accordingly.
Is there a way to to use variable for this so it will work in any machine? Something like "/sbin/ifconfig <port for="" lan="" interface="">down"?
Thanks…</port>
-
You can almost certainly do this in php, though I never have. If you look into how this is done in pfSense is uses a function something like:
get_real_interface(LAN)#
It's a function in /etc/inc/interfaces.incSteve
Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.