思科命令大全

--------------------------------------------查看命令---------------------------------------

Showrunning-config  //查看全部配置命令

show ip   route查看路由器的路由表

show iP interface brief查看接口iP地址

show startup-config查看当前保存的信息

show star确认配置信息已经存储成功

show interface fa0/0查看接口状态

show mac-address-table dynamic查看MAC地址表

show vlan-switch brief查看该交换机上的VLAN信息

SW1#show interface vlan 1(orfa0/0)   //查看交换机MAC地址

----------------------------------------单臂路由-------------------------------------------

int   fa0/0

no shut打开路由器端口

interface fa0/0.1

encapsulation dot1q  1(为vlan1配置 网关

iP add 192.168.1.1 255.255.255.0

no shutdown路由器配置子接口

---------------------------------------vlan---------------------------------------------------

SW1(config)#vlan 10

SW1(config-if)#int fa1/1  

SW1(config-if)#swithport access vlan 10

SW1(config)#vlan 2 //增加一个VLAN编号是2

SW1(config-vlan)#name v2 //取名v2

SW1(config-vlan)#exit

SW1#show vlan-switch b //查看该交换机上的VLAN信息,普通的思科交换机上直接使用show vlan 就可以。

不同VLAN的成员,IP地址也应该属于不同的网段。

SW1(config)#int fa1/2

SW1(config-if)#switchport mode access //将接口类型改成访问端口

access 接口只允许指定VLAN的流量通过。也就是接口属于哪个VLAN就只有这个VLAN的流量可以过。思科交换机默认所有端口都是ACCESS口。

--------------------------------------交换机配ip------------------------------------------

int  vlan  1    //给交换机配接口就是给vlan 1 配接口

SW1(config)#iP add ip地址  子网掩码

SW1(config)#iP default-gateway 192.168.1.1

--------------------------------------------中继口-------------------------------------------

SW1(config)#interface   fa1/15

将接口设为中继口,思科设置默认允许所有VLAN流量通过中继端口。

将接口的封装类型设置为802.1Q

-------------------------------------------------远程控制----------------------------------

AAA

SW1(config)#(line )  vty 0 4//(0--4一共有五个接口,如果需要多开接口就将4换为更大的数)

login local进入本地验证

SW1(config)# username test(取得名字 )privilege 3 password abc(密码)


router(config)#line vty 0 4

router(config-line)#password abc

router(config-line)#login

router(config)#enable secret abc


R1(config)#ip nat inside source static tcp 192.168.30.10 23 202.106.1.1 23端口映摄


------------------------------------------------PAT--------------------------------------------

标记内外网口

做列表

R1(config)#ip nat  inside source list 10 int fa0/1 overload

--------------------------------------------DHCP---------------------------------------------

R(config)#ip dhcp pool v1(名字)

R(dhcp-config)#network  192.168.10.0  /24

R(dhcp-config)#default-router  192.168.10.1

R(dhcp-config)dns-server  8.8.8.8 (PC的dns)现实中获得DNS需要用拨号获取。

VPCS[1]>ip dhcp 自主获得ip地址

-------------------------------------------配置双工----------------------------------------

R(config)#int fa0/0

R (config-if)#speed  100

R(config-if)#duplex 【full/half/auto】

---------------------------------------------改接口IP---------------------------------------

R(config)#default interface fa0/0   //使用default命令恢复接口默认配置

R(config)#interface fa0/0

R(config-if)#ip add 192.168.1.2 (改正的ip地址)255.255.255.0  

R(config-if)#no  shutdown

-----------------------------------------------最长匹配原则------------------------------

当路由器查看路由表选路时,选择掩码最长的。(列:静态路由和默认路由[掩码长度为0]同时存在时应该选择静态路由,因为更精确。)

-----------------------------------控制台永不超时命令--------------------------------

SW1(config)#line  console  0

SW1(config-line)#exec-timeout 0(分钟) 0(秒钟)

-------------------------------------------浮动路由----------------------------------------

R(config)#ip route 4.4.4.0 255.255.255.0 202.106.13.3  10 (值越小时越优先,默认情况的值为1)

 注:浮动路由用于路由备份,当默认的那条路是通的时候被备份的路是不会显示出来的。

     负载平衡指得是多条路同事存在,多条路被选择的概率一样

----------------------------------------跟踪路由-------------------------------------------

R#traceroute 4.4.4.4 source loopback 0 //用此命令跟踪访问4.4.4.4时所走的路径。

-------------------------------------------------cmd------------------------------------------

arp -a;      清除缓存表 arp -d /clear arp-cache ;    静态绑定MAC地址arp  -s  ip address   MAC address    ;

arp缓存表是内存缓存区,具有老化时间;

arp绑定:

      arp ip-address mac-address arpa



转载于:https://blog.51cto.com/245749699/1403658