网络工程师交换机和路由器基本配置总结

频道:行业资讯 日期: 浏览:698

交换机的基本配置:

1、配置enable口令和主机名

网络工程师交换机和路由器基本配置总结

Switch> 用户执行模式提示符

Switch>enable 进入特权模式

Switch# 特权模式提示符

Switch#config terminal 进入配置模式

Switch(config)# 配置模式提示符

Switch(config)#enable password cisio 设置enable password为cisio

Switch(config)#enable secret cisco1 设置enable secret 为cisio

Switch(config)#hostname C2950 设置主机名为C2950

C2950(config)#end 退回到特权模式

C2950#

2、配置交换机IP地址、默认网关,域名、域名服务器

C2950(config)#ip address 192.168.1.1 255.255.255.0 设置交换机IP地址

C2950(config)#ip default-gateway 192.168.1.254 设置默认网关

C2950(config)#ip domain-name http://cisio.com 设置域名

C2950(config)#ip domain-server 200.0.0.1 设置域名服务器

C2950(config)#end

3、设置交换机的端口属性

C2950(config)#interface fastethernet0/1进入接口0/1的配置模式

C2950(config-if)# speed ? 查看speed命令的子命令

……(省略)

C2950(config-if)#speed 100 设置该端口速率为100Mbps

C2950(config-if)#deplex ? 查看deplex命令的子命令

……(省略)

C2950(config-if)#deplex full 设置端口为全双工

C2950(config-if)#description TO_PC1 设置端口描述为TO_PC1

C2950(config-if)#end (或^Z) 返回特权模式

C2950#show interface fastethernet0/1 查看端口0/1的配置结果

……(结果省略)

C2950#show interface fastethernet0/1 status 查看端口0/1的状态

……(结果省略)

4、配置和查看MAC地址表

C2950(config)#mac-address-table ? 查看mac-address-table的子命令

……(省略)

C2950(config)#mac-address-table aging-time 100           设置超时时间为100s

C2950(config)#mac-address-table permanent 0000.0c01.bbcc f0/3     加入永久地址

C2950(config)#mac-address-table restricted static 0000.0c02.bbcc f0/6 f0/7 加入静态地址

C2950(config)#end

C2950#show mac-address-table     查看整个MAC地址表

……

C2950#clear mac-address-table restricted static 清除限制性地址

5、配置VTP协议(VLAN Trunking Protocal)

配置2950A交换机为服务器模式

Switch>enable     进入特权模式

Switch#config terminal       进入配置子模式

Switch(config)#hostname 2950A 修改主机名为2950A

2950A(config)#end

2950A#

2950A#vlan dataBase     进入VLAN配置子模式

2950A(vlan)#vtp ?     查看和VTP配合使用的命令

2950A(vlan)#vtp server     配置本交换机为Server模式

Setting device to VTP SERVER mode

2950A(vlan)#vtp domain vtpserver 设置域名

Changing VTP domain name fron NULL to vtpserver

2950A(vlan)#vtp pruning 启动修剪模式

Pruning switched ON

2950A(vlan)#exit 退出VLAN配置模式

APPLY completed

Exiting……

2950A#show vtp status

……(其他信息省略)

VTP Operating Mode :Server

VTP Domain Name :vtpserver

VTP Pruning Mode :Enable

……

2950A#

配置2950B交换机为客户端模式,则他会从服务器(2950A)那里学习到VTP的其他信息及VLAN信息

Switch#config terminal 进入配置子模式

Switch(config)#hostname 2950B

2950B(config)#end

2950B#vlan dataBase

2950B(vlan)#vtp client

Setting device to VTP CLIENT mode

2950B(vlan)#exit

5、配置VLAN Trunk端口

Switch#config

Switch(config)#interface f0/24 进入端口24配置模式

Switch(config-if)#switchport mode trunk 设置当前端口为Trunk模式

Switch(config-if)#switchport trunk allowed vlan all 设置允许从该端口交换数据的VLAN

Switch(config-if)#exit

Switch(config)#exit

Switch#

6、创建VLAN

2950A#vlan dataBase

2950A(vlan)#vlan 2 创建一个VLAN2

VLAN2 added:

Name:VLAN0002 系统自动命名

2950A(vlan)#vlan 3 name vlan3 创建一个VLAN3,并命名为vlan3

