SonicOS: DHCP and Command Line Interface - CLI
Hi
I have many static MAC to IP assignments to configure and maintain, about 100.
You can do that through the GUI, like described here:
Is there an way to do this with the command line interface CLI? It would really help me. NSA4500 with SonicOS 6.5.3.
Thank you
Bernhard Henning, MPI for Animal Behaviour
Best Answers
-
shiprasahu93 Moderator
Hello @bernhardhenning,
Welcome to SonicWall community.
I can check for the exact commands and let you know. Here is the CLI reference guide with all commands.
Also, I just wanted to confirm that you have a NSA 4600; as NSA 4500 is a Gen 5 device which is no longer supported. Also, the CLI commands are very different for a Gen 5 unit.
You can give it a try. Meanwhile, I can test this in my lab and update you with my findings.
Thanks!
Shipra Sahu
Technical Support Advisor, Premier Services
5 -
shiprasahu93 Moderator
Here are the commands:
admin@18B169xxxxxx> config
config(18B169xxxxxx)# dhcp-server
(config-dhcp-server)# scope static <STATIC_SCOPE_IPV4_HOST> <STATIC_SCOPE_MAC>
(add-dhcp-server-static-scope)# netmask <IPV4_MASK>
(add-dhcp-server-static-scope)# default-gateway <IPV4_HOST>
(add-dhcp-server-static-scope)# commit
Eg: scope static 10.10.10.10 aa:bb:cc:dd:ee:ff
netmask 255.255.255.0
default-gateway 10.10.10.10
commit
I could see the following entry on the GUI post those commands
I hope that helps!
Thanks!
Shipra Sahu
Technical Support Advisor, Premier Services
5 -
Saravanan Moderator
Hi @BERNHARDHENNING,
Thank you for reaching SonicWall Community.
Yes, we can create static DHCP entries using CLI configuration. Please find the commands below and indeed a static scope creation that I attempted in my firewall.
> config
# DHCP-server
# scope static 192.168.10.1 aa:bb:cc:dd:ee:ff
# netmask 255.255.255.0
# commit
I can confirm that the scope is present in the GUI as well.
Hope this answers your question.
Regards
Saravanan V
Technical Support Advisor - Premier Services
Professional Services
5
Answers
config
dhcp-server
scope static 10.0.16.50 50:9A:4C:53:49:26
netmask 255.255.240.0
default-gateway 10.0.16.6
comment "some comment"
commit
This works! Thank you
Next step for we would be to wrap my ip-mac list, combined with the above learned CLI commands into one script. I think once I used a bash programm called expect for those kind of duties.
Have a nice day, Regards Bernhard
Amazing. Glad I could help. Have a wonderful day!
Shipra Sahu
Technical Support Advisor, Premier Services
Old thread, but super useful!
Sonicwall Migration Tool online returns corrupt .exp files from some older models (though reports "successful", bricks gen 7 firewalls, frustrating) Had many static DHCP scopes to configure, and CLI was a huge lifesaver!
Steps- Open old firewall and copy from Lease Scopes screen.
It gives something like:
1 Static IP: 192.168.1.113 for MAC aa:bb:cc:dd:ee:ff Unknown Details Edit Delete
2 Static IP: 192.168.1.114 for MAC aa:bb:cc:dd:ee:ff Unknown Details Edit Delete
3 Static IP: 192.168.1.119 for MAC aa:bb:cc:dd:ee:ff
Massage (find/replace, I used Notepad++) the various lines into format:
scope static 192.168.1.119 aa:bb:cc:dd:ee:ff
netmask 255.255.255.0
name "Toshiba Color"
commit
exit
scope static 192.168.1.139 aa:bb:cc:dd:ee:ff
netmask 255.255.255.0
name "HP Build Station"
commit
exit
scope static 192.168.1.141 aa:bb:cc:dd:ee:ff
netmask 255.255.255.0
name "MagicJack"
commit
exit
Follow directions previously given, and all will flow into place in a single shot. Saved me MANY HOURS of mistyping MAC and IP addresses!
All of mine are target devices, so didn't bother with DNS, Gateways, etc, on most, but those, along with Comments and plenty of other options can be set in the same manner.