چیتشیت تنظیمات اولیه سیسکو (Router / Switch)
راهنمای عملیاتی تنظیمات اولیهٔ دستگاههای سیسکو (Router و Switch)، از ورود به CLI تا SSH، VLAN، Routing و ذخیرهسازی configuration.
۱. ورود به CLI و Modeها
Router> enable
Router#
ورود به Configuration Mode:
Router# configure terminal
Router(config)#
خروج یک مرحله:
Router(config)# exit
برگشت مستقیم به Privileged EXEC:
Router(config)# end
یا: Ctrl+Z
Modeهای مهم
Router> User EXEC
Router# Privileged EXEC
Router(config)# Global Configuration
Router(config-if)# Interface Configuration
Router(config-line)# Line Configuration
Router(config-router)# Routing Configuration
۲. تنظیم Hostname
Router(config)# hostname R1
R1(config)#
برای Switch:
Switch(config)# hostname SW1
SW1(config)#
۳. فعال کردن Password برای Privileged Mode
روش ساده — enable password:
R1(config)# enable password cisco
روش پیشنهادی — enable secret:
R1(config)# enable secret Cisco@123
enable secretرا ترجیح بده چون رمز را به شکل امنتری در configuration نگه میدارد.
۴. رمزگذاری Passwordهای داخل Config
R1(config)# service password-encryption
۵. تنظیم Console Password
R1(config)# line console 0
R1(config-line)# password console123
R1(config-line)# login
R1(config-line)# exit
۶. تنظیم IP روی Router Interface
مثلاً G0/0 = 192.168.1.1/24:
R1(config)# interface gigabitEthernet 0/0
R1(config-if)# ip address 192.168.1.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit
بررسی:
R1# show ip interface brief
خروجی باید چیزی شبیه این باشد:
Interface IP-Address Status
GigabitEthernet0/0 192.168.1.1 up
۷. تنظیم IP روی Switch
روی Layer 2 Switch معمولاً IP را روی VLAN Interface میگذاری، نه روی پورت فیزیکی.
مثلاً Management IP SW1 = 192.168.1.2/24:
SW1(config)# interface vlan 1
SW1(config-if)# ip address 192.168.1.2 255.255.255.0
SW1(config-if)# no shutdown
SW1(config-if)# exit
اگر Switch برای دسترسی به شبکههای دیگر Gateway لازم دارد:
SW1(config)# ip default-gateway 192.168.1.1
۸. تنظیم IP روی VLAN اختصاصی Management
مثلاً VLAN 10:
SW1(config)# vlan 10
SW1(config-vlan)# name MANAGEMENT
SW1(config-vlan)# exit
SW1(config)# interface vlan 10
SW1(config-if)# ip address 192.168.10.2 255.255.255.0
SW1(config-if)# no shutdown
SW1(config-if)# exit
و Gateway:
SW1(config)# ip default-gateway 192.168.10.1
۹. تنظیم Access Port روی Switch
مثلاً پورت G0/1 عضو VLAN 10 باشد:
SW1(config)# interface gigabitEthernet 0/1
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 10
SW1(config-if)# no shutdown
برای چند پورت همزمان:
SW1(config)# interface range gigabitEthernet 0/1-10
SW1(config-if-range)# switchport mode access
SW1(config-if-range)# switchport access vlan 10
SW1(config-if-range)# no shutdown
۱۰. ساخت VLAN
SW1(config)# vlan 10
SW1(config-vlan)# name USERS
SW1(config-vlan)# exit
بررسی:
SW1# show vlan brief
۱۱. Trunk بین Switchها
SW1(config)# interface gigabitEthernet 0/24
SW1(config-if)# switchport mode trunk
SW1(config-if)# no shutdown
در بعضی مدلها/IOSها در صورت نیاز:
SW1(config-if)# switchport trunk allowed vlan 10,20,30
بررسی:
SW1# show interfaces trunk
۱۲. Telnet
برای Telnet باید روی VTY Lineها Password/Login تنظیم کنی:
R1(config)# line vty 0 4
R1(config-line)# password telnet123
R1(config-line)# login
R1(config-line)# transport input telnet
R1(config-line)# exit
اتصال از سیستم دیگر:
telnet 192.168.1.1
⚠️ Telnet رمزنگاری ندارد و برای شبکهٔ واقعی بهتر است از SSH استفاده شود.
۱۳. SSH — راهاندازی کامل
مرحله ۱ — Hostname:
R1(config)# hostname R1
مرحله ۲ — Domain Name:
R1(config)# ip domain-name lab.local
مرحله ۳ — ساخت User:
R1(config)# username admin privilege 15 secret Admin@123
مرحله ۴ — تولید RSA Key:
R1(config)# crypto key generate rsa
اگر پرسید How many bits in the modulus?، مثلاً 2048 بزن، یا مستقیم:
R1(config)# crypto key generate rsa modulus 2048
مرحله ۵ — فعال کردن SSH Version 2:
R1(config)# ip ssh version 2
مرحله ۶ — تنظیم VTY:
R1(config)# line vty 0 4
R1(config-line)# login local
R1(config-line)# transport input ssh
R1(config-line)# exit
اتصال:
ssh [email protected]
۱۴. فعال کردن هم Telnet و هم SSH
اگر واقعاً هر دو لازم است:
R1(config)# line vty 0 4
R1(config-line)# login local
R1(config-line)# transport input telnet ssh
R1(config-line)# exit
ولی برای محیط واقعی بهتر است فقط SSH:
R1(config)# line vty 0 4
R1(config-line)# login local
R1(config-line)# transport input ssh
۱۵. محدود کردن SSH به SSH Version 2
R1(config)# ip ssh version 2
بررسی:
R1# show ip ssh
۱۶. تنظیم Banner
R1(config)# banner motd #
****************************************
* UNAUTHORIZED ACCESS PROHIBITED *
****************************************
#
۱۷. غیرفعال کردن DNS Lookup
این دستور خیلی کاربردیه، مخصوصاً توی Lab:
R1(config)# no ip domain-lookup
باعث میشود اگر اشتباهی دستوری تایپ کردی، دستگاه سعی نکند آن را بهعنوان hostname resolve کند.
۱۸. تنظیم Clock
R1# clock set 15:30:00 22 September 2026
بررسی:
R1# show clock
۱۹. ذخیرهٔ Configuration
خیلی مهم:
R1# copy running-config startup-config
یا:
R1# write memory
یا خلاصهتر:
R1# wr
مفهومش:
running-config → startup-config
یعنی تنظیمات بعد از reboot باقی میمانند.
۲۰. مشاهدهٔ Configuration
R1# show running-config
R1# show startup-config
R1# show ip interface brief
R1# show ip route
R1# show version
R1# show interfaces
۲۱. تست ارتباط
Ping:
R1# ping 192.168.1.2
Traceroute:
R1# traceroute 8.8.8.8
روی بعضی IOSها:
R1# traceroute 192.168.1.2
۲۲. Static Route
مثلاً Destination: 192.168.2.0/24 با Next-Hop: 192.168.1.2:
R1(config)# ip route 192.168.2.0 255.255.255.0 192.168.1.2
Default Route:
R1(config)# ip route 0.0.0.0 0.0.0.0 192.168.1.254
۲۳. DHCP Server روی Router
مثلاً شبکهٔ 192.168.10.0/24 با Gateway 192.168.10.1:
R1(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.20
R1(config)# ip dhcp pool LAN
R1(dhcp-config)# network 192.168.10.0 255.255.255.0
R1(dhcp-config)# default-router 192.168.10.1
R1(dhcp-config)# dns-server 8.8.8.8
R1(dhcp-config)# exit
بررسی:
R1# show ip dhcp binding
۲۴. فعال کردن Routing بین VLANها — Router-on-a-Stick
روی Router:
R1(config)# interface gigabitEthernet 0/0
R1(config-if)# no shutdown
VLAN 10:
R1(config)# interface gigabitEthernet 0/0.10
R1(config-subif)# encapsulation dot1Q 10
R1(config-subif)# ip address 192.168.10.1 255.255.255.0
VLAN 20:
R1(config)# interface gigabitEthernet 0/0.20
R1(config-subif)# encapsulation dot1Q 20
R1(config-subif)# ip address 192.168.20.1 255.255.255.0
روی Switch:
SW1(config)# interface gigabitEthernet 0/24
SW1(config-if)# switchport mode trunk
۲۵. پاک کردن Configuration
⚠️ این بخش خطرناک است؛ در Lab کاربرد زیادی دارد.
R1# erase startup-config
یا:
R1# write erase
بعد:
R1# reload
۲۶. خاموش/روشن کردن Interface
فعال:
R1(config-if)# no shutdown
غیرفعال:
R1(config-if)# shutdown
۲۷. پیدا کردن Interfaceها
R1# show ip interface brief
یکی از مهمترین دستورهای سیسکو برای Troubleshooting همین است.
۲۸. Cheat Sheet خیلی سریع برای راهاندازی Router
اگر بخواهی یک Router را از صفر برای Lab آماده کنی:
enable
configure terminal
hostname R1
no ip domain-lookup
enable secret Cisco@123
service password-encryption
line console 0
password Console@123
login
exit
interface gigabitEthernet 0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
ip domain-name lab.local
username admin privilege 15 secret Admin@123
crypto key generate rsa modulus 2048
ip ssh version 2
line vty 0 4
login local
transport input ssh
exit
banner motd #
AUTHORIZED ACCESS ONLY
#
end
copy running-config startup-config
۲۹. Cheat Sheet خیلی سریع برای Switch
enable
configure terminal
hostname SW1
no ip domain-lookup
enable secret Cisco@123
service password-encryption
vlan 10
name MANAGEMENT
exit
interface vlan 10
ip address 192.168.10.2 255.255.255.0
no shutdown
exit
ip default-gateway 192.168.10.1
username admin privilege 15 secret Admin@123
ip domain-name lab.local
crypto key generate rsa modulus 2048
ip ssh version 2
line vty 0 4
login local
transport input ssh
exit
end
copy running-config startup-config
🔥 ۱۵ دستور طلایی که باید حفظ باشی
enable
configure terminal
hostname R1
show running-config
show startup-config
show ip interface brief
show ip route
show interfaces
interface g0/0
ip address X.X.X.X Y.Y.Y.Y
no shutdown
shutdown
copy running-config startup-config
show vlan brief
show interfaces trunk
ترتیب ذهنی برای راهاندازی سیسکو
1. enable
↓
2. configure terminal
↓
3. hostname
↓
4. enable secret
↓
5. console password
↓
6. Interface / VLAN / IP
↓
7. no shutdown
↓
8. Domain Name
↓
9. Local User
↓
10. RSA Key
↓
11. SSH
↓
12. VTY
↓
13. Test → ping / show
↓
14. Save
نکتهٔ مهم: برای شبکهٔ واقعی، SSH را به Telnet ترجیح بده؛ Telnet اطلاعات احراز هویت را رمزنگاری نمیکند. برای Lab و CCNA، هر دو را یاد بگیر ولی SSH را بهعنوان روش اصلی مدیریت در نظر بگیر.