VLAN added:

Name:vlan3

7、将端口加入到某个VLAN中

Switch#config termianl

Switch(config)#interface f0/9      进入端口9的配置模式

Switch(config-if)#switchport mode access 设置端口为静态VLAN访问模式

Switch(config-if)#switchport access vlan2 把端口9分配给相信的VLAN2

Switch(config-if)#exit

Switch(config)#interface f0/10

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan3

Switch(config-if)#exit

Switch(config)#exit

Switch#show vlan 查看VLAN配置信息

...

Switch#

8、配置STP权值

Switch1#config terminal

Switch1(config)#interface f0/23 进入端口23配置模式,Trunk1

Switch1(config-if)#spanning-tree vlan 1 port-priority 10 将VLAN1的端口权值设置为10

Switch1(config-if)#spanning-tree vlan 2 port-priority 10 将VLAN2的端口权值设置为10

Switch1(config-if)#exit

Switch1(config)#interface f0/24 进入端口24配置模式,Trunk2

SWitch1(config-if)#spanning-tree vlan 3 port-priority 10 将VLAN3的端口权值设置为10

SWitch1(config-if)#spanning-tree vlan 4 port-priority 10 将VLAN4的端口权值设置为10

SWitch1(config-if)#spanning-tree vlan 5 port-priority 10 将VLAN5的端口权值设置为10

Switch1(config-if)#end

Switch1#copy running-config start-config 保存配置文件

9、配置STP路径值的负载均衡

Switch1#config terminal

Switch1(config)#interface f0/23 进入端口23配置模式,Trunk1

Switch1(config-if)#spanning-tree vlan 3 cost 30 设置VLAN3生成树路径值为30

Switch1(config-if)#spanning-tree vlan 4 cost 30 设置VLAN4生成树路径值为30

Switch1(config-if)#spanning-tree vlan 5 cost 30 设置VLAN5生成树路径值为30

Switch1(config-if)#exit

Switch1(config)#interface f0/24 进入端口24配置模式,Trunk2

Switch1(config-if)#spanning-tree vlan 1 cost 30 设置VLAN1生成树路径值为30

Switch1(config-if)#spanning-tree vlan 2 cost 30 设置VLAN2生成树路径值为30

Switch1(config-if)#end

Switch1#

路由器基本配置

1、配置以太网

Router>enable 进入特权执行模式

Router#config t 进入全局配置模式

Router(config)#interface fastethernet0/1 进入接口F0/1配置模式

Router(config-if)#ip address 192.168.1.11 255.255.255.0 设置接口IP地址

Router(config-if)#no shutdown 激活接口

...

Router(config-if)#end 退回到特权模式

Router#show running-config 查看配置结果

2、配置终端服务器

服务器配置清单略。。。

设置两个路由器的主机名

Term_Server#

Term_Server#router1 访问主机表中的router1路由器

Trying router1(10.1.1.1,2001)...Open

Router>enable

Router#config t

...

Router(config)#hostname router1 设置路由器1的主机名

Router1(config)#end

Router1#

Term_Server#

Term_Server#router2

Trying router2(10.1.1.1,2002)...Open

Router>enable

Router#config t

...

Router(config)#hostname router2

Router2(config)#end

Router2#

Term_Server#show sessions 查看终端服务器的会话

...

Term_Server#disconnect2 断开会话2

Term_Server#show line 1 查看线路1的状态

Term_Server#clear line 2 清除线路2

3、配置静态路由

R2#show ip router 查看路由情况

10.0.0.0/24 issubnetted,1 subnets

C 10.1.1.0 is directly connected,Ethernet0直接相连的网段10.1.1.0、24在路由表内 C表示连接

在R2路由表中加入静态路由

R2#config t

R2(config)#ip router 192.168.1.0 255.255.255.0 10.1.1.1 加入静态路由 网段地址192.168.1.0 255.255.255.0下一跳10.1.1.1 即R1的E0接口地址

R2(config)#end

R2#show ip router 查看路由情况

192.168.0.0is subnwtted,1 subnets

S 192.168.1.0 [1/0] via 10.1.1.1 S表示Static

10.0.0.0/24 issubnetted,1 subnets

C 10.1.1.0 is directly connected,Ethernet0直接相连的网段10.1.1.0、24在路由表内 C表示连接

