pfSense interface switch?

Hi, I would like to know if its possible to switch a interface on or off or otherwise disable and enable an interface from HA for pfSense?

My WAN interface goes down every night at @ 2am, I would like a switch to be able to re-enable it for those naughty late nights.

I am doing this with a cron rule issuing ifconfig igb2 down,

I’m not sure how to do this via HA, SSH is obviously not enabled on my pfSense.

Any ideas?

Thanks

You should be able to use a RESTful switch sensor and the pfSense API to accomplish this. Judging from the github commits, this is still in active development.

1 Like

The pfSense Integration has some potential solutions using the “extremely advanced” services.

2 Likes

Thanks will look into this

1 Like

Thanks for this, can you please explain how this will work?

I am not sure what the endpoint would be to toggle a interface?

switch:
  - platform: rest
    resource: http://IP_ADDRESS/ENDPOINT

Thanks

I don’t have a pfSense, so I can’t accurately answer that, but if you install the pfSense API on your pfSense box, there should be a menu under System → API. From there, it looks like all the API endpoints are documented there.

Thanks, i’ve insalled the API,

However, according to the documentation I still cant work out how to actually switch a interface.

The API settings allowed me to select an interface to respond to API calls, just not sure what command to send to switch the interface.

I’m just going based on the source code in the repo, but I think it might be something like /api/v1/interface/apply? You might have to dig around a bit and see. The other thing might be to ask in the pfSense forums or here?

Yea, because based on the command above you gave, how would I send a up or down command to bring interface up or down.

Thanks for your help anyway I will keep digging

I honestly don’t see anything here explaining the extremely advanced functions

They are in the services example.

# extremely advanced, use with caution
# see EXEC_EXAMPLES.md
service: pfsense.exec_php
data:
  entity_id: binary_sensor.pfsense_localdomain_pending_notices_present
  script: |