一些路由交换命令

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
一些路由交换命令

转载于:https://blog.51cto.com/13211071/2385796

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值