思科华为设备 基本配置命令

思科设备配置命令


1:【配IP地址】

路由器:
R1#conf t         进入全局模式
R1(config)# int f0/0    进入接口模式
R1(config-if)# ip add 192.168.10.1 255.255.255.0
R1(config-if)# no shut

查看IP的配置
R1# show ip interf brief  
R1(config)# do show ip interf brief

2:【配路由】
R1(config)# ip route 192.168.30.0 255.255.255.0 192.168.20.2(下一跳地址)
R1(config)# do show ip route  查看路由表

3:【配vlan、access、trunk】
二层交换机

创建vlan10 vlan20
SW2# conf t
SW2(config)# vlan 10,20   
SW2(config-vlan)# exit

 配access

SW2(config)# int f1/1
SW2(config-if)# switch mode access   
SW2(config-if)# switch access vlan 10
SW2(config)# int f1/2
SW2(config-if)# sw mo ac
SW2(config-if)# sw ac vlan 20
SW2(config-if)# exit

查看vlan
SW2(config)# do show vlan-sw brief

配trunk
SW2(config)# int f1/0
SW2(config-if)# switch mode trunk
SW2(config-if)# switch trunk en dot1q

查看trunk配置
SW2(config)# do show interf f1/0 switchport

SW2(config)# no ip routing   关闭路由功能

 

三层交换机:
配access和trunk配置与二层相同


不同处:
SW3(config)# ip routing    开启路由功能

三层交换机创建vlan10 20 是充当二层交换机下的PC的网关,所以vlan上配IP
SW3(config)# vlan 10,20
SW3(config)# int vlan 10
SW3(config-if)# ip add 192.168.10.1 255.255.255.0
SW3(config-if)# no shut
SW3(config)# int vlan 20
SW3(config-if)# ip add 192.168.20.1 255.255.255.0
SW3(config-if)# no shut

对外网的接口需要关闭交换功能,才能配IP,与外部网络通讯
SW3(config)# int f1/3
SW3(config-if)# no switchport
SW3(config-if)# ip add 20.0.0.20 255.255.255.0
SW3(config-if)# no shut
SW3(config-if)# do show ip interf brief


单臂路由示例:
对单臂路由的配置
R2(config)# int f0/0
R2(config-if)# un shut
R2(config)# int f0/0.1
R2(config-subif )# en dot 10
R2(config-subif)# ip add 192.168.10.1 255.255.255.0
R2(config-subif)# no shut

R2(config)# int f0/0.2
R2(config-subif )# en dot 20
R2(config-subif)# ip add 192.168.20.1 255.255.255.0
R2(config-subif)# no shut
R2(config)# do show ip interf brief


4:【配rip动态路由】
不能超过15跳
R1(config)# router rip
R1(config-router)# version 2
R1(config-router)# no auto-summary
R1(config-router)# net 192.168.10.0
R1(config-router)# net 192.168.20.0
R1(config)# do show ip route

5:【配OSPF链路状态路由协议】
R1(config)# router ospf 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)# net 192.168.10.0 0.0.0.255 area 0
R1(config-router)# net 192.168.20.0 0.0.0.255 area 0
R1(config-router)# net 192.168.50.0 0.0.0.255 area 0

R2(config)# router ospf 1
R2(config-router)# router-id 2.2.2.2
R2(config-router)# net 192.168.20.0 0.0.0.255 area 0
R2(config-router)# net 192.168.20.0 0.0.0.255 area 1


6:【路由重分发】
启动ospf进程,配routerID, 宣告直连网段到相应的area1区域,并把外部的重分发到ospf中
R3(config)# router ospf 1
R3(config-router)# router-id 3.3.3.3
R3(config-router)# net 192.168.30.0 0.0.0.255 area 0
R3(config-router)# redistribute connected subnets
R3(config-router)# redistribute static subnets
R3(config-router)# default-infomation originate

