CCNA 思科配置实验

CCNA 思科配置实验
CCNA 思科配置实验

思科配置实验(适用于CCNA)

1. 设置计算机ip地址

设置PCA 的IP地址为:10.65.1.1 255.255.0.0 网关:10.65.1.2 设置PCB 的IP地址为:10.66.1.1 255.255.0.0 网关:10.66.1.2 设置ROA f0/0 IP 为:10.65.1.2 255.255.0.0

设置ROA f0/1 IP 为:10.66.1.2 255.255.0.0

设置计算机PCA的ip地址和网关的操作:

[rootPCA root]# ifconfig eth0 10.65.1.1 netmask 255.255.0.0 [rootPCA root]# ifconfig

[rootPCA root]# route add default gw 10.65.1.2

[rootPCA root]# route

设置计算机PCB的ip地址和网关的操作:

[rootPCB root]# ifconfig eth0 10.66.1.1 netmask 255.255.0.0 [rootPCB root]# ifconfig

[rootPCA root]# route add default gw 10.66.1.2

[rootPCA root]# route

2. 双击Router A,配置路由器的接口IP地址:

router>en

router#conf t

router(config)#hostname roa

roa(config)int f0/0

roa(config-if)#ip address 10.65.1.2 255.255.0.0

roa(config-if)#no shutdown (默认是shutdown)

roa(config-if)#exit

roa(config)int f0/1

roa(config-if)#ip address 10.66.1.2 255.255.0.0

roa(config-if)#no shut

roa(config)int s0/0

roa(config-if)#ip address 10.67.1.2 255.255.0.0

roa(config-if)#no shut

roa(config-if)#clock rate 64000

roa(config)int s0/1

roa(config-if)#ip address 10.68.1.2 255.255.0.0

roa(config-if)#no shut

roa(config-if)#exit

roa(config)#ip routing (默认是关闭的)

3.检查网络联通情况

[rootPCA root]# ping 10.65.1.2 (通) (ping自己的网关) [rootPCA root]# ping 10.66.1.2 (通) (ping f0/1) [rootPCA root]# ping 10.66.1.1 (通) (ping PCB) [rootPCA root]# ping 10.67.1.2 (不通) (端口空时down) [rootPCA root]# ping 10.68.1.2 (不通) (端口空时down)

[rootPCB root]# ping 10.66.1.2 (通) (ping自己的网关) [rootPCB root]# ping 10.65.1.2 (通) (ping f0/0) [rootPCB root]# ping 10.65.1.1 (通) (ping PCA) [rootPCB root]# ping 10.67.1.2 (不通) (端口s0/0空时down) [rootPCB root]# ping 10.68.1.2 (不通) (端口s0/1空时down)

roa#ping 10.65.1.1 (通) (ping PCA)

roa#ping 10.65.1.2 (通) (ping f0/0)

roa#ping 10.66.1.1 (通) (ping PCB)

roa#ping 10.66.1.2 (通) (ping f0/1)

roa#ping 10.67.1.2 (不通) (端口s0/0空时down)

roa#ping 10.68.1.2 (不通) (端口s0/1空时down)

下面我们做这个几个小实验:

(1) 将路由器的接口f0/0关闭

roa#conf t

roa(config)#int f0/0

roa(config-if)#shutdown

roa(config-if)#end

roa#ping 10.65.1.2 (不通,端口down掉)

roa#show int f0/0 (f0/0 is down,line proto is down) [rootPCA root]# ping 10.65.1.2 (不通)

激活f0/0端口:

roa(config)#int f0/0

roa(config-if)#no shut

roa(config-if)#end

roa#ping 10.65.1.2 (通)

去掉PCA与f0/0的连线

roa#sh int f0/0 (f0/0 is up,line proto is down)

roa#ping 10.65.1.2 (不通)

roa#sh int s0/0 (s0/0 is down,line proto is down)

roa#sh int s0/1 (s0/1 is down,line proto is down) serial口当没有连线时???

(2) 关闭路由器的路由

roa#conf t

roa(config)#no ip routing

[rootPCA root]# ping 10.65.1.2 (通) (ping 自己的网关)

[rootPCA root]# ping 10.66.1.1 (不通)(路由器不能转发了)

[rootPCB root]# ping 10.66.1.2 (通) (ping 自己的网关)

[rootPCB root]# ping 10.65.1.1 (不通)(路由器不能转发了)

计算机可以ping与其相连的端口,但不能ping通下面的计算机,因为

no ip routing后不具备转发的功能了。

roa(config)#ip routing

(3) 去掉计算机PCA的网关

[rootPCA root]# route del default gw

PCA只能ping通直联口,计算机没有网关不能和路由器交换信息。

[rootPCA root]# ping 10.65.1.2 (通) (f0/0在PCA的广播域)

[rootPCA root]# ping 10.66.1.1 (不通)(PCA不能连通其它网络)

[rootPCA root]# ping 10.66.1.2 (不通)

[rootPCB root]# ping 10.66.1.2 (通)

[rootPCB root]# ping 10.65.1.2 (通) (PCB有网关)

[rootPCB root]# ping 10.65.1.1 (不通)(PCA没网关)

可见一个没有网关的设备不能与其它网络互通。

实验六一个vlan下的单臂路由

在一个vlan下,可以通过设置计算机的secondary ip实现在一个物理网络上两个具有不同网段IP计算机的联通。

1.设置计算机PCA的ip地址

