This publication, including all photographs, illustrations and software, is protected under international copyright laws, with all rights reserved. Neither this manual, nor any of the material contained
herein, may be reproduced without written consent of the author.
Disclaimer
The information in this document is subject to change without notice. The manufacturer makes no
representations or warranties with respect to the contents hereof and specifically disclaim any implied warranties of merchantability or fitness for any particular purpose. The manufacturer reserves
the right to revise this publication and to make changes from time to time in the content hereof
without obligation of the manufacturer to notify any person of such revision or changes.
Limitations of Liability
UNDER NO CIRCUMSTANCES SHALL D-LINK OR ITS SUPPLIERS BE LIABLE FOR DAMAGES OF ANY CHARACTER (E.G. DAMAGES FOR LOSS OF PROFIT, SOFTWARE RESTORATION, WORK STOPPAGE, LOSS OF SAVED DATA OR ANY OTHER COMMERCIAL
DAMAGES OR LOSSES) RESULTING FROM THE APPLICATION OR IMPROPER USE OF
THE D-LINK PRODUCT OR FAILURE OF THE PRODUCT, EVEN IF D-LINK IS INFORMED
OF THE POSSIBILITY OF SUCH DAMAGES. FURTHERMORE, D-LINK WILL NOT BE LIABLE FOR THIRD-PARTY CLAIMS AGAINST CUSTOMER FOR LOSSES OR DAMAGES.
D-LINK WILL IN NO EVENT BE LIABLE FOR ANY DAMAGES IN EXCESS OF THE
AMOUNT D-LINK RECEIVED FROM THE END-USER FOR THE PRODUCT.
Table of Contents
Preface ............................................................................................................... ix
2.10. Show a range of rules ....................................................................................42
viii
Preface
Audience
The target audience for this reference guide is:
•Administrators that are responsible for configuring and managing the D-Link Firewall.
•Administrators that are responsible for troubleshooting the D-Link Firewall.
This guide assumes that the reader is familiar with the D-Link Firewall, and has the necessary basic
knowledge in network security.
Notation
The following notation is used throughout this reference guide when specifying the options of a
command:
Angle brackets <name> or
-option=<description>
Square brackets [option] or
-option[=value]
Curly brackets {value1 | value2 |
Used for specifying the name of an option or a description of
a value.
Used for specifying that an option or a value for an option is
optional and can be omitted.
Used for specifying the available values for an option.
value3}
Ellipsis ...
Used for specifying that more than one value can be specified
for the option.
Example 1. Command option notation
One of the usages for the help command looks like this:
help -category={COMMANDS | TYPES} [<Topic>]
This means that help has an option called category which has two possible values which are COMMANDS and
TYPES. There is also an optional option called Topic which in this case is a search string used to specify what
help topic to display. Since the topic is optional, it is possible to exclude it when running the command.
Both of the following examples are valid for the usage described above:
gw-world:/> help -category=COMMANDS
gw-world:/> help -category=COMMANDS activate
None of the options of this command are mandatory. The flushl3cache option also has an optional value. This
is because that option has a default value, 100, which will be used if no value is specified.
The following two examples will yield the same result:
Because the table name option is followed by ellipses it is possible to specify more than one routing table.
Since table name is optional as well, the user can specify zero or more policy-based routing tables.
gw-world:/> routes Virroute Virroute2
x
Chapter 1. Introduction
• Running a command, page 1
• Help, page 2
• Function keys, page 3
• Command line history, page 4
• Tab completion, page 5
• User roles, page 7
This guide is a reference for all commands and configuration object types that are available in the
command line interface for NetDefendOS.
1.1. Running a command
The commands described in this guide can be run by typing the command name and then pressing
the return key. Many commands require options to be set to run. If a required option is missing a
brief syntax help will be displayed.
1
1.2. HelpChapter 1. Introduction
1.2. Help
1.2.1. Help for commands
There are two ways of getting help about a command. A brief help is displayed if the command
name is typed followed by -? or -h. This applies to all commands and is therefore not listed in the
option list for each command in this guide. Using the help command gives a more detailed help corresponding to the information found in this guide. In most cases it is possible to simply type help
followed by the command name to get the full help. See Section 2.4.1, “help” for a more detailed
description. To list the available commands, just type help and press return.
Example 1.1. Help for commands
Brief help for the activate command:
gw-world:/> activate -?
gw-world:/> activate -h
Full help for activate:
gw-world:/> help activate
Help for the arp command. Arp is also the name of a configuration object type, so it is necessary to specify that
the help text for the command should be displayed:
gw-world:/> help -category=COMMANDS arp
List all available commands:
gw-world:/> help
1.2.2. Help for object types
To get help about configuration object types, use the help command. It is also possible to get information about each property in an object type, such as data type, default value, etc. by entering the
? character when entering the value of a property and pressing tab. More on this in Section 1.5.1,
“Inline help”.
Example 1.2. Help for object types
Full help for IP4Address:
gw-world:/> help IP4Address
Help for the ARP configuration object type, which collides with the arp command:
gw-world:/> help -category=TYPES ARP
2
1.3. Function keysChapter 1. Introduction
1.3. Function keys
In addition to the return key there are a number of function keys that are used in the CLI.
Backspace
Tab
Ctrl-A or Home
Ctrl-B or Left Arrow
Ctrl-C
Ctrl-D or Delete
Ctrl-E or End
Ctrl-F or Right Arrow
Ctrl-K
Ctrl-N or Down Arrow
Ctrl-P or Up Arrow
Ctrl-T
Ctrl-U
Ctrl-W
Delete the character to the left of the cursor.
Complete current word.
Move the cursor to the beginning of the line.
Move the cursor one character to the left.
Clear line or cancel page view if more than one page of informa-
tion is shown.
Delete the character to the right of the cursor.
Move the cursor to the end of the line.
Move the cursor one character to the right.
Delete from the cursor to the end of the line.
Show the next entry in the command history.
Show the previous entry in the command history.
Transpose the current and the previous character.
Delete from the cursor to the beginning of line.
Delete word backwards.
3
1.4. Command line historyChapter 1. Introduction
1.4. Command line history
Every time a command is run, the command line is added to a history list. The up and down arrow
keys are used to access previous command lines (up arrow for older command lines and down arrow
to move back to a newer command line). See also Section 2.4.2, “history”.
Example 1.3. Command line history
Using the command line history via the arrow keys:
gw-world:/> show Address
gw-world:/> (up arrow)
gw-world:/> show Address (the previous commandline is displayed)
4
1.5. Tab completionChapter 1. Introduction
1.5. Tab completion
By using the tab function key in the CLI the names of commands, options, objects and object properties can be automatically completed. If the text entered before pressing tab only matches one possible item, e.g. "activate" is the only match for "acti" if a command is expected, the name will be
autocompleted. Should there be more than one match the part common to all matches will be completed. At this point the user can either enter more characters or press tab again, which will display a
list of the possible completions. This can also be done without entering any characters, but the resulting list might be long if there are many possible completions, e.g. all commands.
Example 1.4. Tab completion
An example of tab completion when using the add command:
gw-world:/> add Add (tab)
gw-world:/> add Address ("ress" was autocompleted)
gw-world:/> add Address i (tab)
gw-world:/> add Address IP4 ("IP4" was autocompleted)
gw-world:/> add Address IP4 (tab, or double tab if IP4 were entered manually)
A list of all types starting with IP4 is listed.
gw-world:/> add Address IP4a (tab)
gw-world:/> add Address IP4Address ("Address" was autocompleted)
gw-world:/> add Address IP4Address example_ip a (tab)
gw-world:/> add Address IP4Address example_ip Address= ("Address=" was autocompleted)
gw-world:/> add Address IP4Address example_ip Address=1.2.3.4
Tab completion of references:
gw-world:/> set Address IP4Group examplegroup Members= (tab, tab)
A list of valid objects is displayed.
gw-world:/> set Address IP4Group examplegroup Members=e (tab)
gw-world:/> set Address IP4Group examplegroup Members=example_ip
("xample_ip" was autocompleted)
1.5.1. Inline help
It is possible to get help about available properties of configuration objects while a command line is
being typed by using the ? character. Write ? instead of a property name and press tab and a help
text for the available properties is shown. If ? is typed in stead of a property value and tab is pressed
a help text for that property which contains more information such as data type, default value, etc. is
displayed.
Example 1.5. Inline help
Get inline help for all properties of an IP4Address:
gw-world:/> set IP4Address example_ip ? (tab)
A help text describing all available properties is displayed.
Getting inline help for the Address property:
gw-world:/> set IP4Address example_ip Address=? (tab)
A more detailed help text about Address is displayed.
1.5.2. Autocompleting current value and default value
Another special character that can be used together with tab completion is <. If < is entered instead
of a property value and tab is pressed it will be replaced by the current value of that property. This is
5
1.5.3. Configuration object type categories
useful when editing an existing list of items or a long text value. If no value has been set yet for the
property in question the default value, if one exists, will be used. Some values, such as binary data,
cannot be autocompleted in this way.
Example 1.6. Edit an existing property value
Edit the current value:
gw-world:/> add IP4Address example_ip Address=1.2.3.4
gw-world:/> set IP4Address example_ip Address=< (tab)
gw-world:/> set IP4Address example_ip Address=1.2.3.4 (the value was inserted)
The value can now be edited by using the arrow keys or backspace.
gw-world:/> set IP4Group examplegroup Members=ip1,ip2,ip3,ip5
gw-world:/> set IP4Group examplegroup Members=< (tab)
gw-world:/> set IP4Group examplegroup Members=ip1,ip2,ip3,ip5
(the value was inserted)
It is now possible to add or remove a member to the list without having to enter all
the other members again.
Edit the default value:
gw-world:/> add LogReceiverSyslog example Address=example_ip LogSeverity=< (tab)
gw-world:/> add LogReceiverSyslog example Address=example_ip LogSeverity=Emergency,
Alert,Critical,Error,Warning,Notice,Info (the default value was inserted)
Now it is easy to remove a log severity.
Chapter 1. Introduction
1.5.3. Configuration object type categories
Some object types are grouped together in a category in the CLI. This only matters when using tab
completion as they are used to limit the number of possible completions when tab completing object
types. The category can always be omitted when running commands if the type name is entered
manually.
Example 1.7. Using categories with tab completion
Accessing an IP4Address object with the use of categories:
gw-world:/> show ad (tab)
gw-world:/> show Adress (the category is autocompleted)
gw-world:/> show Adress ip4a (tab)
gw-world:/> show Adress IP4Address (the type is autocompleted)
gw-world:/> show Adress IP4Address example_ip
Accessing an IP4Address object without the use of categories:
gw-world:/> show IP4Address example_ip
6
1.6. User rolesChapter 1. Introduction
1.6. User roles
Some commands and options cannot be used unless the logged in user has administrator priviege.
This is indicated in this guide by a note following the command or "Admin only" written next to an
option.
7
1.6. User rolesChapter 1. Introduction
8
Chapter 2. Command Reference
• Configuration, page 9
• Runtime, page 20
• Utility, page 50
• Misc, page 51
2.1. Configuration
2.1.1. activate
Activate changes.
Description
Activate the latest changes.
This will issue a reconfiguration, using the new configuration. If the reconfiguration is successful a
commit command must be issued within the configured timeout interval in order to save the
changes to media. If not, the system will revert to using the previous version of the configuration.
Usage
activate
2.1.2. add
Create a new object.
Description
Create a new object and add it to the configuration.
Specify the type of object you want to create and the identifier, if the type has one, unless the object
is identified by an index. Set the properties of the object by writing the propertyname equals (=) and
then the value. An optional category can be specified for some object types when using tab completion.
If a mandatory property isn't specified a list of errors will be shown after the object is created. If an
invalid property or value type is specified or if the identifier is missing the command will fail and
not create an object.
Note
Requires Administrator privilege.
Adjustments can be made after the object is created by using the set command.
9
2.1.3. cancelChapter 2. Command Reference
Example 2.1. Create a new object
Add objects with an identifier property (not index):
gw-world:/> add Address IP4Address example_ip Address=1.2.3.4
Comments="This is an example"
gw-world:/> add IP4Address example_ip2 Address=2.3.4.5
Cancel commit operation immediately, without waiting for the timeout.
Usage
Category that groups object types.
The property that identifies the configuration object. May not be applic-
able depending on the specified <Type>.
One or more property-value pairs, i.e. <property name>=<value> or
<property name>="<value>".
Type of configuration object to perform operation on.
Note
Requires Administrator privilege.
cancel
Note
Requires Administrator privilege.
10
2.1.5. cdChapter 2. Command Reference
2.1.4. cc
Change the current context.
Description
Change the current configuration context.
A context is a group of objects that are dependent on and grouped by a parent object. Many objects
lie in the "root" context and do not have a specific parent. Other objects, e.g. User objects lie in a
sub-context (or child context) of the root - in this case in a LocalUserDatabase. In order to add or
modify users you have to be in the correct context, e.g. a LocalUserDatabase called "exampledb".
Only objects in the current context can be accessed.
Example 2.2. Change context
Change to a sub/child context:
gw-world:/> cc LocalUserDatabase exampledb
gw-world:/exampledb>
Go back to the parent context:
gw-world:/ospf1/area1> cc ..
gw-world:/ospf1> cc ..
gw-world:/>
Go back to the root context:
gw-world:/ospf1/area1> cc
gw-world:/>
or
gw-world:/ospf1/area1> cc /
gw-world:/>
Usage
cc [<Category>] <Type> <Identifier>
Change the current context.
cc -print
Print the current context.
cc
Change to root context (same as "cc /").
Options
-print
<Category>
<Identifier>
<Type>
Print the current context.
Category that groups object types.
The property that identifies the configuration object. May not be applicable
depending on the specified <Type>.
Type of configuration object to perform operation on.
11
2.1.6. commitChapter 2. Command Reference
2.1.5. cd
Alias for cc.
2.1.6. commit
Save new configuration to media.
Description
Save the new configuration to media. This command can only be issued after a successful activate
command.
Usage
commit
2.1.7. copy
Copy object.
Description
Make a copy of a configuration object. The created copy will have identical values for all properties,
except for the identifier, which is modified to be unique for the new object.
Some objects can't be copied. It is not possible to copy an object that has child objects. Also it is not
possible to copy for example "DNS" and "DateTime", as there can only be a single instance of these
object types.
Category that groups object types.
The property that identifies the configuration object. May not be applicable
depending on the specified <Type>.
Parent of new object.
Type of configuration object to perform operation on.
12
2.1.9. enterChapter 2. Command Reference
2.1.8. delete
Delete specified objects.
Description
Delete the specified object, removing it from the configuration.
Add the force flag to delete the object even if it is referenced by other objects or if it is a context that
has child objects that aren't deleted. This may cause objects referring to the specified object or one
of its children to get errors that must be corrected before the configuration can be activated.
See also: undelete
Example 2.3. Delete an object
Delete an unreferenced object:
gw-world:/> delete Address IP4Address example_ip
Delete a referenced object:
(will cause error in examplerule)
Force object to be deleted even if it's used by other objects or has children.
Category that groups object types.
The property that identifies the configuration object. May not be applicable
depending on the specified <Type>.
Type of configuration object to perform operation on.
Note
Requires Administrator privilege.
Alias for cc.
2.1.10. pskgen
Generate random pre-shared key.
13
2.1.11. rejectChapter 2. Command Reference
Description
Generate a pre-shared key of specified size, containing randomized key data. If a key with the specified name exists, the existing key is modified. Otherwise a new key object is created.
Comments for this key.
Number of bits of data in the generated key. (Default: 64)
Name of key.
Note
Requires Administrator privilege.
Reject the changes made to the specified object by reverting to the values of the last committed configuration.
All changes made to the object will be lost. If the object is added after the last commit, it will be removed.
To reject the changes in more than one object, use either the -recursive flag to delete a context
and all its children recursively or the -all flag to reject the changes in all objects in the configuration.
See also: activate, commit
Example 2.4. Reject changes
Reject changes in individual objects:
gw-world:/> set Address IP4Address example_ip
Comments="This comment will be rejected"
gw-world:/> reject Address IP4Address example_ip
gw-world:/> add Address IP4Address example_ip2 Address=1.2.3.4
Comments="This whole object will be removed"
gw-world:/> reject Address IP4Address example_ip2
Reject changes recursively:
(will reject changes in the user database and all users)
gw-world:/exampledb> set User user1 Comments="Something"
gw-world:/exampledb> set User user2 Comments="that will be"
14
2.1.12. setChapter 2. Command Reference
gw-world:/exampledb> set User user3 Comments="rejected"
gw-world:/exampledb> cc ..
gw-world:/> reject LocalUserDatabase exampledb -recursive
Reject all changes:
gw-world:/anycontext> reject -all
All changes since the last commit will be rejected:
(example_ip will be removed since it is newly added)
Reject all changes in the configuration.
Recursively reject changes.
Category that groups object types.
The property that identifies the configuration object. May not be applicable
depending on the specified <Type>.
Type of configuration object to perform operation on.
Note
Requires Administrator privilege.
Description
Set property values of configuration objects.
Specify the type of object you want to modify and the identifier, if the type has one. Set the proper-
ties of the object by writing the propertyname equals (=) and then the value. An optional category
can be specified for some object types when using tab completion.
If a mandatory property hasn't been specified or if a property has an error a list of errors will be
shown after the specified properties have been set. If an invalid property or value type is specified
the command will fail and not modify the object.
15
2.1.13. showChapter 2. Command Reference
See also: add
Example 2.5. Set property values
Set properties for objects that have an identifier property:
gw-world:/> set Address IP4Address example_ip Address=1.2.3.4
Comments="This is an example"
gw-world:/> set IP4Address example_ip2 Address=2.3.4.5
Comments=comment_without_whitespace
gw-world:/main> set Route 1 Comment="A route"
gw-world:/> set IPRule 12 Index=1
Set properties for an object without identifier:
gw-world:/> set DynDnsClientDyndnsOrg Username=example
Usage
set [<Category>] <Type> [<Identifier>] [-disable] [-enable]
[<key-value pair>]...
Options
-disable
-enable
<Category>
<Identifier>
<key-value pair>
<Type>
2.1.13. show
Disable object. This option is not available if the object is already disabled.
Enable object. This option is not available if the object is already enabled.
Category that groups object types.
The property that identifies the configuration object. May not be applic-
able depending on the specified <Type>.
One or more property-value pairs, i.e. <property name>=<value> or
<property name>="<value>".
Type of configuration object to perform operation on.
Note
Requires Administrator privilege.
Show objects.
Description
Show objects.
Show the properties of a specified object. There are a number of flags that can be specified to show
otherwise hidden properties. To show a list of object types and categories available in the current
context, just type show. Show a table of all objects of a type by specifying a type or a category. Use
16
2.1.13. showChapter 2. Command Reference
the -errors or -changes flags to show what objects have been changed or have errors in the
configuration.
When showing a table of all objects of a certain type, the status of each object since the last time the
configuration was committed is indicated by a flag. The flags used are:
-
The object is deleted.
o
The object is disabled.
!
The object has errors.
+
The object is newly created.
*
The object is modified.
Unchanged objects are not indicated by a flag.
When listing categories and object types, categories are indicated by [] and types where objects may
be contexts by /.
Example 2.6. Show objects
Show the properties of an individual object:
gw-world:/> show Address IP4Address example_ip
gw-world:/main> show Route 1
gw-world:/> show Client DynDnsClientDyndnsOrg
Show a table of all objects of a type and a selection of their
properties as well as their status:
gw-world:/> show Address IP4Address
gw-world:/> show IP4Address
Show a table of all objects for each type in a category:
gw-world:/> show Address
Show objects with changes and errors:
gw-world:/> show -changes
gw-world:/> show -errors
Show what objects use (refer to) a certain object:
gw-world:/> show Address IP4Address example_ip -references
Usage
show
Show the types and categories available in the current context.
show [<Category>] [<Type> [<Identifier>]] [-disabled] [-references]
Show an object or list a type or category.
show -errors [-verbose]
Show all errors.
show -changes
Show all changes.
17
2.1.14. undeleteChapter 2. Command Reference
Options
-changes
-disabled
-errors
-references
-verbose
<Category>
<Identifier>
<Type>
2.1.14. undelete
Restore previously deleted objects.
Description
Restore a previously deleted object.
Show all changes in the current configuration.
Show disabled properties.
Show all errors in the current configuration.
Show all references to this object from other objects.
Show error details.
Category that groups object types.
The property that identifies the configuration object. May not be applicable
depending on the specified <Type>.
Type of configuration object to perform operation on.
This is possible as long as the activate command has not been called.
See also: delete
The property that identifies the configuration object. May not be applicable
depending on the specified <Type>.
Type of configuration object to perform operation on.
Note
Requires Administrator privilege.
19
2.2. RuntimeChapter 2. Command Reference
2.2. Runtime
2.2.1. about
Show copyright/build information.
Description
Show copyright and build information.
Usage
about [-verbose]
Options
-verbose
2.2.2. arp
Show ARP entries for given interface.
Description
List the ARP cache entries of specified interfaces.
If no interface is given the ARP cache entries of all interfaces will be presented.
The presented list can be filtered using the ip and hw options.