启动ospf进程,配routerlD,重分发RIP到ospf里
R4(config)# router ospf 1
R4(config-router)# router-id 4.4.4.4
R4(config-router)# net 192.168.40.0 0.0.0.255 area 0
R4(config-router)# redistribute rip subnets

启动RIP,关闭路由汇总,宣告直连网段,重分发ospf到RIP里
R4(config)# router rip
R4(config-router)# version 2
R4(config-router)# no auto-summary
R4(config-router)# net 192.168.50.0
R4(config-router)# redistribute ospf 1 metric 6

 

被zabbix监控的交换机路由器的配置命令:
switch#conf t
switch(config)#in vlan 1
switch(config-if)#ip add 192.168.1.1 255.255.255.0
switch(config-if)#no sh
switch(config)#snmp-server community centos RO    #设置被服务器轮询的只读共同体
switch(config)#snmp-server enable traps         #允许发送trap消息,可能会出两行提示信息,无视即可
switch(config)#snmp-server host 192.168.1.2 centos   #设置发送trap消息的共同体

Route#conf t
Route(config)#in f0/0
Route(config-if)#ip add 192.168.1.254 255.255.255.0
Route(config-if)#no sh
Route(config-if)#exit
Route(config)#snmp-server community centos1 RO    #注意共同体名不要和交换机配置的冲突
Route(config)#snmp-server enable traps
Route(config)#snmp-server host 192.168.1.2 centos1

 

华为设备配置命令

1:关闭华为的信息提示中心
[Huawei] undo info-center enable
简写: un in en

2:历史命令查询
[Huawei] display history-command

3:配置主机名
<Huawei> system-view
[Huawei] sysname R1

4:状态信息查询:
<Huawei>display version --查看VRP版本
<Huawei>display users --查看用户终端信息

R1[g0/0/0]dis this --查看当前视图下的配置信息

5:配置文件管理命令:
[Huawei]display saved-configuration --查看设备保存的信息
[Huawei]display current-configuration --查看设备当前配置的信息
<Huawei>reset saved-configuration --擦除存储设备中的配置文件
<Huawei>compare configuration --比较当前配置信息与存储设备中的保存文件是否一致

6:eNSP用SecureCRT连接
●双击打开某台设备有【视图】和【配置】,打开【配置】--窗口配置:串口号:2000 --这个是端口号
●打开SecureCRT--点击链接--【Protocol】Telnet--【Hostname】127.0.0.1--【Prot】2000
●当前终端被打开--断开【disconnect】--会话【session options】--强制每次一个字符模式【Force charater at atime mode】--保存【OK】
●右击当前终端--链接【reconnect】

远程登陆(通过密码方式):
user-interface vty 0 4(进入接口)
set authentication password cipher 123(设置密文密码)
super password cipher 123zxc(用户视图进系统视图,设置super密码)

7:路由命令:
[Huawei] ip route-static 0.0.0.0 0.0.0.0 192.168.12.1 --默认路由
[Huawei] ip route-static 192.168.10.0 255.255.255.0 192.168.12.1 --静态路由
[Huawei] ip route-static 4.4.4.4 32 25.0.0.1 preference 70 --设置优先级,默认60数字越小越优

8:交换机命令
[Huawei] dis mac-address --查看当前mac地址缓存表
[SW1-e0/0/1] undo negotiation auto --关闭自动协商
[SW1-e0/0/1] speed 100 --调至速率100M
[SW1-e0/0/1] duplex full --调至全双工模式

full = Full-Duplex mode(全双工模式) ; half = Half-Duplex mod


【vlan】
[sw1]vlan batch 10 20
【access】
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1] port default vlan 10
[sw1-Ethernet0/0/1]undo shutdown
【trunk】
[sw1-Ethernet0/0/4]int g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type trunk
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[sw1-GigabitEthernet0/0/1]un sh

