一些路由交換命令

display version 查看設備版本信息、型號、啓動時間等
clock timezone 設置時區
clock datetime 設置時間
display clock 查看當前生效的時間
sysname 修改設備名稱
header shell information 設置登錄標語
user-iunterface console 0 設置登錄密碼
authentication-mode password
set authentication password cipher
idle-timeout 20 0 設置空閒時間爲20分鐘
interface GigabitEthernet0/0/0 配置接口ip地址和描述信息
ip address 192.168.1.1
description
display interface 查看接口信息
dir 查看當前設備文件列表
display saved-configuration 查看保存的配置文件
save 保存當前的配置
display current-configuration 查看當前配置
display startup 查看下次啓動時記載的配置文件
reset saved-configuration 刪除保存的配置文件
reboot 重啓設備
stp enable 開啓stp服務(默認開啓)
stp mode 修改stp模式
display stp brief 查看stp端口角色
display stp interface 查看端口stp信息
display stp 查看stp詳細信息
undo stp root 撤銷stp根目錄,設置交換機優先級(4096的倍數)
stp priority
interface GigabitEthernet0/0/0 設置端口優先級,默認128
stp port priority 32
interface GigabitEthernet0/0/0 設置端口開銷值
stp cost 20000
stp mode rstp 開啓rstp
interface GigabitEthernet0/0/0 配置邊緣端口,加速收斂
stp edged-port enable
stp bpdu-protection 配置bpdu保護功能,防止僞造bpdu-邊緣變成非邊緣-自動計算stp
interface GigabitEthernet0/0/0 配置環路保護功能,防止因鏈路阻塞重新選舉端口角色。根交換機無需配置
stp loop-protection
ip route-static 10.1.1.1 8 192.168.1.1 preference 80 配置主備鏈路,靜態路由默認優先級60
rip 1 配置rip2動態路由協議,宣告網段10.0.0.0
version 2
network 10.0.0.0
interface GigabitEthernet0/0/0 設置rip明文驗證,對端驗證也要設置相同密碼
rip authentication-mode simple huawei
interface GigabitEthernet0/0/0 設置rip加密驗證,對端驗證也要設置相同密碼
rip authentication-mode md5 usual huawei
reset ip routing-table statistics protocol rip 清除學習到的rip路由
ospf 1 router-id 1.1.1.1 創建ospf進程(進程只具有本地意義),在ospf進程中創建區域0(骨幹區域),宣告網段10.0.0.0
area 0
network 10.0.0.0 0.0.0.255
display ospf interface GigabitEthernet 0/0/0 查看端口hello和dead時間參數
interface GigabitEthernet0/0/0 修改ospf時間參數(兩端時間參數一致才能建立鄰居關係)
ospf timer hello 15
ospf timer dead 60
interface GigabitEthernet0/0/0 修改ospf優先級選舉指定路由(優先級大爲指定路由,相同比較router-id,大爲指定路由。優先級爲0不參與選舉)
ospf dr-priority 200
ftp enable 啓動ftp服務,設置ftp目錄
set default ftp-directory flash:/
aaa 設置ftp用戶認證
local-user huawei password cipher huawei123
local-user huawei service-type ftp
display ftp-server 驗證ftp配置
interface GigabitEthernet0/0/0 關閉端口自動協商功能,修改端口速率爲100Mbit/s
undo negotiation auto
speed 100
interface Eth-Trunk 1 創建鏈路聚合,將0/0/0口加入鏈路聚合。注意:要加入的端口成員下不能又任何配置
quit
interface GigabitEthernet0/0/0
eth-trunk 1
display eth-trunk 1 驗證聚合鏈路
interface Eth-Trunk 1 創建lacp靜態鏈路聚合。lacp靜態鏈路聚合也叫M:N模式,M條活動鏈路,N條備份鏈路。具有冗餘備份作用
mode lacp
quit
interface GigabitEthernet0/0/0
eth-trunk 1
lacp priority 100 配置lacp系統優先級,使其成爲主動端
interface GigabitEthernet0/0/0 配置lacp接口優先級,使其成爲活動鏈路。
lacp priority 100
vcmp role silent 當VCMP處於Client或者Server角色時,不允許使能GVRP功能,此時需要先執行命令vcmp role將VCMP角色設置爲silent或transparent
gvrp 首先在全局開啓gvrp,然後在端口開啓gvrp
interface GigabitEthernet0/0/0
gvrp
interface GigabitEthernet0/0/0 配置端口註冊模式:normal(動態靜態都發),fixed(只發靜態不發動態),forbidden(只發送vlan1的消息)
gvrp registration fixed
interface Serial 1/0/0 在串口上配置hdlc鏈路
link-protocol hdlc
interface Serial 1/0/0 配置時鐘頻率。DCE:數據控制設備 DTE:數據終端設備(一般來說DCE在ISP端,DTE在客戶端)
bandrate 128000
interface Serial 1/0/0 設置鏈路類型爲ppp,兩端都要設置
link-protocol ppp
aaa PAP認證服務端端需要的操作:把被認證方需要認證的賬號密碼放入本地中,在端口上開啓PAP認證。
local-user huawei password cipher huawei123
local-user huawei servicce-type ppp
quit
interface Serial 1/0/0
ppp authentication-mode pap
interface Serial 1/0/0 被認證端設置的賬號密碼與服務端必須相同,否則認證不成功
ppp pap local-user huawei password cipher huawei123
PAP認證有單向認證和雙向認證,上面配的就是單向認證。雙向認證即設備既做服務端配置也要做客戶端配置,與之連接的設備也要做服務端和客戶端配置。R1服務端配置對應R2被認證方配置
aaa 配置CHAP認證方(服務端)
local-user huawei password cipher huawei123
local-user huawei servicce-type ppp
quit
interface Serial 1/0/0
ppp authentication-mode chap
interface Serial 1/0/0 配置CHAP被認證方,CHAP也分單雙向配置。同PAP
ppp chap user huawei
ppp chap password cipher huawei123
interface Serial 1/0/0 配置動態幀中繼。動態中繼通過反向arp(inarp)獲取對方地址映射到虛鏈路中
link-protocol fr
fr inarp
fr interface-type dce
interface Serial 1/0/0 靜態中繼配置,關閉反向arp,手動映射對端ip和本段虛鏈路號
link-protocol fr
ip address 10.0.0.2 8
undo fr inarp
fr map ip 10.0.0.1 100 broadcast
display fr interface Serial 1/0/0 驗證
中繼網絡中ospf無法發送廣播消息建立鄰居。解決方法:(1)通過peer 10.0.0.1手動建立鄰居關係 (2)修改端口的網絡類型爲點到多點,在端口下修改ospf network-type p2mp

