The Switch can be managed through the Switch’s serial port, Telnet, SNMP or the Web-based
management agent. The Command Line Interface (CLI) can be used to configure and manage the
Switch via the serial port or Telnet interfaces.
This manual provides a reference for all of the commands contained in the CLI. Every command
will be introduced in terms of purpose, format, description, parameters, and examples.
Configuration and management of the Switch via the Web-based management agent are
discussed in the Web UI Reference Guide. For detailed information on installing hardware please
also refer to the Hardware Installation Guide.
1-1 Accessing the Switch via the Ser ial Port
The Switch’s serial port’s default settings are as follows:
• 115200 baud
• no parity
• 8 data bits
• 1 stop bit
A computer running a terminal emulation program capable of emulating a VT-100 terminal and a
serial port configured as above are then connected to the Switch’s Console port via an included
RS-232 to RJ-45 convertor cable.
With the serial port properly connected to a management computer, the following screen should be
visible.
DGS-3120-24TC Gigabit Ethernet Switch
Command Line Interface
Firmware: Build 3.10.512
Copyright(C) 2014 D-Link Corporation. All rights reserved.
UserName:
PassWord:
DGS-3120-24TC:admin#
There is no initial username or password. Just press the Enter key twice to display the CLI input
cursor − DGS-3120-24TC:admin# . This is the command line where all commands are input.
1-2 Setting the Switch’s IP Address
Each Switch must be assigned its own IP Address, which is used for communication with an
SNMP network manager or other TCP/IP application (for example BOOTP, TFTP). The Switch’s
DGS-3120-24TC:admin# config ipif System ipaddress 10.24.22.100/255.0.0.0
DGS-3120-24TC:admin#
default IP address is 10.90.90.90. You can change the default Switch IP address to meet the
specification of your networking address scheme.
The Switch is also assigned a unique MAC address by the factory. This MAC address cannot be
changed, and can be found on the initial boot console screen – shown below.
The Switch’s MAC address can also be found in the Web management program on the Switch
Information (Basic Settings) window on the Configuration menu.
The IP address for the S wit c h must be set before it can be managed with the Web-based manager.
The Switch IP address can be automatically set using BOOTP or DHCP protocols, in which case
the actual address assigned to the Switch must be known.
Starting at the command line prompt, enter the commands config ipif System ipaddress xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy. Where the x’s represent the IP address to be assigned to the
IP interface named System and the y’s represent the corresponding subnet mask.
Alternatively, you can enter config ipif System ipaddress xxx.xxx.xxx.xxx/z. Where the x’s
represent the IP address to be assigned to the IP interface named System and the z represents
the corresponding number of subnets in CIDR notation.
The IP interface named System on the Switch can be assigned an IP address and subnet mask
which can then be used to connect a management station to the Switch’s Telnet or Web-based
management agent.
Command: config ipif System ipaddress 10.24.22.100/8
Success.
In the above example, the Switch was assigned an IP address of 10.24.22.100 with a subnet mask
of 255.0.0.0. The system message Success indicates that the command was executed
successfully. The Switch can now be configured and managed via Telnet, SNMP MIB browser and
the CLI or via the Web-based management agent using the above IP address to connect to the
Switch.
When entering a command without its required parameters, the CLI will prompt you with a Next
possible completions: message.
Command: config account
Next possible completions:
<username 15>
In this case, the command config account was entered with the parameter <username 15>. The
CLI will then prompt to enter the <username 15 > with the message, Next possible completions:.
Every command in the CLI has this feature, and complex commands have several layers of
parameter prompting.
In addition, after typing any given command plus one space, users can see all of the next possible
sub-commands, in sequential order, by repeatedly pressing the Tab key.
To re-enter the previous command at the command prompt, press the up arrow cursor key. The
previous command will appear at the command prompt.
Command: config account
Next possible completions:
<username 15>
In the above example, the command config account was entered without the required parameter
<username 15>, the CLI returned the Next possible completions: <username 15> prompt. The
up arrow cursor control key was pressed to re-enter the previous command (config account) at
the command prompt. Now the appropriate username can be entered and the config account
command re-executed.
All commands in the CLI function in this way. In addition, the syntax of the help prompts are the
same as presented in this manual − angle brackets < > indicate a numerical value or character
string, braces { } indicate optional parameters or a choice of parameters, and brackets [ ] indicate
required parameters.
If a command is entered that is unrecognized by the CLI, the top-level commands will be displayed
under the Available commands: prompt.
Available commands:
.. ? cable_diag cd
cfm change clear config
copy create debug del
delete dir disable download
enable erase execute format
install login logout md
move no ping ping6
rd reboot reconfig rename
reset save show smtp
telnet traceroute traceroute6 upload
The top-level commands consist of commands such as show or config. Most of these commands
require one or more param eter s to narr o w the top-level command. This is equivalent to show what?
or config what? Where the what? is the next parameter.
For example, entering the show command with no additional parameters, the CLI will then display
all of the possible next parameters.
In the above example, all of the possible next parameters for the show command are displayed. At
the next command prompt, the up arrow was used to re-enter the show command, followed by the
account parameter. The CLI then displays the user accounts configured on the Switch.
Encloses a variable or value. Users must specify the variable or value.
square brackets [ ]
Encloses a required value or list of required arguments. Only one value or
vertical bar |
Separates mutually exclusive items in a list. For example, in the syntax
braces { }
Encloses an optional value or a list of optional arguments. One or more
parentheses ( )
Indicates at least one or more of the values or arguments in the preceding
ipif <ipif_name 12>
12 means the maximum length of the IP interface name.
Keys
Description
Delete
Delete character under cursor and shift remainder of line to left.
Backspace
Delete character to left of cursor and shift remainder of line to left.
CTRL+R
Toggle on and off. When toggled on, inserts text and shifts previous
1-3 Command Syntax Symbols
For example, in the syntax
config command_history <value 1-40>
users must enter how many entries for <valu e 1-40> when entering the
command. DO NOT TYPE THE ANGLE BRACKETS.
argument must be specified. For example, in the syntax
create account [admin | operator | power_user | user] <username 15>
{encrypt [plain_text | sha_1] <password>}
users must specify either the admin, operator, power_user or user-level
account when entering the command. DO NOT TYPE THE SQUARE
BRACKETS.
metric <value 1-31>
reset {[config | system]} {force_agree}
users must specify either the community or trap receiver in the command.
DO NOT TYPE THE VERTICAL BAR.
values or arguments can be specified. For example, in the syntax
reset {[config | system]} {force_agree}
users may choose configure or system in the command. DO NOT TYPE
THE BRACES.
syntax enclosed by braces must be specified. For example, in the syntax
config bpdu_protect ion port s [<portlis t > | all] {state [ena ble | disab le] |
mode [drop | block | shutdown]}(1)
users have the option to specify hops or time or both of them. The "(1)"
following the set of braces indicates at least one argum ent or value within
the braces must be specified. DO NOT TYPE THE PARENTHESES.
Display the remaining pages. (The screen display will not pause again.)
Enter
Display the next line.
The screen display pauses when the show command output reaches the end of the page.
In the above example, all of the possible next parameters for the show command are displayed. At
the next command prompt, the up arrow was used to re-enter the show command, followed by the
account parameter. The CLI then displays the user accounts configured on the Switch.
This command is used to configure the serial bit rate that will be used to communicate with the
management host and the auto logout time for idle connections.
9600 - Specify the serial bit rate to be 9600.
19200 - Specify the serial bit rate to be 19200.
38400 - Specify the serial bit rate to be 38400.
never - Never timeout.
2_minutes - When idle over 2 minutes, the device will auto logout.
5_minutes - When idle over 5 minutes, the device will auto logout.
10_minutes - When idle over 10 minutes, the device will auto logout.
Restrictions
Only Administrator and Operator-level users can issue this command.
Example
To configure baud rate:
Command: config serial_port baud_rate 9600
Success.
2-4enable clipaging
Description
This command is used to enable the pausing of the screen display when the show command
output reaches the end of the page. For those show commands that provide the display refresh
function, the displa y will not be r ef r eshed whe n cli pag in g is dis a ble d. T he def aul t s etti ng is e nab led .
Only Administrator and Operator-level users can issue this command.
Example
To enable pausing of the screen display when show command output reaches the end of the page:
Command: enable clipaging
Success.
2-5disable clipaging
Description
This command is used to disable the pausing of the screen display when the show command
output reaches the end of the page. The default setting is enabled.
Format
disable clipaging
Parameters
None.
Restrictions
Only Administrator and Operator-level users can issue this command.
Example
To disable pausing of the screen display when s ho w c om mand output reaches the end of the p ag e:
Command: disable clipaging
Success.
2-6login
Description
This command is used to allow user login to the Switch.
<Function Key> <Control Key>
Ctrl+C Quit without save left/right/
Ctrl+W Save and quit up/down Move cursor
Ctrl+D Delete line
Ctrl+X Erase all setting
Ctrl+L Reload original setting
<string 16> - Enter the new command prompt string of no more than 16 characters.
username - Enter this command to set the login username as the command prompt.
default - Enter this command to return the command prompt to its original factory default value.
DGS-3120-24TC:admin#config command_prompt Prompt#
Prompt#:admin#
a string consisting of a maximum of 16 characters, or to be replaced with the users’ login user
name.
When users issue the “reset” command, the current command prompt will remain in tact. Yet,
issuing the “reset system” will return the command prompt to its original factory default value.
Only Administrator and Operator-level users can issue this command.
Example
To edit the command prompt:
Command: config command_prompt Prompt#
Success.
2-15config terminal width
Description
The command is used to set current terminal width.
The usage is described as below:
1. Users login and configure the terminal width to 120, this configuration take effect on this
login section. If users implement “save” command, the configuration is saved. After users
log out and log in again, the terminal width is 120.
2. If user did not save the configuration, another user login, the term inal width is default value.
3. If at the same time, two CLI sessions are running, once section configure to 120 width and
save it, the other section will not be effected, unless it log out and then log in.
fiber - Specify that the medium type will be set to fiber.
auto - Set port speed to auto negotiation.
capability_advertised - (Optional) Specify that the capability will be advertised.
10_half - (Optional) Set port speed to 10_half.
10_full - (Optional) Set port speed to 10_full.
100_half - (Optional) Set port speed to 100_half.
100_full - (Optional) Set port speed to 100_full.
1000_full - (Optional) Set port speed to 1000_full.
10_half - Set port speed to 10_half.
10_full - Set port speed to 10_full.
100_half - Set port speed to 100_half.
100_full - Set port speed to 100_full.
1000_full - Set port speed to 1000_full. While set port speed to 1000_full. User should specify
master or slave mode for 1000BASE-T interface, and leave the 1000_full without any
master or slave setting for other interface.
master - Specify that the port(s) will be set to master.
restart_an - Specify to restart auto-negoti ati on proc es s.
remote_fault_advertised – Specify that the fault conditions will be remotely advertised when
the next auto-negotiation process takes place.
disable - Remote fault advertisement is disabled.
offline - Local devices that were powered off or removed from the active configuration will
be advertised at the next auto-negotiation.
link_fault - Local devices that disconnected due to link failure will be advertised at the next
auto-negotiation.
auto_negotiation_error - The resolution that precludes operation between local devices
flow_control to enable or disable.
enable - Specify that the flow control option will be enabled.
media_type - (Optional) Displays port transceiver type.
disabled status , configure their state to enable will recover these ports from disabled to
enable state.
enable - Specify that the port state will be enabled.
normal state, the port is in the MDIX mode and can be connected to PC NIC using a straight
cable. If set to cross state, the port is in mdi mode, and can be connected to a port (in mdix
mode) on another switch thru a straight cable.
auto - Specify that the MDIX mode for the port will be set to auto.
normal - Specify that the MDIX mode for the port will be set to normal.
<desc 1-32> - Enter the port interface description here. This value can be up to 32 characters
speed when a link cannot be established at the available speed.
enable - Enable the automatically downgrading advertised speed.
Restrictions
Only Administrator and Operator-level users can issue this command.
Example
To configure the ports:
Command: config ports all medium_type copper speed auto
Success.
2-18show ports
Description
This command is used to display the current configurations of a range of ports.
DGS-3120-24TC:admin# create vlan v2 tag 2 type 1q_vlan advertisement
DGS-3120-24TC:admin#
vlanid - The VLAN ID list to be created.
<vidlist> - Enter the VLAN ID list here.
type - (Optional) Specify the type of VLAN to be created.
private_vlan – (Option al) Spec ify that the private VLAN type will be used.
advertisement - (Optional) Specify the VLAN as being able to be advertised out.
DGS-3120-24TC:admin# create vlan vlanid 10-30
DGS-3120-24TC:admin#
Restrictions
Only Administrator, Operator and Power-User level users can issue this command.
Example
To create a VLAN with name “v2” and VLAN ID 2:
Command: create vlan v2 tag 2 type 1q_vlan advertisement
Success.
3-2create vlan vlanid
Description
This command is used to create more than one VLANs at a time. A unique VLAN name (e.g.
VLAN10) will be automatically assigned by the system. The automatic assignment of VLAN name
is based on the following rule: “VLAN”+ID. For example, for VLAN ID 100, the VLAN name will be
VLAN100. If this VLAN name is conflict with the name of an existing VLAN, then it will be renamed
based on the following rule: “VLAN”+ID+”ALT”+ collision count. For example, if this conflict is the
second collision, then the name will be VLAN100ALT2.