【单臂路由】
[R1]int g0/0/0.10
[R1-GigabitEthernet0/0/0.10]dot1q termination vid 10
[R1-GigabitEthernet0/0/0.10]ip address 192.168.10.1 24
[R1-GigabitEthernet0/0/0.10]arp broadcast enable --开启arp广播
[R1-GigabitEthernet0/0/0.10]un sh

【RIP动态协议】
[R3]rip 1
[R3-rip-1]version 2
[R3-rip-1]undo summary
[R3-rip-1]network 23.0.0.0

[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]rip version 2

【OSPF】
1、dis ospf pee b --查看邻居关系
dis routing-table pro

2、ospf 1 route 1.1.1.1 --OSPF指定个route-id、1是表示,只在本区域有效
route id 1.1.1.1 --全局模式下配置 这个router-id所有协议生效
3、reset ospf 1 process graceful-restart --1是进程号 重启ospf
4、ospf 配置方法:
# ospf 1 route 1.1.1.1 --配置route-id
# area 0 --进入区域0 骨干区域
# network 20.0.0.0 0.0.0.3 --宣告网段 20.0.0.0 反掩码 0.0.0.3

【OSPF重分发】
[R1]int LoopBack 1
[R1-LoopBack1]ip add 1.1.1.1 32

[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]network 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.1]network 12.0.0.0 0.0.0.255
[R1-ospf-1]import-route rip 1 type 1

[R1]rip 1
[R1-rip-1]version 2
[R1-rip-1]undo summary
[R1-rip-1]network 16.0.0.0
[R1-rip-1]import-route ospf 1

【DHCP设置】

步骤1:
全局配置模式开启DHCP功能
[R1]dhcp enable
步骤2:
[R1]int G0/0/0.10 进入子接口
[R1-G0/0/0.10] dhcp select interface 基于接口配置DHCP
[R1-G0/0/0.10] dhcp server excluded-ip-address 192.168.10.200 192.168.10.210
10.200到10.210不分配地址
[R1-G0/0/0.10]dhcp server dns-list 8.8.8.8 配置DNS地址


步骤1:
[R1]dhcp enable 全局配置模式开启DHCP功能
步骤2:
[R1] ip pool v20
[R1-ip-pool-v20] gateway-list 192.168.20.1 声明网关
[R1-ip-pool-v20] network 192.168.20.0 mask 255.255.255.0 声明网络号,子网掩码
[R1-ip-pool-v20] dns-list 114.114.114.114
[R1-ip-pool-v20] static-bind ip-address 192.168.20.9 mac-address 28d2-4469-5a55
绑定IP192.168.20.9 固定分配给MAC为28d2-4469-5a55的机器,需池中IP
[R1-ip-pool-v20] lease day 10 租期10天
步骤3:
[R1]int g0/0/0.20
[R1-g0/0/0.20] dhcp select global 去全局请求DHCP服务


【DHCP中继】
[R1]int g0/0/0.10 --进入子接口
[R1-g0/0/0.10] dhcp select relay --基于DHCP中继
[R1-g0/0/0.10] dhcp relay server-ip 12.0.0.2 --去12.0.0.2请求DHCP服务


【NAT地址转换】
1,静态NAT:一个私网IP地址对应一个公网IP地址
(有2种配置方法)
第一种:
全局模式下 nat static global 8.8.8.8 inside 192.168.10.10
在接口上启动nat static enable 功能
[int g0/0/1] nat static enable

第二种:
直接在接口上声明nat static
[int g0/0/1] nat static global 8.8.8.8 inside 192.168.10.10
2,动态NAT: 多个私网IP地址对应多个公网IP地址
nat address-group 1 212.0.0.100 212.0.0.200(新建为1的nat地址池)
acl 2000(acl编号)
rule permit source 192.168.20.0 0.0.0.255
rule permit source 11.0.0.0 0.0.0.255
int g0/0/1(外网口)
nat outbound 2000 address-group 1 no-pat

3,EasyIp:多个私网IP地址对应外网口公网IP地址(12.0.0.1)

