思科基础配置命令

HDLC配置

RA---------RB

RA上配置:

int s0/0 

ip add 192.168.0.1 255.255.255.0 //配置端口IP地址

clock rate 1000000 //DEC端口,需要配置时钟

encapsulation hdlc //封装HDLC协议

no shutdown

RB上的配置:

int s0/0

ip add 192.168.0.2 255.255.255.0

encapsulation hdlc //两端必须协议一致

no shutdown

PPP配置:

OSPF单区域配置:

router ospf 20

network +网络地址 +子网掩码+area +区域编号 //宣告网络到区域内

OSPF多区域配置:

area area-id stub //Stub区域的配置,末梢区域配置

area + area-id +stub //配置该区域为Stub区域

area area-id stub no-summary //完全末梢(Totally Stub)区域配置

area + area-id +stub no-summary //配置该区域为Stub区域

show ip ospf database //查看OSPF链路状态数据库,

show ip ospf database router //显示OSPF链路状态数据库中的类型1的LSA信息

show ip ospf database network //显示OSPF链路状态数据库中的类型2的LSA信息

show ip ospf database summary //显示OSPF链路状态数据库中的类型3的LSA信息

show ip ospf database asbr-summary //显示OSPF链路状态数据库中的类型4的LSA信息

show ip ospf database external //显示OSPF链路状态数据库中的类型5的LSA信息

show ip ospf database nssa-external //显示OSPF链路状态数据库中的类型7的LSA信息

注意:末节和完全末节区域需要满足以下条件

1.区域只有一个出口

2.区域不需要作为虚链路的过渡区

3.区域内没有ASBR

4.区域不是主干区域area0

OSPF高级配置:

OSPF有一下两类路由汇总

1.ABR汇总-------区域间路由汇总,通常在一个ABR上配置

 area area-id range ip-address mask [advertise|not-advertise][cost cost]

2.ASBR汇总

外部路由汇总,通常在一个ASBR上配置

summary-address ip-address mask [not-adcertise]

redistribute protcol //路由重发布

redistribute connected subnets //重发布直连接口网段

router ospf 1

redistribute static subnets //静态路由重发布到OSPF

redistribute rip subnets // 静态路由重发布到OSPF

defult-information originate //OSPF缺省路由下发

设置路由器接口链路状态开销值

ip ospf cost +值 //取值范围1~65535

ip ospf priority number-value //设置路由器接口优先级,取值范围0~255,默认1,越大越优,可以指定路由器,用于DR/BDP路由器选举

ip ospf hello-interval +seconds(秒数) //指定OSPF接口发送Hello包的时间间隔,取值范围1~65535,默认10s

ip ospf dead-interval +seconds //取值范围1~65535,默认40s,hello的4倍

ip ospf authentication //启用文本认证

ip ospf authentication-key +keky(密码) //设置路由器间进行OSPF文本认证的密码

设置某接口MD5认证,密码hngy

ip ospf message-digest-key 1 md5 hngy 

ip ospf authentication message-digest //指定接口认证类型

ip ospf hello-interval 15 //设置hello的时间为15秒

ip ospf dead-interval 20 //设置dead的时间为20秒----出现报错,要求dead的时间要是hello包的四倍

OSPF认证配置

1.文本认证

场景:两台路由器RA、RB

RA:RA(config)#int s0/3/0

RA(config-if)#ip ospf authentication-key 12345

RA(config)#router ospf 1

RA(config-router)#area 0 authentication 

RB上配置一致

2.md5认证

RA:RA(config)#int s0/3/0

RA(config-if)#ip ospf message-digest-key 1 md5 1234

RA(config)#router ospf 1

RA(config-router)#area 0 authentication message-digest

RB上一致

--------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------

局域网交换技术:

config terminal //进入全局配置模式

enable password +密码 //配置使能密码

enable secret +密码 //配置保密密码

设置Console口和Telnet登录参数

line con 0

password +密码 //设置Console口登录密码

login //保存

line vty 0 4 //设置虚拟终端线路0~4

password +密码 //设置Telnet的登录密码

login //保存

speed +数字 //配置端口速率

duplex +auto/full/half //设置工作模式----auto自动,full全双工,half半双工

no switchport //把物理接口变成三层端口

show ip interface brief //查看端口IP设置的简要信息

show ip interface status //查看端口状态

switchport mode access/trunk //设置端口模式

switchport port-security //设置端口安全

switchport port-security max +数量 //设置端口的最大连接数(1~128)默认128

switchport port-security mac-address +mac地址 //设置端口接入的MAC地址

switchport port-security mac-address sticky //设置MAC地址粘连,交换机会自动学习该端口接入的网络设备MAC地址,并把它记录在当前的配置文件中

swit port-security violation +protect/shutdown/restrict //设置交换机端口收到非法数据帧时的处理方法

SSH登录配置:

username +名字 password +密码 //配置登录用户名和密码

aaa new-model //开启AAA认证

aaa authentication login ssh local 

login authentication ssh //配置认证方式

transport input ssh

transport output ssh //配置通过ssh登录

ip domain-name +名字 //创建域名

crypto key generate rsa //生成RSA密钥

valn:

vlan database //在特权模式下

vlan +数字 name +valn的名字 //创建valn,并命名

switchport mode trunk 

switchport trunk encapsulation dot1.q //封装802.1Q协议 

VTP:

vtp mode server/client/transparten //vtp的工作模式、

vtp domain +名字 //配置VTP域名

vtp password +密码 //配置VTP密码

show vtp status //验证VTP配置

vtp pruning //配置vtp修剪

ip routing //启动交换机的IP路由功能

DHCP配置:

server dhcp

ip dhcp excluded-address +地址 //添加排除地址,如果是排除地址段就------起始地址 结束地址

ip dhcp pool +名字

network +网络地址+子网掩码 //配置网络地址范围

default-router +网关地址 //配置网关

dns +地址 //添加dns服务器地址

配置生成树:

spanning-tree vlan+vlan-id,vlan +vlan-id root primary //根网桥

spanning-tree vlan+vlan-id,vlan +vlan-id root secondary //备份根桥

spanning-tree portfast default //开启快速生成树

链路捆绑:

int range +接口范围

switchport trunk encapsulation dotlq

switchport mode trunk

channel-group 1 mode on 

配置HSRP:

int +vlan //进入要配置的活动路由器的valn

standby +编号 ip +虚拟网关的地址

standby +编号 priority +数字 //设置优先级

standby +编号 preempt //配置抢占

standby +编号 track +接口 //跟踪上行接口

猜你喜欢

转载自blog.csdn.net/qq_62970627/article/details/128325611