ip pool pool1 PPPoE服務端設置,正常情況不是我們設置的
network 119.84.111.0 mask 255.255.255.0
gateway-list 119.84.111.254
quit

interface Virtual-Template 1
ppp authentication-mode chap
ip address 119.84.111.254 255.255.255.0
remote address pool pool1
quit
interface GigabitEthernet0/0/0
pppoe-server bind virtual-template 1
aaa
local-user huawei password cipher huawei123
local-user huawei servicce-type ppp
dialer-rule 配置客戶端pppoe撥號接口
dialer-rule 1 ip permit
quit
interface dialer 1
dialer user user1
dialer group 1
ppp chap user huawei
ppp chap password cipher huawei123
dialer timer idle 300
dialer queue-length 8
ip address ppp-negotiate
interface GigabitEthernet0/0/0 將撥號接口綁定到出接口
pppoe-client dial-bundle-number 1
ip route 0.0.0.0 0.0.0.0 dialer 1 配置默認路由
display pppoe-server session all 驗證pppoe狀態配置信息
acl 3000 創建ACL過濾規則
rule 5 permit tcp source 10.0.0.1 0.0.0.0 destination 10.0.0.2 0.0.0.0 destination eq 23
rule 10 permit tcp source 10.0.0.1 0.0.0.0 destination 10.0.0.2 0.0.0.0 destination rang 20 21
rule 15 permit ospf
rule 20 deny ip source any
interface GigabitEthernet0/0/0 在端口入嚮應用ACL(基本ACL應用在目標端網絡,高級ACL應用在源端網絡)
traffic-filter inbound acl 3000
nat address-group 1 119.84.111.240 119.84.111.243 配置NAT轉換地址池
interface GigabitEthernet0/0/0 地址池與ACL關聯綁定出端口
nat outbound 3000 address-group 1
aaa 配置認證方案和授權方案爲本地認證
authentication-scheme auth1
authentication-mode local
aaa 創建域“huawei”,將認證方案和授權方案與域關聯起來,創建一個用戶加入域
domain huawei
authentication-scheme auth1
quit
local-user user1@huawei password cipher huawei123
ipsec proposal tran1 創建提議
esp authentication-algorithm sha1 設置esp認證方式
esp encryption-algorithm 3des 設置esp加密方式
display ipsec proposal 驗證提議
使用在提議視圖下使用transform更改安全提議方式(ah|esp|ah-esp)
ipsec policy p1 10 manual 創建ipsec ***策略
manual:手動設置 IKE:協商(需要執行ipsec-policy-template配置參數)
security acl 3000 引用訪問訪問控制列表
proposal tran1 引用安全提議
tunnel remote 10.0.0.2 設置遠端地址
tunnel local 10.0.0.1 設置本端地址
sa spi inbound esp 12345 設置sa聯盟入向參數(對端出向與本端入向參數必須一直)
sa spi outbound esp 54321 設置sa聯盟出向參數
sa string-key inbound esp simple huawei 設置sa聯盟入向認證密鑰(與對端出向相同)
sa string-key outbound esp simple huawei 設置sa聯盟出向認證密鑰
display ipsec policy 驗證策略
interface Serial 1/0/0 在接口應用策略,至此***創建完成
ipsec policy p1
interface Tunnel 0/0/1 "GRE隧道是建立在×××隧道基礎上創建的,×××不能傳輸路由信息即不能傳遞路由協議,GRE就是爲了在×××中傳遞路由協議。
創建GRE需要創建隧道接口,並給接口配置公網地址,對端隧道接口地址與本端在一個網段內。指定源和目標本地ip

"
ip address 100.1.1.1 24
tunnel-protocol gre
source 10.0.0.1
destination 10.0.0.2
ipv6 配置ipv6本地鏈路地址(相當於ipv4中的169.254..)
interface GigabitEthernet0/0/0
ipv6 enable
ipv6 address fe80::1 link-local
ospfv3 1 配置ospfv3,將端口加入ospf協議
router-id 1.1.1.1
quit
interface GigabitEthernet0/0/0
ospfv3 1 area 0
dhcp enable 配置DHCPv6地址池
dhcpv6 duid 11
dhcpv6 pool pool1
address prefix 2001:FACE::/64
dns-server 2001:444e:5300::1
excluded-address 20001:FACE::1
interface GigabitEthernet0/0/0 接口配置地址池網關,並配置DHCPv6指定地址池
ipv6 address 2001:FACE::1 64
dhcpv6 server pool1
一些路由交換命令

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章