[R1]acl 3000(acl编号)
[R1-acl-adv-3000]rule permit ip source 192.168.30.0 0.0.0.255
[R1]int g0/0/1 (外网口)
[R1-g0/0/1]nat outbound 3000
display nat session all ##查看NAT的流表信息


【VRRP】

一主一备

[sw1]int vlanif 10
[sw1-Vlanif10]ip add 192.168.10.10 24
[sw1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1
[sw1-Vlanif10]vrrp vrid 1 priority 120
[sw1-Vlanif10]vrrp vrid 1 track interface g0/0/1
[sw1-Vlanif10]vrrp vrid 1 track interface g0/0/2

[sw2]int vlanif 10
[sw2-Vlanif10]ip add 192.168.10.20 24
[sw2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1
[sw2-Vlanif10]vrrp vrid 1 priority 115


【链路捆绑】
交换机1配置
[Huawei] lacp priority 1000
[Huawei] int Eth-Trunk 1
[Huawei-Eth-Trunk 1] bpdu enable
[Huawei-Eth-Trunk 1] mode lacp-static
[Huawei] int e0/0/10
[Huawei-e0/0/10] eth-trunk 1
[Huawei] int e0/0/11
[Huawei-int e0/0/11] eth-trunk 1
[Huawei] int e0/0/12
[Huawei-int e0/0/12] eth-trunk 1
[Huawei] dis eth-trunk 1 --下面有三个成员 此时三个口是跑流量的 负载冗余
[Huawei] int eth-trunk 1
[Huawei-eth-trunk 1] max active-linknumber 2 --最大链路活动数量

交换机2配置
[Huawei] int Eth-Trunk 1
[Huawei-Eth-Trunk 1] bpdu enable
[Huawei-Eth-Trunk 1] mode lacp-static
[Huawei] int e0/0/10
[Huawei-e0/0/10] eth-trunk 1
[Huawei] int e0/0/11
[Huawei-int e0/0/11] eth-trunk 1
[Huawei] int e0/0/12
[Huawei-int e0/0/12] eth-trunk 1
[Huawei] dis eth-trunk 1
[Huawei] dis trunkmembership eth-trunk 1 --查看链路负载情况

负载冗余测试
down 掉其中的一条链路
[Huawei] dis trunkmembership eth-trunk 1 --查看链路负载情况

 

【E-trunk+单臂路由】
解决单链路负载问题
本方案采用,E-trunk多链路汇聚,将多条物理链路变为一条E-trunk的逻辑链路
####R1####
[R1]interface Eth-Trunk 1
[R1-Eth-Trunk1]
[R1-Eth-Trunk1]trunkport GigabitEthernet 0/0/0 to 0/0/1
[R1-Eth-Trunk1]q
[R1]int Eth-Trunk1.10
[R1-Eth-Trunk1.10]dot1q termination vid 10
[R1-Eth-Trunk1.10]ip add 192.168.10.1 24
[R1-Eth-Trunk1.10]arp broadcast enable
[R1-Eth-Trunk1.10]un sh
[R1-Eth-Trunk1.10]q
[R1]int Eth-Trunk1.20
[R1-Eth-Trunk1.20]dot1q termination v 20
[R1-Eth-Trunk1.20]ip address 192.168.20.1 24
[R1-Eth-Trunk1.20]arp broadcast enable
[R1-Eth-Trunk1.20]undo sh
[R1-Eth-Trunk1.20]q

####SW2####
[SW1] int Eth-Trunk1
[SW1-Eth-Trunk1]trunkport GigabitEthernet 0/0/1 to 0/0/2
[SW1-Eth-Trunk1]port link-type trunk
[SW1-Eth-Trunk1]port trunk allow-pass vlan all
[SW1-Eth-Trunk1]un sh
[SW1-Eth-Trunk1]q

posted on 2020-06-05 17:07  LXF1221  阅读(394)  评论(0)    收藏  举报

导航