ndejong / pfsense_fauxapi

REST based API interface for pfSense 2.3.x and 2.4.x to facilitate devops

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Newly created VLAN/Interface is "down"

phase5 opened this issue · comments

I noted a very similar issue #2 and I am sending (via bash client for testing currently) the full json document that was previously retrieved, with the sections added for the new VLAN/Interface (and also DHCP config) I wanted to send.

I will try to clearly lay out what I did here: -

First I set up a clean server and downloaded the config.xml using your API.

Then I added VLAN 75 on interface igb1.
I then added the interface (opt1), set an IP. (IPv4)
I then enabled DHCP Server on this interface and added a simple range.

At this point I re-downloaded config.xml and used diff to see the result of my changes above.

I then duplicated the newly added sections but changed (on the duplicate elements): -
VLAN ID from 75 to 76
IP Address to be a non-conflicting subnet.
opt1 to opt2
and the vlan interface from igb1_vlan75 to igb1_vlan76

I then set this new config and got an OK response.
{"callid":"593b30536e267","action":"config_set","message":"ok","data":{"do_backup":true,"do_reload":true}}

When looking in the GUI after posting the new config via the API, I can see that what I added has been created but the interface shows as down.

Going in with ssh and running ipconfig shows me that it did not actually create the vlan tagged interface "igb1_vlan76"

Any idea what I did wrong?
Any help you can offer would be very much appreciated.

config-cleaned.zip

Thank you for the prompt response.

I can confirm that the interfaces are present and correct after a reboot.
There is an easy work-around for me in this case where I can just have a batch of vlans created in advance.

I will certainly have a look at the extra functionality when you have it implemented though.

I spent a little more time on this over the past week and it seems the problem does indeed extend to interfaces as well as VLAN's.

If I pre-create my VLAN's in bulk as described earlier, that part is fine.
However, if I then create a new interface on one of those VLANs, assign it a static IP and explicitly mark it as enabled then I do get the adapter showing up but the IP on the summary page is missing and the new routes do not appear in the routing table. Going into the interface, unticking enabled, save, tick enabled again, save and then apply resolves the issue.

Something probably related is that if I do the above to make an interface work, but later remove the interface (via API) and then add another one (with a different IP but the same adapter name) the the interface shows up immediately but shows the old IP address. Routing table follows suit too.

If I remove a working adapter then the routes and actual interface appear to remain active behind the scenes.

The only way I have found to overcome this so far is to reboot, which is not really feasible to do on a regular basis.

Anyone got any idea's how I might work around this? I am not in a position to pre-create 500 interfaces like I am VLAN's. I did notice there were "modified by X person on X date" fields around the json and I wondered if anyone knew if they were in any way related to triggering pfSense to actually apply the changes.

Hi N,

Thanks very much. I have done quite a few tests with your suggestion and it appears to work perfectly.
I cannot confirm if it affects the previous vlan issue because I have them all pre-created now, but I suspect it may well sort that too. It has certainly sorted my issue above and 2 other related issues we found since.

I had seen the send event thing before but hadn't realized it supported reloading all interfaces like that. Maybe you could add a second example under the "filter reload" one for the "interface reload all", which would then make it really obviously.

I can't thank you enough for that pointer. We had resigned to living with having to go in the click SAVE APPLY all the time.