You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to set a gateway (named "TRUEWAN") as the default gateway (there is already a default gw defined on WAN iface, i want to replace it).
In the documentation, i didn't see information about that, so i've naively done a GET on /api/v1/routing/gateway/detail (i've removed unecessary code) :
Currently it looks like this feature does not exist. The /api/v1/routing/gateway endpoint only interacts with the gateway objects directly, and the /api/v1/routing/gateway/detail can only be used to read verbose details about the configured gateway. An entirely new endpoint to update the default gateway would need to be added since pfSense stores the default gateway settings in a separate configuration area. That being said, this may be a feature that is small enough to justify including in the next patch. I plan on releasing a patch later this week or early next week. I can do a little research and see what would be required. I'll keep this open as a feature request in the meantime.
There are also a couple potential workarounds if you need something sooner:
You could try to update the gateway object that is currently set as the default gateway to use the interface, IP, etc. of your preferred gateway using a PUT request to /api/v1/routing/gateway. This may have undesired effects though and would not work with certain multi-WAN setups.
You could create your gateway using the /api/v1/routing/gateway endpoint, and then use the /api/v1/firewall/rule to create rules with the gateway field set your new gateway. This would enable policy-based routing for the rule and route matching traffic out the correct gateway. This could be used to simulate a default gateway without actually setting the default gateway. This may not be ideal if you have many configured interfaces as each would need a rule routing it out the correct gateway.
I'm trying to set a gateway (named "TRUEWAN") as the default gateway (there is already a default gw defined on WAN iface, i want to replace it).
In the documentation, i didn't see information about that, so i've naively done a GET on /api/v1/routing/gateway/detail (i've removed unecessary code) :
So, i've viewed
isdefaultgw
was set toTrue
for WAN_DHCP gateway. I thinked i had just to set this parameter during the POST:Data Request:
{'client-id': 'admin', 'client-token': 'pfsense', 'interface': 'em1', 'ipprotocol': 'inet', 'name': 'TRUEWAN', 'gateway': '192.168.200.100', 'monitor_disable': True, 'action_disable': True, 'isdefaultgw': True, 'apply': True}
Response:
{'status': 'ok', 'code': 200, 'return': 0, 'message': 'Success', 'data': {'interface': 'lan', 'ipprotocol': 'inet', 'name': 'TRUEWAN', 'nonlocalgateway': '', 'gateway': '192.168.200.100', 'monitor_disable': '', 'action_disable': '', 'monitor': '192.168.200.100', 'weight': 1, 'data_payload': 1, 'latencylow': 200, 'latencyhigh': 500, 'losslow': 10, 'losshigh': 20, 'interval': 500, 'loss_interval': 2000, 'time_period': 60000, 'alert_interval': 1000}}
BUT, setting this property seems to be ignored... What am i doing bad?
The text was updated successfully, but these errors were encountered: