create_network works but doesn't. #234
Unanswered
evolvetechllc
asked this question in
Q&A
Replies: 2 comments 5 replies
-
Please share your exact code (but sanitized) here. That will allow us to figure out what is going on. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Here is my code.... <?php
require_once('./UniFi-API-client/src/Client.php');
$unifi_connection = new UniFi_API\Client('username','password','https://{device ip}','default','8.4.62',false);
$login = $unifi_connection->login();
$network_to_add = array(
"setting_preference" => "manual",
"dhcpdv6_dns_auto" => 1,
"ipv6_pd_stop" => "::7d1",
"dhcpd_gateway_enabled" => null,
"network_isolation_enabled" => 1,
"ipv6_client_address_assignment" => "slaac",
"dhcpd_start" => "10.99.9.50",
"dhcpd_unifi_controller" => null,
"ipv6_ra_enabled" => 1,
"domain_name" => null,
"ip_subnet" => "10.99.9.1/24",
"ipv6_interface_type" => "none",
"dhcpdv6_stop" => "::7d1",
"is_nat" => 1,
"dhcpd_dns_enabled" => null,
"internet_access_enabled" => 1,
"nat_outbound_ip_addresses" => array(),
"dhcp_relay_enabled" => null,
"dhcpd_conflict_checking" => 1,
"ipv6_pd_auto_prefixid_enabled" => 1,
"name" => "Subnet999",
"site_id" => "{site id/random looking characters}",
"dhcpdv6_leasetime" => 86400,
"lte_lan_enabled" => 1,
"dhcpd_leasetime" => 28800,
"purpose" => "corporate",
"igmp_snooping" => null,
"dhcpd_time_offset_enabled" => null,
"dhcpguard_enabled" => null,
"dhcpdv6_allow_slaac" => 1,
"ipv6_ra_preferred_lifetime" => 14400,
"dhcpd_stop" => "10.99.9.254",
"enabled" => 1,
"dhcpd_enabled" => 1,
"vlan" => 503,
"dhcpd_wpad_url" => null,
"networkgroup" => "LAN",
"dhcpdv6_start" => "::2",
"vlan_enabled" => 1,
"ipv6_setting_preference" => "auto",
"gateway_type" => "default",
"ipv6_ra_priority" => "high",
"dhcpd_boot_enabled" => null,
"ipv6_pd_start" => "::2",
"upnp_lan_enabled" => null,
"dhcpd_ntp_enabled" => null,
"mdns_enabled" => null,
"dhcpd_tftp_server" => null,
"auto_scale_enabled" => null
);
/*$network_to_add = $network_settings = [
'name' => 'SampleNetwork',
'vlan' => 900,
'subnet' => '192.168.100.1/24',
'dhcpd_start' => '192.168.100.10',
'dhcpd_stop' => '192.168.100.250',
'dhcpd_enabled' => true,
'purpose' => 'corporate',
'is_nat' => true,
'enabled' => true
];*/
$x = $unifi_connection->create_network(json_encode($network_to_add));
if (!$x) { echo "Nope."; print_r($x); } else { print_r($x); }
$unifi_connection->logout();
But when I log into the console, that new network is nowhere to be found. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm able to connect successfully and for example list_networkconf works fine. However when I do a create_network, I get back a response with the with the site_id and _id, which presumably means the action worked, but when I go into the console the network doesn't show up. Also, if I do another list_networkconf, the "new" network isn't listed. Am I missing something?
Edit: I should mention this on a brand spanking new UDM Pro.
Beta Was this translation helpful? Give feedback.
All reactions