Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    How to get interface port names?

    Scheduled Pinned Locked Moved General pfSense Questions
    2 Posts 2 Posters 658 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      cnd.fflv
      last edited by

      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>

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        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.inc

        Steve

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.