萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 網路安全 >  >> 網路應用技術 >> 應用程式教學

網絡設備配置命令大全:交換機/路由器/PIX防火牆/BGP/PPP速查手冊

一、Catalyst交換機全模式命令速查

模式層級與提示符

模式提示符進入命令退出命令
ROM Monitorswitch:斷電重啟/斷電恢復boot
用戶模式Switch>預設登入disable / exit
特權模式Switch#enabledisable / exit
全局配置Switch(config)#configure terminalexit / end
介面配置Switch(config-if)#interface exit
VLAN配置Switch(vlan)#vlan databaseexit
線路配置Switch(config-line)#line console 0 / vty 0 4exit

基礎安全配置

! 主機名
hostname SW-CORE-01

! 特權加密密碼 (推薦)
enable secret Cisco@123

! 控制台線路密碼
line console 0
 password Console@123
 login
 logging synchronous
 exec-timeout 5 0

! VTY遠程管理 (0-4共5條會話)
line vty 0 4
 password Vty@123
 login
 transport input ssh
 exec-timeout 10 0

VLAN全生命周期管理

! 進入VLAN數據庫模式 (舊版IOS) / 現代IOS直接全局下創建
vlan 10
 name MGMT
 exit

! 介面加入VLAN
interface FastEthernet0/1
 switchport mode access
 switchport access vlan 10

! Trunk幹線配置
interface GigabitEthernet1/1
 switchport trunk encapsulation dot1q
 switchport mode trunk
 switchport trunk allowed vlan 10,20,30
 switchport trunk native vlan 999

! VTP域配置
vtp domain ENTERPRISE
vtp mode server
vtp password Vtp@Secret
vtp version 2

管理IP與默認網關


interface Vlan10
 ip address 192.168.10.2 255.255.255.0
 no shutdown
exit
ip default-gateway 192.168.10.1

核心顯示/診斷命令


show running-config          ! 當前生效配置
show vlan brief              ! VLAN摘要
show interfaces status       ! 所有端口狀態速覽
show interfaces Gi1/1        ! 指定端口詳細
show vtp status              ! VTP狀態
show spanning-tree           ! 生成樹狀態
write memory / copy run start  ! 保存配置

二、PIX/ASA防火牆經典配置 (舊版PIX 6.x語法,ASA 8.x+語法有差異)

介面命名與安全等級


nameif ethernet0 outside security0
nameif ethernet1 inside security100
nameif ethernet2 dmz security50

介面物理參數


interface ethernet0 auto
interface ethernet1 100full
interface ethernet2 100full

IP地址配置


ip address inside 192.168.1.1 255.255.255.0
ip address outside 203.0.113.1 255.255.255.252
ip address dmz 172.16.1.1 255.255.255.0

NAT/Global經典配置


! 定義全局地址池 (PAT)
global (outside) 1 203.0.113.2-203.0.113.10 netmask 255.255.255.248
! 內網所有主機PAT到外網
nat (inside) 1 0.0.0.0 0.0.0.0
! DMZ網段PAT
nat (dmz) 1 172.16.1.0 255.255.255.0

靜態NAT/端口映射


! 內網Web服務器映射到公網IP
static (inside,outside) 203.0.113.3 192.168.1.10 netmask 255.255.255.255
! DMZ郵件服務器
static (dmz,outside) 203.0.113.4 172.16.1.10 netmask 255.255.255.255

路由與默認路由


route outside 0.0.0.0 0.0.0.0 203.0.113.2 1
route inside 10.0.0.0 255.0.0.0 192.168.1.254 1

三、BGP外部網關協議核心配置


router bgp 65001
 bgp router-id 1.1.1.1
 bgp log-neighbor-changes
 network 203.0.113.0 mask 255.255.255.0
 neighbor 203.0.113.2 remote-as 65002
 neighbor 203.0.113.2 description ISP-UPLINK
 neighbor 203.0.113.2 password Bgp@Secret
 neighbor 203.0.113.2 timers 30 90

四、PPP認證配置 (CHAP/PAP)


username BRANCH-R1 password Branch@123
!
interface Serial0/0/0
 encapsulation ppp
 ppp authentication chap pap
 ppp chap hostname HQ-R1
 ppp chap password HQ@Secret

提示:本手冊針對經典IOS/PIX語法,新版IOS-XE、ASA、NX-OS命令有差異,請參考對應版本官方命令參考手冊。

copyright © 萬盛學電腦網 all rights reserved