Configure IP Address Settings On A Switch Using The CLI - Cisco
Có thể bạn quan tâm
Objective
The switch can have multiple IP addresses. Each IP address can be assigned to specified interfaces or ports, Link Aggregation Groups (LAGs), or Virtual Local Area Networks (VLANs). To remotely manage the device, an IP address must be defined to access the switch. This allows you to easily configure or troubleshoot the device through the web-based utility, Telnet, or Secure Shell (SSH).
The IP address of the switch can be manually configured or automatically received from a Dynamic Host Configuration Protocol (DHCP) server. If there are no DHCP servers available, the switch will use its factory default IP address which is 192.168.1.254.
This article provides instructions on how to configure the IP address settings of your switch through the Command Line Interface (CLI).
If you are unfamiliar with terms in this document, check out Cisco Business: Glossary of New Terms.
Applicable Devices
- Sx350 Series
- SG350X Series
- Sx500 Series
- Sx550X Series
Software Version
- 1.4.7.05 — Sx500
- 2.2.8.4 — Sx350, SG350X, Sx550X
Configure the IP Address of the Switch through the CLI
Important: If your switch is in one of the stacking modes with a Standby Switch present, it is recommended to configure a static IP address to prevent disconnecting from the network during a Stacking Active switchover. This is because when the standby switch takes control of the stack, when using DHCP, it might receive a different IP address than the one that was received by the original active-enabled unit of the stack.
Static IP Address
DHCP IP Address
Configure Static IP Address
In this scenario, the switch is set up without the availability of a DHCP server. Follow the steps below to configure a static IP address on the switch:
Step 1. Connect your computer directly to the switch using a serial cable.
If you would prefer to SSH into your switch, click here to view an article on gaining CLI access to a switch.
Step 2. Log in to the switch console. The default username and password is cisco/cisco. If you have configured a new username or password, enter the credentials instead.
In this example, SG350X-24 24-Port Gigabit Stackable Managed Switch is used.
Step 3. From the Privileged EXEC mode of the switch, enter the Global Configuration mode by entering the following:
SG350X#configure The configure command is equivalent to configure terminalStep 4. In the Global Configuration mode, enter the interface context by entering the following:
SG350X(config)#interface [interface-id | vlan-id In this example, interface vlan 1 is used. VLAN 1 is the default VLAN of the switch.
Step 5. Enter the IP address interface configuration command to define an IP address for an interface by entering either of the following:
- ip address [ip-address] {{mask | prefix-length}}— Use the reload command to reload the switch immediately.
- ip address [ip-address] {{mask | prefix-length}} [default-gateway-ip-address] — Use the reload {{in hhh:mm | mmm | at hh:mm [day month]}} command to specify scheduled switch reload.
The options are:
- ip address — Specifies the IP address.
- mask — Specifies the network mask of the IP address.
- prefix-length — Specifies the number of bits that comprise the IP address prefix. The prefix length must be preceded by a forward slash (/). The range is 8 to 30.
Step 6. (Optional) To remove an IP address from an interface, use the no form of the IP address command by entering the following:
SG350X(config-if)#no ip addressStep 7. Enter the end command to go back to the Privileged EXEC mode of the switch.
SG350X(config-if)#end
Step 8. (Optional) To display the IP address configuration and information on the interface, enter the following command in the Privileged EXEC mode:
SG350X#show ip interface In this example, the IP address is 192.168.100.201 and the Type is Static.
Step 9. (Optional) To save the configured settings to the startup configuration file, enter the following:
SG350X#copy running-config startup-config
Step 10. (Optional) Press Y for Yes or N for No on your keyboard once the Overwrite file [startup-config]… prompt appears.
In this example, Y is pressed. You should now have successfully configured the static IP address settings of your switch.
Configure the IP Address through DHCP
In this scenario, the switch is connected to a router which acts as an active DHCP server. Follow the steps below to configure the IP address of the switch through DHCP.
Step 1. Connect your computer directly to the switch using a serial cable.
Step 2. Log in to the switch console. The default username and password is cisco/cisco. If you have configured a new username or password, enter the credentials instead.
In this example, SG350X-24 24-Port Gigabit Stackable Managed Switch is used.
Step 3. From the Privileged EXEC mode of the switch, enter the Global Configuration mode by entering the following:
SG350X#configureStep 4. In the Global Configuration mode, enter the interface context by entering the following:
SG350X(config)#interface [interface id | vlan-id] In this example, interface vlan 1 is used. VLAN 1 is the default VLAN of the switch.
Step 5. In the interface context, acquire an IP address from the DHCP server by entering the following:
SG350X(config-if)#interface [interface id | vlan-id]You will receive a notification that the device has been configured on the specified interface.
Step 6. (Optional) To remove an IP address from an interface, use the no form of the IP address DHCP command by entering the following:
SG350X(config-if)#no ip address dhcpStep 7. Enter the end command to go back to the Privileged EXEC mode of the switch.
SG350X(config-if)#endStep 8. (Optional) To display the IP address configuration and information of the interface, enter the following command in the Privileged EXEC mode:
SG350X#show ip interface In this example, the IP address is 192.168.100.103 and the Type is DHCP.
Step 9. (Optional) To display the IP address configuration and information on the DHCP client interface, enter the following command in the Privileged EXEC mode:
SG350X#show ip dhcp client interface
Step 10. (Optional) To save the configured settings to the startup configuration file, enter the following:
SG350X#copy running-config startup-config
Step 11. (Optional) Press Y for Yes or N for No on your keyboard once the Overwrite file [startup-config]… prompt appears.
In this example, Y is pressed. You should now have successfully configured the DHCP IP address settings on your switch.
Từ khóa » đặt Ip Cho Switch Cisco
-
Hướng Dẫn 7 Bước Thiết Lập Cấu Hình Switch Cisco 2960 Nói Chung
-
Hướng Dẫn Quản Lý Và Cấu Hình Thiết Bị Chuyển Mạch ở Mức độ Cơ Bản
-
Đặt IP Cho Cổng Của Switch - An Ninh Mạng
-
Hướng Dẫn Cấu Hình Cơ Bản Cho Switch Cisco – Phần 2 - Ting3S
-
Top 15 đặt Ip Cho Switch Cisco
-
Top 15 đặt Ip Cho Switch Cisco 2960
-
Lệnh Cấu Hình Switch CISCO - TRUNGTHIENIT
-
Cấu Hình Cơ Bản Trên Switch, Router Cisco
-
Hướng Dẫn Cấu Hình Switch Cisco CBS250 CBS350 Series
-
Hướng Dẫn Cấu Hình Switch Cisco 2960 Cơ Bản - Vnfree.Net
-
Gán địa Chỉ Ip Cho Các Interface Của Switch Lớp 2 Như Thế Nào?
-
Hướng Dẫn Cấu Hình Switch Cisco Cơ Bản - Phần 1 - Viễn Thông Xanh
-
Cấu Hình địa Chỉ IP Cho Switch - YouTube
-
Cách Tạo Vlan, Chia Vlan Cho Các Thiết Bị Mạng Switch CISCO