基础命令集汇总
基础
查看接口
show ip interface brief
show running-config
修改名字
hostname+名字
查看/查看时间
show clock
修改时区
clock timezone+命名+时区8
修改时间
clock set 15:00+月(英文)+日+年
consloe口设置
设置登录密码
lineconsloe 0
password cisco
login
设置用名密码,使用本地用户名
username ccie password ccie
lineconsloe 0
password cisco
login
设置级别
username AAA pririlege+级别
0只能查看 1特权 2-15
设置特权密码
enable secret cisco
telnet
line VTY 0 4
login local
banner login“hello world”
banner exec“*****”
不能远程登陆
transport input none
只允许telnet
transport input telnet
清除配置
cd nrram
dir(展开分组)
erase startup-config(删除配置文件)
保存配置另外一种写法
copy running-config startup config
常见网络不通报错
u.u.u.u
数据发出去,目标不可达
..........
本地没有路由条目
sourse
通过xxxx地址去ping另外一个地址
二层
MAC地址表
show mac address-table / show mac-address-table
三层
静态路由
IP route 目标地址 +掩码+下一跳地址
查看路由表
show ip route
cef表
查看方法
show ip cef
查端口转发方式
show ip cef f0/0 detil
EIGRP
配置命令集
router eigrp+进程号
两端进程号必须一致
宣告
network x.x.x.x +反掩码
EIGRP三张表
邻居表
show ip eigrp neighbor
拓扑表
show ip eigrp topology
路由表
show ip eigrp router
show ip router eigrp
只查看EIGRP
show ip router protocols
查看所有协议
routing information sources
路由信息源
OSPF
重置OSPF进程
clear ip ospf processes
查看DR、BDR状态
show ip protocols
查看优先级
show ip ospf interface F0/0
修改优先级
进入接口
ip ospf priority(0-255)越大越好
起认证、邻居认证
authentication password
起OSPF进程
方法一
优点:接口IP变了会自动宣告
ip router OSPF+进程号
进入到接口下
intereface f0/0
接口宣告区域
ip ospf area 0
方法二
ip router OSPF+进程号
network 10.1.1.1 0.0.0.0 area 0
查看OSPF邻居
show ip ospf neighbor
查看接口时点对点还是广播
show ip ospf interface f0/0
network Type BROADCAST为广播
修改方法
ip ospf network point-to-point
vlan
创建VLAN
VLAN 10/20/30
命名
name xx/description(描述)
查看vlan
show vlan brief
show vlan-switch brief
设置access端口,并划分vlan
switchport mode access
switchport access vlan 10
关闭二层功能
no switchport
配置dot1q封装数据包格式
switchport mode encapsulation dot1q
配置trunk口
switchport mode trunk
限制vlan 通过
switchport trunk allowed vlan 10/20/30
vlan上配置
IP地址
interface vlan 10
IP addrss x.x.x.x x.x.x.x
一个接口下配置多个ip
secondary
interface f0/0.1 /0.2
子接口承载vlan
encapsulation dot1q 10
VTP
1、先配置dot1q/trunk
选择角色
VTP mode +client(客户端同步者)/off(关闭)/server(服务端被同步者)/transparent
配置域名
VTP domain cisco.com
查看vtp
show vtp status
客户端及server端同步配置 角色不同 域名一样
生成树
查mac地址
show version
show mac address-table
查看根桥mac
show spanning tree
ACL
拒绝pctelnet到网关上
access-list 100 denny tcp host 192.168.1.10 host 192.168.1.1 eq telnet
access-list 100 permit ip any any(源+目的地址)
interface f0/0
ip access-group 100 in(挂接)
访问网页
access-list 101 permit tcp any any eq 80/443/53
NAT
进入网关外网口(标识外网)
ip nat outside
进入网关内网口(标识内网)
IP nat inside
做一个映射
ip nat inside static tcp x.x.x.x 23 xxxx 23
从电信访问到公网地址10000端口上,自动跳转到内网server23端口上
使用ACL抓取条目上网
内网口、外网口设置好
access-list 1 permit 192.168.1.0 0.0.0.255
ruguo ACL挂接再接口下-允许拒绝意思,如果挂接在NAT下-抓取的意思
ip nat inside source list 1interface f10/0 overload
定义转换
查看NAT表
show ip translations
ACL抓取
acl 2000 rule permit source 192.168.1.0 0.0.0.255
进入到接口下挂接
nat outbound 2000
链路聚合
默认支持8个接口捆绑在一起
进入接口
做trunk
switchport trunk encapsulation dot1q
switchport mode trunk
创建聚合组
channel-group 1mode on
进入聚合组
interface port-channel 1
再写一遍trunk,防止channel接口没有继承trunk接口
查看聚合信息
show etherchannel summary
查看聚合端口信息
show interface port-channel 1
查看负载均衡方法
show etherchannel load-balance
默认:src-dst-ip 基于源目地ip 三层
修改默认均衡方式
port-channel load-balance src-dst-mac(基于源mac)
DHCP
网络设备端
起一个地址池
ip dhcp pool DHCP
宣告下发地址
network 192.168.1.0/24
写DNS
dns-server 8.8.8.8
下发域名
domain-name cisco.com
下发网关
default-router 192.168.1.1
不允许下发指定IP
ip dhcp excluded-address 192.168.1.10
租期设置
ip dhcp pool DHCP
lease +天数/infinite(无期限)
PC端
网络设备获取IP
ip address dhcp