4、配置RIP协议(路由选择信息协议)

命令router rip 指定rip协议

show ip route查看路由表信息

show ip route rip查看RIP协议路由信息

network network指定网络

version {1|2}指定rip版本

R1#config t

R1(config)#no logging console

R1(config)#interface fastethernet0/1

R1(config-if)#ip address 192.168.1.1 255.255.255.0

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)#interface serial 0

R1(config-if)#ip address 192.168.65.1 255.255.255.0

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)#interface serial 1

R1(config-if)#ip address 192.168.67.1 255.255.255.0

R1(config-if)#no shutdown

R1#show ip route

192.168.0.0/24 is subnetted,3 sub nets

C 192.168.1.0 is directly connected,Ethernet0

C 192.168.65.0 is directly connected,Serial0

C 192.168.67.0 is directly connected,Serial1

R1(config)#ip routing

R1(config)#router rip 进入RIP协议配置子模式

R1(config)#network 192.168.1.0 声明网络192.168.1.0/24

R1(config)#network 192.168.65.0

R1(config)#network 192.168.67.0

R1(config)#version 2 设置RIP协议版本2

R1(config)#exit

R3#show ip route

...//C-Connected,S-Static,I-IGRP,R-RIP,B-BGP,O-OSPF,E-EGP,D-EIGRP...//

192.168.0.0/24 is subnetted,6 sub nets

C 192.168.1.0 is directly connected,Ethernet0 --此三行感觉有误是R1

C 192.168.65.0 is directly connected,Serial0

C 192.168.67.0 is directly connected,Serial1

R 192.168.65.0 [120/1] via 192.168.67.1 ,00:00:15,Serial

[120/1] via 192.168.69.1,00:00:24,Serial0

R 192.168.1.0 [120/1] via 192.168.67.1 ,00:00:15, Serial

R 192.168.3.0 [120/1] via 192.168.69.1 ,00:00:24,Serial0 Serial0表示该路由使用的接口

5、配置IGRP协议(内部网关路由协议)

命令show ip route

show ip route igrp

network network

6、配置OSPF协议(最短开放路径协议)

命令router ospf process-id 指定使用ospf协议

如:router ospf 100

network address wildcard-mask area area-id 指定与该路由器相连的网络

如:network 192.200.10.4 0.0.0.3 area 0

show ip route 查看路由表信息

show ip route ospf 查看OSPF协议路由信息

7、配置EIGRP协议

命令router eigrp process-id

network address wildcard-mask 指定与该路由器相连的网络

如:network 192.200.10.0 0.0.0.3

8、配置ISDN

isdn switch-type switch-type    设置ISDN交换类型

如:isdn switch-type basic-net3

interface bri 0 接口BRI设置

encapsulation ppp 设置ppp封装

dialer map protocol next-hop-address [name hostname][broadcast][dial-string] 设置协议地址与电话号码的映射

ppp multilink 启动PPP多连接

dialer load-threshold load 设置启动另一个B通道的阈值

show isdn {active|history|memory|services|satus[dsl|interface-type number]|timers}查看isdn信息

ppp authentication {chap|...} 设置认证方法

dialer拨号的意思

9、配置帧中继

encapsulation frame-relay[ietf] 设置frame-relay封装

frame-relay lmi-type {ansi | cisco | q933a} 设置frame-relay LMI类型

interface interface-type interface-number subinterface-number [multipoint | point-to-point]设置子接口

frame-relay map protocol protocol-address dlci[broadcast] 映射协议地址与DLCI

frame-relay interface-dlci dlci[broadcast] 设置FR DLCI编号

10、配置IPSec

IKE和isakmp 是同义词

isakmp enable 启用或关闭IKE

isakmp policy 创建IKE策略

isakmp key 配置预共享密钥

show isakmp [policy] 验证IKE的配置

access list acl-name {permit|deny} protocol src_addr src_mask [operator port[port]] dest_addr dest_mask [operator port[port]] access-list命令配置加密用访问列表

show和debug用来测试和验证

11、ACL配置

Router(config)#access-list ACL_# permit|deny conditions

如:access-list 10 permit host 172.16.1.0 0.0.0.255

access-list 10 deny host 172.16.1.1

0 留言

评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。
验证码