[root#PCA root]# ifconfig eth0 10.65.1.1 netmask 255.255.0.0

[root#PCB root]# ifconfig eth0 10.66.1.1 netmask 255.255.0.0

[root#PCA root]# ping 10.66.1.1 (不通)(PCA ping PCB)

[root#PCB root]# ping 10.65.1.1 (不通)(PCB ping PCA)

PCA与PCB是不通的,因为它们在不同的网络段,一个是10.65.0.0/16网络,一个是10.66.0.0/16网络,即netid不同,而不同网络的主机间访问必须通过路由实现。

2. 设置路由器接口f0/0有两个ip地址。

roa(config)#int f0/0

roa(config-if)#ip address 10.65.1.2 255.255.0.0

roa(config-if)#ip address 10.66.1.2 255.255.0.0 secondary

roa(config-if)#no shut

roa(config-if)#exit

roa(config)#ip routing

roa#sh run

在显示信息中FastEthernet0/0的位置,应该能够看到设置的两个IP地址。

3. 测试可通性

[root#PCA root]# ping 10.66.1.1 (不通)

[root#PCA root]# ping 10.66.1.2 (通)

[root#PCB root]# ping 10.65.1.1 (不通)

[root#PCB root]# ping 10.65.1.3 (通)

为什么PCA和PCB还是不通呢?哦,还没有设置计算机的网关。

[root#PCA root]# route add default gw 10.65.1.2

[root#PCB root]# route add default gw 10.62.1.2

[root#PCA root]# ping 10.66.1.1 (通了)

[root#PCB root]# ping 10.65.1.1 (通了)

4) 去掉交换机与路由器的联接线

[root#PCA root]# ping 10.66.1.1 (不通了)

[root#PCB root]# ping 10.65.1.1 (不通了)

由此可以看出,PCA与PCB之间的发送的数据包是经过路由器的,从路由器f0/0入,

再从f0/0出,所以称之为单臂路由。

这种情况PCA和PCB在链路层是同一个广播域,对网络带宽不利。如果划分VLAN可以

隔离广播域。通过子接口可以实现对不同VLAN的路由。

5) 在交换机上的情况

双击交换机,进入交换机的终端模式:

switch>en

switch#conf t

switch(config)#int vlan 1

switch(config-if)#ip address 10.65.1.8 255.255.0.0

switch(config-if)#exit

switch(config)#ip default-gateway 10.65.1.2

switch(config)#end

switch#ping 10.65.1.1 (通)

switch#ping 10.66.1.1 (通)

断开交换机与路由器的联线,再执行从交换机ping 命令:

switch#ping 10.65.1.1 (通)

switch#ping 10.66.1.1 (不通)

这说明不同网络段IP的联通是要通过路由器的。

实验七子接口单臂路由

本实验接上一个实验,计算机和交换机的IP地址和网关不变,但要求交换机

工作在两个VLAN的情况下,一个是原有的默认vlan 1,另一个是新设置的vlan 2,

含f0/6、f0/7。

当交换机设置成两个vlan时,逻辑上已经成为两个网络,广播被隔离了。两

个vlan 的网络要通信,必须通过路由器,如果接入路由器的一个物理端口,则

必须有两个子接口分别与两个vlan对应,同时还要求与路由器相联的交换机的端

口f0/1要设置为trunk,因为这个口要通过两个vlan的数据包。

对于secondary ip的情况,实质上是一个接口,不能实现对两个vlan的路由。

1. 设置交换机的vlan 2和trunk

switch#vlan database

switch(vlan)#vlan 2

switch(vlan)#exit

switch#conf t

switch(config)#hostname SWA

SWA(config)#int f0/6

SWA(config-if)#switchport access vlan 2

SWA(config-if)#int f0/7

SWA(config-if)#switchport access vlan 2

SWA(config-if)#int f0/1

SWA(config-if)#switchport mode trunk

SWA(config-if)#switchport trunk allowed vlan 1,2,3

SWA(config-if)#switchport trunk encap dot1q

SWA(config-if)#end

SWA#sh vlan

SWA#sh run

检查设置情况,应该能正确的看到vlan和trunk等信息。

dot1q是vlan中继协议802.1q,一般cisco设备使用isl协议,其作用是一样的。

计算机的ip地址分别为10.65.1.1、10.66.1.1,网关分别指向路由器的子接口10.65.1.2、10.66.1.2。

[root#PCA root]# ping 10.66.1.1 (不通)

因为现在路由器还没有设置子接口,所以PCA与PCB不通。

2. 设置路由器f0/0 为两个子接口

roa(config)#int f0/0

roa(config-if)#no shut

roa(config-if)#int f0/0.1

roa(config-subif.1)#encapsulation dot1q 1

roa(config-subif.1)#ip address 10.65.1.2 255.255.0.0

roa(config-subif.1)#int f0/0.2

roa(config-subif.2)#encapsulation dot1q 2

roa(config-subif.2)#ip address 10.66.1.2 255.255.0.0

roa(config-subif.2)#exit

roa(config)#ip routing

roa#sh run

3. 测试可通性

[root#PCA root]# ping 10.66.1.1 (通)

[root#PCA root]# ping 10.66.1.2 (通)

[root#PCB root]# ping 10.65.1.1 (通)

[root#PCB root]# ping 10.65.1.2 (通)

如果去掉交换机与路由的连线,PCA和PCB还可以通吗?可见这也是一种单臂路由。实验八静态路由

1.设置计算机和路由器的IP地址

设置PCA、PCB的IP地址分别为:10.65.1.1和10.71.1.1。

[root#PCA root]# ifconfig eth0 10.65.1.1 netmask 255.255.0.0

[root#PCB root]# ifconfig eth0 10.71.1.1 netmask 255.255.0.0

[root#PCC root]# ifconfig eth0 10.70.1.1 netmask 255.255.0.0

[root#PCA root]# route add default gw 10.65.1.2

[root#PCB root]# route add default gw 10.71.1.2

[root#PCC root]# route add default gw 10.70.1.2

设置RouterA的IP地址: (子网掩码是255.255.0.0)

f0/0: 10.65.1.2 ----->10.65.1.1 (PCA) (箭头表示连接)

f0/1: 10.66.1.2

s0/0: 10.67.1.2

s0/1: 10.68.1.2 -----> (RouterA的s0/1接RouterB的s0/0)

设置RouterB的IP地址:

s0/0: 10.68.1.1 <----

s0/1: 10.69.1.2

f0/0: 10.70.1.2

f0/1: 10.71.1.2 ---->10.71.1.1 (PCB)

2.设置路由器的静态路由:

设置路由器的IP地址(略)

先看一下路由表:

show ip route 是显示路由表命令,它可以看到直联网络,静态路由和动态路由的情况,这是一个很常用的命令。

ROA#show ip route (只能看到直连路由)

ROA(config)#ip route 10.71.0.0 255.255.0.0 10.68.1.1

ROA(config)#ip routing

ROA#show ip route (多了一条静态路由)

从PCA ping PCB :

[rootPCA root]# ping 10.71.1.1 (通)

从PCA ping

[rootPCA root]# ping 10.70.1.2 (不通)

再设置一条静态路由:

ROA(config)#ip route 10.70.0.0 255.255.0.0 10.68.1.1

ROA(config)#end

ROA#show ip route (又多了一条静态路由)

[rootPCA root]# ping 10.70.1.2 (通了)

3.设置路由器的默认路由

先去掉两条静态路由:

ROA(config)#no ip route 10.70.0.0 255.255.0.0 10.68.1.1

ROA(config)#on ip route 10.71.0.0 255.255.0.0 10.68.1.1

[rootPCA root]# ping 10.71.1.1 (不通)

[rootPCA root]# ping 10.70.1.1 (不通)

设置RouterA的默认路由:

ROA(config)#ip route 0.0.0.0 0.0.0.0 10.68.1.1

ROA#show ip route

[rootPCA root]# ping 10.71.1.1 (通)

[rootPCA root]# ping 10.70.1.2 (通)

使用指定静态路由时,要查看指定的目的网络,使用默认路由时,不判断目的网络。

将匹配不了的数据包都发送给默认的下一跳。路由器设置中一般最后有一条默认路由。

问题:如果有三个路由器,静态路由如果设置呢?要求静态路由接力!

4. 三个路由器的静态路由

参考实验九图

设置RouterA的IP:

f0/0: 10.65.1.2 --->PCA:10.65.1.1

f0/1: 10.66.1.2 --->PCB:10.66.1.1

s0/0: 10.67.1.2

s0/1: 10.68.1.2 --->接RouterC s0/0

设置RouterC的IP:

s0/0: 10.68.1.1 <---

s0/1: 10.78.1.2 --->接RouterB s0/0

设置RouterB的IP:

s0/0: 10.78.1.1 <---

s0/1: 10.67.1.1

f0/0: 10.69.1.2 --->PCC:10.69.1.1

f0/1: 10.70.1.2 --->PCD:10.70.1.1

设置从PCA到PCC的静态路由

ROA(config)#ip routing

ROA(config)#ip route 10.69.0.0 255.255.0.0 10.68.1.1

ROA#show ip route

ROB(config)#ip route 10.69.0.0 255.255.0.0 10.78.1.1

ROB#show ip route

[rootPCA root]#ping 10.69.1.1 (通)

[rootPCA root]#ping 10.78.1.1 (不通)

[rootPCA root]#ping 10.70.1.1 (不通)

如何让PCA到 10.70.1.1 (PCD)通呢,像10.69.0.0网络一样,在路径的路由器上,再各写一条到10.70.0.0 网络的静态路由。

如果每一条路径都写一组静态路由显然不好,由于PCA在10.70.0.0 有一条通路,所以使用默认路由较好。

我们再做一个使用默认路由的小实验,先去掉原有的静态路由。

ROA(config)#no ip route 10.69.0.0 255.255.0.0 10.68.1.1

ROA#sh ip ro

ROB(config)#no ip route 10.69.0.0 255.255.0.0 10.78.1.1

ROB#sh ip ro

[rootPCA root]#ping 10.69.1.1 (不通)

ROA(config)#ip route 0.0.0.0. 0.0.0.0 10.68.1.1

ROA#sh ip ro

ROB(config)#ip route 0.0.0.0. 0.0.0.0 10.69.1.1

ROB#sh ip ro

[rootPCA root]#ping 10.69.1.1 (通)

[rootPCA root]#ping 10.70.1.1 (通)

[rootPCA root]#ping 10.78.1.1 (通)

路由表是路由器寻找网络的依据。是否能到达一个网络,要看路由表中有没有去

这个网络的路由表项,动态路由可以自动创建路由表,定时更新。

实验九动态路由

动态路由是指动态路由协议(如RIP)自动建立路由表,当你去掉一条连线时,它

会自动去掉其路由。路由器的每一个接口对应不同网络,而一条连接两个路由器连线

的两个端点IP应该属于同一网络。

设置的IP地址时,如果路由器的其它端口已有这个网络了,则提示已有这个网络,并显示对应的端口。如果是本端口可以覆盖。

1.设置计算机的IP

[root#PCA root]# ifconfig eth0 10.65.1.1 netmask 255.255.0.0

[root#PCB root]# ifconfig eth0 10.66.1.1 netmask 255.255.0.0

[root#PCC root]# ifconfig eth0 10.69.1.1 netmask 255.255.0.0

[root#PCD root]# ifconfig eth0 10.70.1.1 netmask 255.255.0.0

[root#PCA root]# route add default gw 10.65.1.2

[root#PCB root]# route add default gw 10.66.1.2

[root#PCC root]# route add default gw 10.69.1.2

[root#PCD root]# route add default gw 10.70.1.2

2.设置路由器的IP地址

RouterA(config)int f0/0

RouterA(config-if)#ip address 10.65.1.2 255.255.0.0

RouterA(config-if)#no shutdown

RouterA(config-if)#int f0/1

RouterA(config-if)#ip address 10.66.1.2 255.255.0.0

RouterA(config-if)#no shutdown

RouterA(config-if)#int s0/1

RouterA(config-if)#ip address 10.68.1.2 255.255.0.0

RouterA(config-if)#no shutdown

RouterA(config-if)#exit

RouterA(config)#ip routing

RouterA(config)#router rip

RouterA(config-router)#network 10.0.0.0

RouterA(config-router)#end

RouterA#

RouterCconfig)int s0/0

RouterC(config-if)#ip address 10.68.1.1 255.255.0.0

RouterC(config-if)#no shutdown

RouterC(config-if)#clock rate 64000

RouterC(config-if)#int s0/1

RouterC(config-if)#ip address 10.78.1.1 255.255.0.0

RouterC(config-if)#no shutdown

RouterC(config-if)#clock rate 64000

RouterC(config-if)#exit

RouterC(config)#ip routing

RouterC(config)#router rip

RouterC(config-router)#network 10.0.0.0

RouterC(config-router)#end

RouterB(config)int f0/0

RouterB(config-if)#ip address 10.69.1.2 255.255.0.0

RouterB(config-if)#no shutdown

RouterB(config-if)#int f0/1

RouterB(config-if)#ip address 10.70.1.2 255.255.0.0

RouterB(config-if)#no shutdown

RouterB(config-if)#int s0/0

RouterB(config-if)#ip address 10.78.1.2 255.255.0.0

RouterB(config-if)#no shutdown

RouterB(config-if)#exit

RouterB(config)#ip routing

RouterB(config)#router rip

RouterB(config-router)#network 10.0.0.0

RouterB(config-router)#end

RouterA#sh ip route

RouterC#sh ip route

RouterB#sh ip route

是否可以看到动态路由表?如果看不到,请检查路由器是否启动了转发iprouting ,

的接口是否激活,命令network设置路由器发布的网络。

计算机PCA 测试到各点的连通性:

3. 测试网络联通性

[rootPCA root]#ping 10.65.1.2 (通)

[rootPCA root]#ping 10.66.1.1 (通)

[rootPCA root]#ping 10.66.1.2 (通)

[rootPCA root]#ping 10.68.1.1 (通)

[rootPCA root]#ping 10.68.1.2 (通)

[rootPCA root]#ping 10.78.1.1 (通)

[rootPCA root]#ping 10.78.1.2 (通)

[rootPCA root]#ping 10.69.1.1 (通)

[rootPCA root]#ping 10.69.1.2 (通)

[rootPCA root]#ping 10.70.1.1 (通)

[rootPCA root]#ping 10.70.1.2 (通)

断开某个路由路由器连线,或执行no ip routing,或某相接口执行shutdow,

再通过sh ip ro 命令查看路由表。

你也可以再加一个路由器,设置好后,再查看表由表。

实验十交换机和路由器组合实验

要求所有计算机和交换机以及路由器的端口可以联通。由于交换机下的计算机在

两个网络段,所以要求划分vlan,现要求switchA和switchB的f0/5和f0/6在vlan 2.

1. 设置计算机的IP地址和网关:

[root#PCA root]# ifconfig eth0 10.65.1.1 netmask 255.255.0.0

[root#PCB root]# ifconfig eth0 10.66.1.1 netmask 255.255.0.0

[root#PCC root]# ifconfig eth0 10.69.1.1 netmask 255.255.0.0

[root#PCD root]# ifconfig eth0 10.70.1.1 netmask 255.255.0.0

[root#PCE root]# ifconfig eth0 10.60.1.1 netmask 255.255.0.0

[root#PCF root]# ifconfig eth0 10.66.1.3 netmask 255.255.0.0

[root#PCG root]# ifconfig eth0 10.60.1.3 netmask 255.255.0.0

[root#PCA root]# route add default gw 10.65.1.2

[root#PCB root]# route add default gw 10.66.1.2

[root#PCC root]# route add default gw 10.69.1.2

[root#PCD root]# route add default gw 10.70.1.2

[root#PCE root]# route add default gw 10.60.1.2

[root#PCF root]# route add default gw 10.66.1.2

[root#PCG root]# route add default gw 10.60.1.2

2. 设置交换机的IP地址、网关和干线

switchA#vlan database

switchA(vlan)#vlan 2

switchA(vlan)#exit

switchA#conf t

switchA(config)#int f0/5

switchA(config-if)#switchport access vlan 2

switchA(config-if)#int f0/6

switchA(config-if)#switchport access vlan 2

switchA(config-if)#int f0/1

switchA(config-if)#switchport mode trunk

switchA(config-if)#switchport trunk encap dot1q switchA(config-if)#end

switchA#sh vlan

switchA#sh run

switchB#vlan database

switchB(vlan)#vlan 2

switchB(vlan)#exit

switchB#conf t

switchB(config)#int f0/5

switchB(config-if)#switchport access vlan 2

switchB(config-if)#int f0/6

switchB(config-if)#switchport access vlan 2

switchB(config-if)#int f0/8

switchB(config-if)#switchport mode trunk

switchB(config-if)#switchport trunk encap dot1q switchB(config-if)#int f0/2

switchB(config-if)#switchport mode trunk

switchB(config-if)#switchport trunk encap dot1q switchB(config-if)#end

switchB#sh vlan

switchB#sh run

switchA#conf t

switchA(config)#int vlan 1

switchA(config-if)#ip address 10.65.1.8 255.255.0.0 switchA(config-if)#exit

switchA(config)#ip default-gateway 10.65.1.2 switchA(config)#end

switchA#sh run

switchB#conf t

switchB(config)#int vlan 1

switchB(config-if)#ip address 10.65.1.9 255.255.0.0 switchB(config-if)#exit

switchB(config)#ip default-gateway 10.65.1.2 switchB(config)#end

switchB#sh run

3.设置路由器的IP和动态路由

RouterA(config)int f0/0

RouterA(config-if)#ip address 10.65.1.2 255.255.0.0 RouterA(config-if)#no shutdown

RouterA(config-if)#int f0/1

RouterA(config-if)#no shutdown

RouterA(config-if)#int f0/1.1

RouterA(config-subif)#ip address 10.66.1.2 255.255.0.0 RouterA(config-subif)#int f0/1.2

RouterA(config-subif)#ip address 10.60.1.2 255.255.0.0 RouterA(config-subif)#int s0/1

RouterA(config-if)#ip address 10.68.1.2 255.255.0.0 RouterA(config-if)#no shutdown

RouterA(config-if)#exit

RouterA(config)#ip routing

RouterA(config)#router rip

RouterA(config-router)#network 10.0.0.0

RouterA(config-router)#end

RouterA#

RouterC和RouterB的IP如下,设置过程略。

RouterC s0/0 :10.68.1.1 s0/1:10.78.1.2

RouterB s0/0 :10.78.1.1 f0/0 :10.69.1.2 f0/1:10.70.1.2

4.测试各点的联通性

[rootPCA root]#ping 10.65.1.2 (通)

[rootPCA root]#ping 10.66.1.1 (通)

[rootPCA root]#ping 10.66.1.2 (通)

[rootPCA root]#ping 10.66.1.3 (通)

[rootPCA root]#ping 10.60.1.1 (通)

[rootPCA root]#ping 10.60.1.2 (通)

[rootPCA root]#ping 10.60.1.3 (通)

[rootPCA root]#ping 10.69.1.1 (通)

[rootPCA root]#ping 10.69.1.2 (通)

[rootPCA root]#ping 10.70.1.1 (通)

[rootPCA root]#ping 10.70.1.2 (通)

[rootPCA root]#ping 10.66.1.8 (通)

[rootPCA root]#ping 10.66.1.9 (通)

switchA#ping 10.65.1.1 (通)

switchA#ping 10.66.1.1 (通)

switchA#ping 10.66.1.2 (通)

switchA#ping 10.66.1.3 (通)

switchA#ping 10.60.1.1 (通)

switchA#ping 10.60.1.2 (通)

switchA#ping 10.60.1.3 (通)

switchA#ping 10.69.1.1 (通)

switchA#ping 10.70.1.1 (通)

[rootPCD root]#ping 10.66.1.9 (通)

network是发布路由,现将routerC的f0/0设置为11.0.0.0网络,情况如何呢?

RouterC(config)#int f0/0

RouterC(config-if)#ip address 11.0.0.2 255.255.0.0

RouterC(config-if)#no shutdown

[root#PCH root]# ifconfig eth0 11.0.0.1 netmask 255.255.0.0

[root#PCH root]# route add default gw 11.0.0.2

现在PCH可以与其它计算机互通吗?(不发布11网络,别人看不到,但它可以看到别人,所以单向通)。

设置RouterC的network all或增加network 11.0.0.0 情况以如何呢?(互通了) 。

实验十一访问控制列表

1. 配置路由器到网络各点可通

设网络图动态路由已设好,IP地址分配如下:

PCA ip:10.65.1.1 gateway:10.65.1.2

PCB ip:10.66.1.1 gateway:10.66.1.2

PCC ip:10.69.1.1 gateway:10.69.1.2

PCD ip:10.70.1.1 gateway:10.70.1.2

PCE ip:10.65.1.3 gateway:10.65.1.2

PCF ip:10.65.2.1 gateway:10.65.1.2

SWA ip:10.65.1.8 gateway:10.65.1.2

RouterA f0/0: 10.65.1.2

RouterA f0/1: 10.66.1.2

RouterA s0/1: 10.68.1.2

RouterC s0/0: 10.68.1.1

RouterC s0/1: 10.78.1.2

RouterB s0/0: 10.78.1.1

RouterB s0/1: 10.79.1.2

RouterB f0/0: 10.69.1.2

RouterB f0/1: 10.70.1.2

2.基本的访问控制列表:

先从PCA ping PCD:

[rootPCA root]#ping 10.70.1.1 (通)

在ROC的s0/0写一个输入的访问控制列表:

RouterC(config)#access-list 1 permit 10.65.1.1 0.0.0.0

RouterC(config)#access-list 1 deny any

RouterC(config)#int s0/0

RouterC(config-if)#ip access-group 1 in

RouterC(config-if)#end

RouterC#sh access-list 1

[rootPCA root]#ping 10.70.1.1 (通) (只允许PCA)

[rootPCE root]#ping 10.70.1.1 (不通)(被access-list 1禁止)

[rootPCE root]#ping 10.66.1.1 (通) (不经过access-list 1)

[rootPCB root]#ping 10.70.1.1 (不通)(被access-list 1禁止)

[rootPCD root]#ping 10.65.1.1 (不通)(echo-reply包不能返回)

第一个ping命令,PCA的IP地址是10.65.1.1在访问控制列表access-list 1中是允许的,所以能通。

第二个ping命令,PCE虽然是65网段,但是access-list 只允许10.65.1.1通过,所以10.65.1.3的数据包不能通过。

第三个ping命令,PCE到PCB不通过RouterC的s0/0,所以能通。

第四个ping命令,PCB的IP地址是10.66.1.1,它是被禁止的,所以不通。

第五个ping命令,从10.65.1.1返回包echo-reply不能通过access-list 1,PCD 收

不到返回包,所以不通。有些系统的ping 命令,echo不能通过时表示为unreachable ,

若echo-reply不能返回时,表示为timeout,等待时间超时。

下面再写一个访问控制列表,先删除原访问控制列表:

RouterC(config)#no access-list 1

RouterC(config-if)#no ip access-group 1 in

二者都可以实现去掉访问列表的目的。前者是从列表号角度删除,后者是从端口

和输入或输出的角度删除。

可以通过show access-list 命令查看删除情况,下面再写一个访问控制列表:RouterC(config)#access-list 2 deny 10.65.1.1 0.0.0.255

RouterC(config)#access-list 2 permit any

RouterC(config)#int s0/1

RouterC(config-if)#ip access-group 2 out

RouterC(config-if)#end

RouterC#sh access-list

这个访问控制列表比上一个访问控制列表有以下几点不同:

(1)先deny后permit,

(2)禁止的是一个10.65.1.0网络

(3)是输出的访问控制列表

[rootPCA root]#ping 10.69.1.1 (不通)

[rootPCE root]#ping 10.69.1.1 (不通)

[rootPCF root]#ping 10.69.1.1 (通) (10.65.2.1不在禁止围)

[rootPCB root]#ping 10.69.1.1 (通) (10.66.1.1不在禁止围) 因为PCA和PCE的IP地址10.65.1.1、10.65.1.3,在deny围所以不通。

而PCF的IP是10.65.2.1不在10.65.1.0 0.0.0.255围,所以能通。

3.梯形基本访问控制列表

访问控制列表一般是顺序匹配的,梯形结构,参考如下:

RouterC(config)#access-list 4 permit 10.65.1.1

RouterC(config)#access-list 4 deny 10.65.1.0 0.0.0.255

RouterC(config)#access-list 4 permit 10.65.0.0 0.0.255.255

RouterC(config)#access-list 4 deny 10.0.0.0 0.255.255.255

RouterC(config)#access-list 4 permit any

RouterC(config)#int s0/1

RouterC(config-if)#ip access-group 4 out

RouterC(config-if)#end

[rootPCA root]#ping 10.69.1.1 (通)

[rootPCE root]#ping 10.69.1.1 (不通) (10.65.1.3禁止)

[rootPCF root]#ping 10.69.1.1 (通) (10.65.2.1不在禁止围) [rootPCB root]#ping 10.69.1.1 (不通) (10.66.1.1禁止)

4. 扩展访问控制列表

扩展的访问控制列表,有源和目的两个ip,并且要指明应用的协议。实际中可控制的协议有很多,本软件实际只支持icmp的echo操作,用以说明问题。

例1. 阻止PCA访问PCD:

RouterC(config)#access-list 101 deny icmp 10.65.1.1 0.0.0.0 10.70.1.1 0.0.0.0 echo

RouterC(config)#access-list 101 permit ip any any

RouterC(config)#int s0/0

RouterC(config-if)#ip access-group 101 in

RouterC#sh access-list 101

[rootPCA root]#ping 10.70.1.1 (不通)(请求echo包被禁止)

[rootPCE root]#ping 10.70.1.1 (通)

[rootPCF root]#ping 10.70.1.1 (通)

[rootPCD root]#ping 10.65.1.1 (通)

RouterC(config)#no access-list 101

RouterC#sh access-list

[rootPCA root]#ping 10.70.1.1 (去掉访问控制列表,就通了)

3. 阻止10.65.1.0/24网络访问 10.70.1.1(PCD)。

RouterC(config)#access-list 102 deny icmp 10.65.1.1 0.0.0.255 10.74.1.1 0.0.0.0 echo

RouterC(config)#access-list 102 permit ip any any

RouterC(config)#interface s0/1

RouterC(config-if)#ip access-group 102 (默认为out)

[rootPCA root]#ping 10.70.1.1 (不通)(PCE:10.65.1.1禁止)

[rootPCE root]#ping 10.70.1.1 (不通)(PCE:10.65.1.3禁止)

[rootPCF root]#ping 10.70.1.1 (通) (PCE:10.65.2.1允许)

如果将扩展访问控制列表的目的IP的匹配码改成0.0.0.255,又会怎样呢?

请自己分析或做实验。

实验十二综合实验

1. 装入文件all 并使窗体最大化。

2. 规划网络各点IP。

3. 通过配置让各计算机和交换之间可以ping通。

4. 适当设置访问控制列表,检查结果。

规划网络ip地址建议如下:

HostA:192.168.1.1 SwitchA:192.168.1.8 RouterA f0/1:192.168.1.2

HostB:192.168.2.1 SwitchB:192.168.2.8 RouterB f0/1:192.168.2.2

HostC:192.168.3.1 SwitchC:192.168.3.8 RouterC f0/1:192.168.3.2

HostD:192.168.4.1 SwitchD:192.168.4.8 RouterD f0/1:192.168.4.2

HostE:192.168.5.1 SwitchE:192.168.5.8 RouterE f0/1:192.168.5.2

HostF:192.168.5.3

HostG:192.168.6.1 SwitchF:192.168.6.8 RouterF f0/1:192.168.6.2

HostH:192.168.6.3

RouterA s0/0:192.168.11.1 ---> RouterE s0/0:192.168.11.2

RouterB s0/0:192.168.12.1 ---> RouterE s0/1:192.168.12.2

RouterC s0/0:192.168.13.1 ---> RouterF s0/0:192.168.13.2

RouterD s0/0:192.168.14.1 ---> RouterF s0/1:192.168.14.2 PPP 配置实验:

PPP(Point to Point Protocol)协议是一种点对点通讯协议。

封装协议:

encapsulation ppp

认证方式:

ppp authentication {chap|pap}[if][list-name|default][callin]

指定口令:

username name password secret

设置DCE端速度:

clockrate speed

其中name 应该是对端路由器的名称(Hostname)。口令验证通过方可通讯。配置PPP:

RouterA(config)#username RouterB password abc

RouterA(config)#int s0/0

RouterA(config-if)#encap ppp

RouterA(config-if)#ppp authentication chap

RouterA(config-if)#ip address 10.65.1.1 255.255.255.0

RouterA(config-if)#clockrate 1000000

RouterA(config-if)#no shut

RouterA(config-if)#end

RouterA#end

RouterB(config)#username RouterA password abc

RouterB(config)#int s0/0

RouterB(config-if)#encap ppp

RouterB(config-if)#ppp authentication chap

RouterB(config-if)#ip address 10.65.1.2 255.255.255.0

RouterB(config-if)#no shut

RouterB(config)#end

RouterA#

RouterA#ping 10.65.1.1

配置BGP:

自治系统AS间的通讯要采用外部网关协议EGP(External Getway Protocol),而BGP(Backbone Getway Protocol)协议是典型的一种外

部网关协议。

RIP、OSPF、IGRP、EIGRP 都属于部网关协议IGP,部网关协

议在独立系统部传送有关部路由的信息。

外部网关协议用来传送从IGP分离出的AS之间的路由信息,设有两个AS自治系统为别为AS 100 和AS 200。

在系统边界路由器上如下设置:

参考配置如下:

routerA(config)#router bgp 100

routerA(config-router)#network 19.0.0.0

routerA(config-router)#neighbor 8.1.1.2 remote-as 200

routerA(config-router)#end

routerA#

routerB(config)#router bgp 200

routerB(config-router)#network 16.0.0.0

routerB(config-router)#neighbor 8.1.1.1 remote-as 100

routerB(config-router)#end

routerB#

routerB#ping 8.1.1.2

点对点帧中继配置(Point to point frame relay)

设RouterB做帧中继交换机,配置如下:

RouterB(config)#frame-relay switching

RouterB(config)#int s0/0

RouterB(config-if)#ip address 172.l6.20.2 255.255.255.0 RouterB(config-if)#encap frame-relay

RouterB(config-if)#fram-relay lmi-type cisco

RouterB(config-if)#frame-relay intf-type dce

RouterB(config-if)#frame-relay interface-dlci 16

RouterB(config-fr-dlci)#exit

RouterB(config-if)#no shutdown

RouterB(config)#int s0/1

RouterB(config-if)#ip address 172.l6.40.1 255.255.255.0 RouterB(config-if)#encap frame-relay

RouterB(config-if)#fram-relay lmi-type cisco

RouterB(config-if)#frame-relay intf-type dce

RouterB(config-if)#frame-relay interface-dlci 17

RouterB(config-fr-dlci)#exit

RouterB(config-if)#no shutdown

RouterA(config)#int s0/0

RouterA(config-if)#ip address 172.l6.20.1 255.255.255.0

RouterA(config-if)#encap frame-relay

RouterA(config-if)#fram-relay lmi-type cisco

RouterA(config-if)#frame-relay interface-dlci 16

RouterC(config-fr-dlci)#exit

RouterA(config-if)#no shutdown

RouterC(config)#int s0

RouterC(config-if)#ip address 172.l6.40.2 255.255.255.0

RouterC(config-if)#encap frame-relay

RouterC(config-if)#fram-relay lmi-type cisco

RouterC(config-if)#frame-relay interface-dlci 17

RouterC(config-fr-dlci)#exit

RouterC(config-if)#no shutdown

RouterA#sh frame map

RouterA#sh frame pvc

三层交换机实验:

实现交换机vlan间的路由,使用具有三层交换功能的交换机是理想的选择,无论是从性能上还是从价格上都是有优势的。Cisco 3550是具有三层交换功能

的交换机。

在交换机上先建两个vlan,分别为vlan 2 和vlan 3,将f0/2 放入vlan 2,将f0/6放入vlan 3,再设置vlan 2 和 vlan 3的IP地址,最后启动路由转发:ip routing。

交换机配置如下:

Switch#vlan database

Switch(vlan)#vlan 2

Switch(vlan)#vlan 3

Switch(vlan)#exit

Switch#conf t

Switch(config)#int f0/2

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 2

Switch(config-if)#description connected HostA

Switch(config-if)#int f0/6

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 3

思科交换机命令大全

思科交换机常用命令大全 1.1 用户模式与特权模式 用户模式:可以使用一些基本的查询命令 特权模式:可以对交换机进行相关的配置 进入特权模式命令:Switch>enable 退出特权模式命令:Switch#exit 启用命令查询:? 时间设置:Switch#clock set 时间(自选参数,参数必须符合交换机要求) 显示信息命令:Switch#show 可选参数 注意:可以用TAB键补齐命令,自选参数为用户自定义参数,可选参数为交换机设定参数 查看交换机配置: Switch#show running-config 保存交换机配置:Switch#copy running-config startup-config Switch#wr 查看端口信息:Switch#show interface 查看MAC地址表:Switch#show mac-address-table 查看交换机CPU的状态信息:Switch#show processes 1.2 全局配置模式 进入全局配置模式:Switch#configure terminal

主机名修改:Switch(config)#hostname 主机名(自选参数) 特权模式进入密码: Switch(config)#enable secret 密码(自选参数) 取消特权模式密码:Switch(config)#no enable secret 取消主机名设置: Switch(config)#no hostname 退出配置模式: Switch(config)#exit 需要特别注意的是在配置模式中无法使用show命令,如果要使用 的话show前必须加do和空格,例如:do show * 指定根交换机命令:Switch(config)#spanning-tree vlan 自选参数(VLAN号)root primary 例如: Switch(config)#spanning-tree vlan 1 root primary 需要注意的是:设置根交换机是基于VLAN的 关闭生成树协议命令:Switch(config)#no spanning-tree vlan 自选参数(VLAN 号) 例如: Switch(config)#no spanning-tree vlan 1 1.3 接口配置模式 进入接口配置模式:Switch(config)#interface 端口名称(可选参数) 启用端口:Switch(config-if)#no shutdown 停用端口:Switch(config-if)#shutdown 进入同种类型多端口配置:Switch(config)# interface range fastethernet 0/1-5 进入不同类型多端口配置:Switch(config)#interface range fastethernet 0/1-5,gigabitethernet 0/1-2

Cisco设备的基本配置命令

switch> 用户模式 1:进入特权模式 enable switch> enable switch# 2:进入全局配置模式 configure terminal switch> enable switch#c onfigure terminal switch(conf)# 3:交换机命名 hostname aptech2950 以aptech2950为例 switch> enable switch#c onfigure terminal switch(conf)#hostname aptch-2950 aptech2950(conf)# 4:配置使能口令 enable password cisco 以cisco为例 switch> enable switch#c onfigure terminal switch(conf)#hostname aptch2950 aptech2950(conf)# enable password cisco 5:配置使能密码 enable secret ciscolab 以cicsolab为例 switch> enable switch#c onfigure terminal switch(conf)#hostname aptch2950 aptech2950(conf)# enable secret ciscolab 6:设置虚拟局域网vlan 1 interface vlan 1 switch> enable switch#c onfigure terminal switch(conf)#hostname aptch2950 aptech2950(conf)# interface vlan 1 aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口ip 和子网掩码 aptech2950(conf-if)#no shut 是配置处于运行中aptech2950(conf-if)#exit aptech2950(conf)#ip default-gateway 192.168.254 设置网关地址 7:进入交换机某一端口 interface fastehernet 0/17 以17端口为例switch> enable switch#c onfigure terminal switch(conf)#hostname aptch2950 aptech2950(conf)# interface fastehernet 0/17 aptech2950(conf-if)#

思科交换机-常用命令及配置

思科交换机-常用命令及配置 switch> 用户模式 1:进入特权模式enable switch> enable switch# 2:进入全局配置模式configure terminal switch> enable switch#configure terminal switch(conf)# 3:交换机命名hostname name 以cisco001 为例 switch> enable switch#c onfigure terminal switch(conf)#hostname cisco001 cisco001(conf)# 4:配置使能口令(未加密)enable password cisco 以cisco 为例switch> enable switch#configure terminal cisco001(conf)# enable password cisco 5:配置使能密码(加密)enable secret ciscolab 以cicsolab 为例switch> enable switch#configure terminal switch(conf)# enable secret ciscolab

6:设置虚拟局域网vlan 1 interface vlan 1 switch> enable switch#configure terminal switch(conf)# interface vlan 1 switch(conf)# ip address 192.168.1.1 255.255.255.0 配置交换机端口ip 和子网掩码 switch (conf-if)#no shut 激活端口 switch (conf-if)#exit switch (conf)#ip default-gateway 192.168.254 设置网关地址 7:进入交换机某一端口interface fastehernet 0/17 以17 端口为例 switch> enable switch#configure terminal switch(conf)# interface fastehernet 0/17 switch(conf-if)# 8:查看命令show switch> enable switch# show version 察看系统中的所有版本信息 show interface vlan 1 查看交换机有关ip 协议的配置信息 show running-configure 查看交换机当前起作用的配置信息 show interface fastethernet 0/1 察看交换机1 接口具体配置和统计信息 show mac-address-table 查看mac 地址表

CiscoDHCP配置实验

Cisco DHCP配置实验 ?一、PC动态获取IP地址(路由器做DHCP服务器) o 1. 拓扑图 o 2. 配置步骤(有些顺序不重要) o 3. 命令配置(之后的命令解析参考该实验) ?二、路由器端口动态获取IP地址(路由器做DHCP服务器)o 1. 拓扑图 o 2. 配置步骤(有些顺序不重要) o 3. 配置命令 ?三、跨网段的动态获取IP地址(路由器做DHCP服务器)即分配不同网段o 1. 拓扑图 o 2. 配置步骤(有些顺序不重要) o 3. 配置命令 ?四、跨网段的动态获取IP地址(计算机做DHCP服务器) o 1. 拓扑图 o 2. 配置步骤 o 3. 配置命令 ?五、无线自动获取IP ?六、DHCP知识点 o 1. 关于ip helper-address命令 o2.DHCP服务器分配地址原理 o3.DHCP请求过程 o 4. ip helper-address 命令的注意事项 o 5. DHCP好处: 一、PC动态获取IP地址(路由器做DHCP服务器) 1. 拓扑图

2. 配置步骤(有些顺序不重要) 1.创建地址池 2.分配的地址池范围 3.配置网关 4.配置dns 5.给路由器端口配置IP 6.如有需要则配置不自动分配的地址段或某个地址 3. 命令配置(之后的命令解析参考该实验) Router>en Router#config t Router(config)#ip dhcp pool LAN (创建地址池,名字(LAN)自定义)Router(dhcp-config)#network 192.168.1.0 255.255.255.0 (地址池范围)Router(dhcp-config)#default-router 192.168.1.1 (默认网关)

cisco交换机(Switch)配置命令大全

1.在基于IOS的交换机上设置主机名/系统名: switch(config)# hostname hostname 在基于CLI的交换机上设置主机名/系统名: switch(enable) set system name name-string 2.在基于IOS的交换机上设置登录口令: switch(config)# enable password level 1 password 在基于CLI的交换机上设置登录口令: switch(enable) set password switch(enable) set enalbepass 3.在基于IOS的交换机上设置远程访问: switch(config)# interface vlan 1 switch(config-if)# ip address ip-address netmask switch(config-if)# ip default-gateway ip-address 在基于CLI的交换机上设置远程访问: switch(enable) set interface sc0 ip-address netmask broadcast-address switch(enable) set interface sc0 vlan switch(enable) set ip route default gateway 4.在基于IOS的交换机上启用和浏览CDP信息: switch(config-if)# cdp enable switch(config-if)# no cdp enable

为了查看Cisco邻接设备的CDP通告信息: switch# show cdp interface [type modle/port] switch# show cdp neighbors [type module/port] [detail] 在基于CLI的交换机上启用和浏览CDP信息: switch(enable) set cdp {enable|disable} module/port 为了查看Cisco邻接设备的CDP通告信息: switch(enable) show cdp neighbors[module/port] [vlan|duplex|capabilities|detail] 5.基于IOS的交换机的端口描述: switch(config-if)# description description-string 基于CLI的交换机的端口描述: switch(enable)set port name module/number description-string 6.在基于IOS的交换机上设置端口速度: switch(config-if)# speed{10|100|auto} 在基于CLI的交换机上设置端口速度: switch(enable) set port speed moudle/number {10|100|auto} switch(enable) set port speed moudle/number {4|16|auto} 7.在基于IOS的交换机上设置以太网的链路模式: switch(config-if)# duplex {auto|full|half} 在基于CLI的交换机上设置以太网的链路模式: switch(enable) set port duplex module/number {full|half}

Cisco路由器的基本配置命令

Cisco路由器的基本配置命令 Cisco 路由器的基本配置命令 一(实训目的 1(掌握路由器的连接方式和使用基本规则。 2(掌握路由器的基本配置命令。 二(实训器材及环境 1(安装 Windows 2000 Server 系统的计算机一台。 2(安装模拟软件 Boson Netsim 5.31。 3(模拟环境如下: 图 11-1 实验拓扑环境 三(实训理论基础 1(路由器的基本配置语句 (1)配置路由器名字和特权密码: Router1> enable Router1# conf t Router1(config)# hostname R1 R1(config)# enable secret 123456
b5E2RGbCAP
(2)配置路由器的 Ethernet 端口:
R1(config)# interface e0 R1(config-if)# ip address 192.168.1.1 255.255.255.0 p1EanqFDPw R1(config-if)# no shutdown (3)配置路由器的 Serial 端口(DTE 端):DXDiTa9E3d R1(config)# interface s0 R1(config-if)# ip address 10.0.0.1 255.0.0.0 R1(config-if)# no shutdown (4)配置路由器的 Serial 端口(DCE 端):
RTCrpUDGiT
R2(config)# interface s0 R2(config-if)# ip address 10.0.0.2 255.0.0.0 R2(config-if)# clock rate 64000 R2(config-if)# no shutdown 2(路由器可以有多种类型的端口,用于连接 不同的网络,常用的有以太网端口(Ethernet)、快速以太网端口 (FastEthernet)、高速同步串口(Serial)等。有的端口是固定端口,有的端
5PCzVD7HxA
- 1 -

1-cisco路由器基本配置及远程登录

实训目的: (1)学习和掌握科路由器的配置方式和要求。 (2)学习和掌握科路由器的工作模式分类、提示符、进入方式。1、路由器的配置方式 ①超级终端方式。该方式主要用于路由器的初始配置,路由器不需要IP地址。基本方法是:计算机通过COM1/COM2口和路由器的Console口连接,在计算机上启用“超级终端”程序,设置“波特率:9600 ,数据位:8,停止位:1,奇偶校验: 无,校验:无”即可。常用 ②Telnet方式。该方式配置要求路由器必须配置了IP地址。基本方法是:计算机通过网卡和路由器的以太网接口相连,计算机的网卡和路由器的以太网接口的IP地址必须在同一网段。常用 ③其他方式:AUX口接MODEM,通过电话线与远方运行终端仿真软件的微机;通过Ethernet上的TFTP服务器;通过Ethernet上的SNMP网管工作站。 2、路由器的工作模式 在命令行状态下,主要有以下几种工作模式: ①一般用户模式。主要用于查看路由器的基本信息,只能执行少数命令,不能对路由 器进行配置。提示符为:Router>;进入方式为:Telnet或Console ②使能(特权)模式。主要用于查看、测试、检查路由器或网络,不能对接口、路由 协议进行配置。提示符为:Router#;进入方式为:Router>enable。 ③全局配置模式。主要用于配置路由器的全局性参数。提示符为:Router(config)#; 进入方式为:Router#config ter。 ④全局模式下的子模式。包括:接口、路由协议、线路等。其进入方式和提示符如下: Router(config)#ineterface e0 //进入接口模式 Router(config-if)#//接口模式提示符 Router(config)#rip //进入路由协议模式 Router(config-router)# //路由协议模式 Router(config)#line con 0 //进入线路模式

思科基本配置命令详解

思科交换机基本配置实例讲解

目录 1、基本概念介绍 (2) 2、密码、登陆等基本配置 (2) 3、C ISCO 设备端口配置详解 (8) 4、V LAN的规划及配置 (13) 4.1核心交换机的相关配置 (13) 4.2接入交换机的相关配置 (25) 5、配置交换机的路由功能 (30) 6、配置交换机的DHCP功能 (31) 7、常用排错命令 (32)

1、基本概念介绍 IOS: 互联网操作系统,也就是交换机和路由器中用的操作系统 VLAN: 虚拟Ian VTP: VLAN TRUNK PROTOCOL DHCP: 动态主机配置协议 ACL :访问控制列表 三层交换机:具有三层路由转发能力的交换机本教程中“ #”后的蓝色文字为注释内容。 2、密码、登陆等基本配置 本节介绍的内容为cisco路由器或者交换机的基本配置,在目前版本的cisco交换机或 路由器上的这些命令是通用的。本教程用的是cisco的模拟器做的介绍,一些具体的端口显 示或许与你们实际的设备不符,但这并不影响基本配置命令的执行。 Cisco 3640 (R4700) processor (revisi on OxFF) with 124928K/6144K bytes of memory. Processor board ID 00000000 R4700 CPU at 100MHz, Implementation 33, Rev 1.2 2 Ether net in terfaces 8 Serial in terfaces DRAM configuration is 64 bits wide with parity enabled. 125K bytes of NVRAM. 8192K bytes of processor board System flash (Read/Write) ---System Configuration Dialog -- Would you like to enter the initial configuration dialog? [yes/no]: n #此处我们选择no,不进入他的初始化配置向导 Press RETURN to get started! #选择no以后,提示你按回车键开始,此处我们需要按回车键 *Mar 1 00:43:56.591: %IP-5-WEBINST_KILL: Term in ati ng DNS process *Mar 1 00:43:58.379: %SYS-5-RESTART: System restarted - Cisco IOS Software, 3600 Software (C3640-JK9O3S-M), Version 12.3(14)T7, RELEASE SOFTWARE (fc2) Tech ni cal Support: https://www.360docs.net/doc/0017559977.html,/techsupport

思科实验总结

实验名称: VLAN创建和管理以及TRUNK链路的配置。 实验目的: 学习VLAN的创建命令及管理方法 学习交换机端口模式——trunk模式 学习trunk链路的配置和管理方法。 实验步骤: 1、首先正确连接PC与交换机 a.PC1与交换机1端口连接,PC2与交换机2端口连接。 b.交换机1与交换机2连接用10端口连接。 2、给交换机配置IP地址(192.168.1.*/24)和做标记。 实验拓扑图: 3、打开交换机1点击命令栏进行VLAN的配置。 a.命令栏中输入enable进入特权视图。 b.现在由特权视图进入全局视图输入conf t再次按Tab键回车即可进入全局视图。 c.在全局视图下创建一个VLAN 10输入命令VLAN 10并给这个vlan命名为student,输 入命令name student,输入exit退出VLAN 10模式。 d.在全局视图下创建一个VLAN 20输入命令VLAN 20并给这个vlan命名为teacher,输 入命令name teacher,输入exit退出VLAN20模式。 e.在全局视图下进入交换机接口f0/1输入int按Tab再输入f0/1回车,在接口视图下 将该接口划入VLAN 20输入switchport access vlan 20。 f.在全局视图下进入交换机接口f0/2输入int按Tab再输入f0/2回车,在接口视图下 将该接口划入VLAN 10输入switchport access vlan 10。 g.由全局视图进入接口f0/10输入命令interface f0/10,在接口视图下设置该接口工 作模式为TRUNK模式输入命令switchport mode trunk,在接口视图下设置该TRUNK端口允许全部VLAN通过。

思科交换机路由器命令大全

思科交换机路由器命令 大全 YUKI was compiled on the morning of December 16, 2020

1. 交换机支持的命令:交换机基本状态: 交换机口令设置: switch>enable ;进入特权模式switch#config terminal ;进入全局配置模式 switch(config)#hostname ;设置交换机的主机名 switch(config)#enable secret xxx ;设置特权加密口 令switch(config)#enable password xxa ;设置特权非 密口令switch(config)#line console 0 ;进入控制台 口switch(config-line)#line vty 0 4 ;进入虚拟终端 switch(config-line)#login ;允许登录 switch(config-line)#password xx ;设置登录口令 xxswitch#exit ;返回命令 交换机VLAN设置:

switch(vlan)#vlan 2 ;建VLAN 2switch(vlan)#no vlan 2 ;删vlan 2switch(config)#int f0/1 ;进入端 口1switch(config-if)#switchport access vlan 2 ; 当前端口加入vlan 2switch(config-if)#switchport mode trunk ;设置为干线switch(config- if)#switchport trunk allowed vlan 1,2 ;设置允许 的vlanswitch(config-if)#switchport trunk encap dot1q ;设置vlan 中继switch(config)#vtp domain ;设置发vtp域名switch(config)#vtp password ;设置发vtp密码switch(config)#vtp mode server ;设置发vtp模式switch(config)#vtp mode client ;设置发vtp模式 交换机设置IP地址: 交换机显示命令:

Removed_思科设备telnet登陆方式配置实验

一 telnet 你的路由器地址然后输入密码,一般为CISCO,然后ENA,输入密码CISCO 这样就进到了特权模式了,CONF T 回车进入配置模式,想配置什么就在这里配置好了。顺便给你点命令吧思科命令大全Access-enable 允许路由器在动态访问列表中创建临时访问列表入口Access-group 把访问控制列表(ACL)应用到接口上Access-list 定义一个标准的IP ACL Access-template 在连接的路由器上手动替换临时访问列表入口Appn 向APPN 子系统发送命令Atmsig 执行ATM 信令命令 B 手动引导操作系统Bandwidth 设置接口的带宽Banner motd 指定日期信息标语Bfe 设置突发事件手册模式Boot system 指定路由器启动时加载的系统映像Calendar 设置硬件日历Cd 更改路径Cdp enable 允许接口运行CDP 协议Clear 复位功能Clear counters 清除接口计数器Clear interface 重新启动接口上的件逻辑Clockrate 设置串口硬件连接的时钟速率,如网络接口模块和接口处理器能接受的速率Cmt 开启/关闭FDDI 连接管理功能Config-register 修改配置寄存器设置Configure 允许进入存在的配置模式,在中心站点上维护并保存配置信息Configure memory 从NVRAM 加载配置信息Configure terminal 从终端进行手动配置Connect 打开一个终端连接Copy 复制配置或映像数据Copy flash tftp 备份系统映像文件到TFTP 服务器Copy running-config startup-config 将RAM 中的当前配置存储到NVRAM Copy running-config tftp 将RAM 中的当前配置存储到网络TFTP 服务器上Copy tftp flash 从TFTP 服务器上下载新映像到Flash Copy tftp running-config 从TFTP 服务器上下载配置文件Debug 使用调试功能Debug dialer 显示接口在拨什么号及诸如此类的信息Debug ip rip 显示RIP 路由选择更新数据 Debug ipx routing activity 显示关于路由选择协议(RIP)更新数据包的信息Debug ipx sap 显示关于SAP(业务通告协议)更新数据包信息Debug isdn q921 显示在路由器 D 通道ISDN 接口上发生的数据链路层(第 2 层)的访问过程Debug ppp 显示在实施PPP 中发生的业务和交换信息Delete 删除文件Deny 为一个已命名的IP ACL 设置条件Dialer idle-timeout 规定线路断开前的空闲时间的长度Dialer map 设置一个串行接口来呼叫一个或多个地点Dialer wait-for-carrier-time 规定花多长时间等待一个载体Dialer-group 通过对属于一个特定拨号组的接口进行配置来访问控制Dialer-list protocol 定义一个数字数据接受器(DDR)拨号表以通过协议或ACL 与协议的组合来控制控制拨号Dir 显示给定设备上的文件Disable 关闭特许模式Disconnect 断开已建立的连接Enable 打开特许模式Enable password 确定一个密码以防止对路由器非授权的访问Enable password 设置本地口令控制不同特权级别的访问Enable secret 为enable password 命令定义额外一层安全性(强制安全,密码非明文显示) Encapsulation frame-relay 启动帧中继封装Encapsulation novell-ether 规定在网络段上使用的Novell 独一无二的格式Encapsulation PPP 把PPP 设置为由串口或ISDN 接口使用的封装方法Encapsulation sap 规定在网络段上使用的以太网802.2 格式Cisco 的密码是sap End 退出配置模式Erase 删除闪存或配置缓存Erase startup-config 删除NVRAM 中的内容Exec-timeout 配置EXEC 命令解释器在检测到用户输入前所等待的时间Exit 退出所有配置模式或者关闭一个激活的终端会话和终止一个EXEC Exit 终止任何配置模式或关闭一个活动的对话和结束EXEC format 格式化设备Frame-relay local-dlci 为使用帧中继封装的串行线路启动本地管理接口(LMI)Help 获得交互式帮助系统History 查看历史记录Hostname 使用一个主机名来配置路由器,该主机名以提示符或者缺省文件名的方式使用Interface 设置接口类型并且输入接口配置模式Interface 配置接口类型和进入接口配置模式Interface serial 选择接口并且输入接口配置模式Ip access-group 控制对一个接口的访问Ip address 设定接口的网络逻辑地址Ip address 设置

cisco配置命令大全

933a LMI使用Q933A标准.LMI(Local management Interface)有3种:ANSI:T1.617;CCITTY:Q933A和CISCO特有的标准。 # fram-relay intf-typ ABC ABC为帧中继设备类型,它们分别是DTE设备,DCE交换机或NNI(网络接点接口)支持。# frame_relay interface_dlci 110 br 配置DLCI(数据链路连接标识符)。 # frame-relay map ip ABCD XXXX broadcast 建立帧中继映射。ABCD为对方ip地址,XXXX为本地DLCI号,broadcast允许广播向前转发或更新路由。 # no shutdown 激活本端口. # exit ---- 5 .帧中继子接口的配置: # conf t # int s0.1 point-to-point

对应S0的子接口1,点对点方式。 # ip addr ABCD XXXX ABCD为子口1的IP地址,XXXX为子网掩码。# frame-relay intreface-dlci 100 br 6.配置拨号备份 (1).配置备份主口 # conf t # int s0 S0为主口. # backup int asy 1 A1口为备份口. # backup delay 0 1 延时1秒. (2).配置虚拟接口 # conf t # ip addr ABCD XXXX

ABCD为虚拟接口IP地址,XXXX为子网掩码。 # encap ppp 封装ppp协议. # dialer in-band 激活随叫随拨功能. # dialer idle-timeout 7200 # dialer map ip ABCD modem-script call broadcast 6225481 br 映射对应的拨号口.ABCD为对方拨号口的ip地址,6225481为对应的电话号码。 # dialer_group 1 定义拨号组成员. (3).配置防火墙 # dialer_list 1 pro ip permit 允许ip协议通过。 (4).配置连接口令 # user name ABCD pass XXXX ABCD为对方主机名,XXXX为连接口令. (5).配置拨号字符串

Cisco交换机常用配置命令

Cisco交换机常用配置命令 CISCO交换机基本配置 switch>ena 進入特权模式 switch#erasenvram 全部清除交换机的所有配置 switch#reload 重新启动交换机(初始提示符为switch> ) ------------------------------------------------------------------------------------ CISCO交换机基本配置:Console端口连接 用户模式hostname>; 特权模式hostname(config)# ; 全局配置模式hostname(config-if)# ; 交换机口令设置: switch>enable ;进入特权模式 switch#config;进入全局配置模式 switch(config)#hostname cisco ;设置交换机的主机名 switch(config)#enable secret csico1 ;设置特权加密口令 switch(config)#enable password csico8 ;设置特权非密口令 switch(config)#line console 0 ;进入控制台口 switch(config-line)#line vty 0 4 ;进入虚拟终端 switch(config-line)#login ;虚拟终端允许登录 switch(config-line)#password csico6 ;设置虚拟终端登录口令csico6 switch#write 保存配置設置 switch#copy running-config startup-config 保存配置設置,與write一樣switch#exit;返回命令 配置终端过一会时间就会由全局配置模式自动改为用户模式,将超时设置为永不超时 switch#conf t switch(config)#line con 0 switch(config-line)#exec-timeout 0 --------------------------------------------------------------------------------- 交换机显示命令: switch#write;保存配置信息 switch#showvtp;查看vtp配置信息 switch#show run ;查看当前配置信息 switch#showvlan;查看vlan配置信息 switch#showvlan name vlan2 switch#show interface ;查看端口信息

思科路由器基本配置与常用配置命令

思科路由器基本配置与常用配置命令(simple for CCNA) 启动接口,分配IP地址: router> router> enable router# router# configure terminal router(config)# router(config)# interface Type Port router(config-if)# no shutdown router(config-if)# ip address IP-Address Subnet-Mask router(config-if)# ^z 配置RIP路由协议:30秒更新一次 router(config)# router rip router(config-if)# network Network-Number router(config-if)# ^z 配置IGRP路由协议:90秒更新一次 router(config)# router igrp AS-Number router(config-if)# network Network-Number router(config-if)# ^z配置Novell IPX路由协议:Novell RIP 60秒更新一次 router(config)# ipx routing [node address] router(config)# ipx maximum-paths Paths router(config)# interface Type Port router(config-if)# ipx network Network-Number [encapsulation encapsulation-type] [secondary] router(config-if)# ^z配置DDR: router(config)# dialer-list Group-Number protocol Protocol-Type permit [list ACL-Number] router(config)# interface bri 0 router(config-if)# dialer-group Group-Number router(config-if)# dialer map Protocol-Type Next-Hop-Address name Hostname Telphone-Number router(config-if)# ^z配置ISDN: router(config)# isdn swith-type Swith-Type router(config-if)# ^z 配置Frame Relay: router(config-if)# encapsulation frame-relay [cisco | ietf ] router(config-if)# frame-relay lmi-type [ansi | cisco | q933a ] router(config-if)# bandwidth kilobits router(config-if)# frame-relay invers-arp [ Protocol ] [dlci ] router(config-if)# ^z配置标准ACL: router(config)# access-list Access-List-Number [ permit | deny ] source [ source-mask ] router(config)# interface Type Port router(config-if)# ip access-group Access-List-Number [ in | out ] router(config-if)# ^z配置扩展ACL: router(config)# access-list Access-List-Number [ permit | deny ] [ Protocol | Protocol-Number ] source source-wildcard [ Source-Port ] destination destination-wildcard [ Destination-Port ] [ established ]

思科网络设备配置命令

思科网络设备常用配置命令 一、VLAN配置 1、添加VLAN vlan database //VLAN数据库模式 vlan name 真实设备还可以采用全局模式添加VLAN: config terminal vlan name 2、分配接口 interface range f0/m – n switchport mode access switchport access vlan 3、查看配置 show vlan brief show vlan id 二、中继配置 1、配置Trunk interface f0/m switchport mode trunk switchport trunk encapsulation { isl | dot1q | negotiate } //配封装方式,可不配2、查看接口模式 show interface f0/m switchport 三、VTP配置 vtp domain <域名> //创建VTP域 vtp mode { server | client | transparent } //配VTP模式 vtp password <密码> //配VTP口令 show vtp status //查看配置 四、以太网通道配置 interface range f0/m – n channel-protocol {pagp | lacp} //可以不配 channel-group mode on 五、STP配置 spanning-tree vlan root { primary | secondary } //配为主或次根网桥spanning-tree vlan priority <0~655535> //配优先级,越小越优先show spanning-tree //查看STP 六、三层交换机配置,实现VLAN互通 ip routing //启动路由 interface vlan //配置VLAN的IP地址 ip address no shutdown interface f0/m //配f0/m为路由接口 no switchport

思科设备命令及实验大全

一:基本操作命令 一:加密命令 1. Enable secret 123 (用户进入特权模式时,需要输密码,密文加密形式) 2. Enable password 123 (同理,不过密码是明文) 3.line console 0 login password 123 (给用户登录加密) 4. service password-encryption (将所有密码加密成密文形式) 5. line vty 0 4 (回车)login password 123 (给远程登录加密) 二:查看命令 1.show running-config (查看当前设置) 2.show history (查看过去使用过的命令) 3.show version (查看寄存器的值,版本等) 4.show interface (查看接口信息) 5.show ip interface (显示接口是否开启) 6.show interface serial 0 (显示串口的信息) 7.show vlan-switch (查看关于vlan的配置) 8.show controllers s0/0 (查看本串口是dte还是dce) 9.show vtp status (查看vtp的信息) 10.show vlan (查看是否学习到vlan) 11.show frame-relay map (查看祯中继的值) 12.show sparming-tree (查看生存树的信息) 三:一些必备的设置 1.line console 0 (回车)logging synchronous (日志同步) 2.exec-timeout 0 0 (永不超时) 3.no ip domain lookup (关闭dns查找) 4.hostname 123 (为设备改名字) 5.copy running-config startup-config (将当前配置保存到内存中,防止突然断电使用)四:路由和网关 1.ip route 0.0.0.0 0.0.0.0 (为设备设置默认路由) 2.ip default-gateway 192.168.1.1 (设置网关) 3.bandwidth 64(KB)(设置带宽) 4.ip name-server 202.102.152.3 (设定DNS,最多可指定6个DNS) 二:具体重要试验 一:vlan (交换机) 1.vlan database 2.vlan 2(2—1001的任何数字) 3.interface fastethere 1 (进入接口模式) 4.swithport mode access

相关文档
最新文档