网工路由交换相关配置
思科2950交换机相关配置
基本操作
2950(config)#int vlan1
2950(config-if)#ip address 192.168.1.100 255.255.255.0 (VLAN1里面设置IP地址)
2950(config)#ip default-gateway 192.168.1.1 (设置默认网关)
2950(config)#ip name-server 192.168.1.1 (设置域名服务器)
2950(config)#ip domain-name wqs.com (设置域名)
端口配置
2950(config)#int f0/1 (进入接口)
2950(config-if)#speed 100 (设置该接口速率为100Mb/s)
2950(config-if)#duplex ?
auto Enable AUTO duplex configuration
full Force full duplex operation
half Force half-duplex operation2950(config-if)#description to_router1
2950(config-if)#description to_router1 (设置端口描述)
2950#show interfaces fastethernet1 [status] (查看端口配置结果和状态)
MAC地址表相关命令
2950(config)#mac-address-table aging-time 100 (设置超时时间为100S)
2950(config)#mac-address-table permanent 000.0c01.bbcc f0/3 (加入永久地址)
2950(config)#mac-address-table restricted static 0000.0c02.bbcc f0/6 f0/7 (加入静态地址)
2950#show mac-address-table (查看整个MAC地址表)
2950#clear mac-address-table restricted static (清除限制性MAC址表)
VTP的配置
2950#vlan database (进入VLAN配置模式)
2950(vlan)#vtp ? (查看VTP的子命令)
domain Set the name of the VTP administrative domain.
client Set the device to client mode.
server Set the device to server mode.
transparent Set the device to transparent mode.
password Set the password for the VTP administrative domain.
2950(vlan)#vtp server (设置本交换机为SEVER模式)
2950(vlan)#vtp domain wqs (设置域名)
2950(vlan)#vtp pruning (启动修剪模式)
2950#show vtp status (查看VTP设置信息)
配置VLAN TRUNK端口
2950(config)#int f0/11 (进入F端口)
2950(config-if)#switchport mode trunk (设置该端口为TRUNK模式)
2950(config-if)#switchport trunk encapsulation {dot1q | isl | negotiate }(设置TRUNK封装)
创建VLAN
2950#vlan database (进入VLAN配置模式)
2950(vlan)#vlan 2 (创建VLAN 2)
VLAN 2 added:
Name:VLAN0002 (系统默认名)
2950(vlan)#vlan 3 name wg_bisheng (创建VLAN 3,名为网工必胜)
VLAN 3 added:
Name:wg_bisheng
2950(config)#int f0/9 (进入接口配置模式)
2950(config-if)#switchport mode access (设置该接口为ACCESS模式)
2950(config-if)#switchport access vlan 2 (把端口9分配给VLAN2)
2950(config-if)#int f0/8
2950(config-if)#switchport mode access
2950(config-if)#switchport access vlan 3
2950(config-if)#
生成树协议的配置
生成树负载均衡实现方法(感谢黑客天使提醒)
1 使用STP端口权值实现。
2 使用STP路径值实现
2950(config)#int f0/11
2950(config-if)#spanning-tree vlan 2 port-priority 10 (将VLAN2的端口权值设为10)
2950(config-if)#spanning-tree vlan 2 cost 30 (设置VLAN2生成树路径值为30)
路由器的一些设置
静态路由:
Router(config)#ip route destination-network network-mask {next-hop-ip | interface } [distance]
Router(config)#ip route 192.168.1.0 255.255.255.0 10.1.1.1
其中:192。168。1。0代表目标网络。
255.255.255.0代表目标网络的子网掩码;
10.1.1.1代表下一跳地址。
next-hop-ip:到达目的网络所经由的下一跳路由器接口的IP地址。
Interface:到达目标网络的本机接口(仅限P2P线路)
Distance:为该路由人工指定管理距离
默认路由:
Router(config)#ip route 0.0.0.0 0.0.0.0 {next-hop-ip | interface } [distance]
Router(config)#ip route 0.0.0.0 0.0.0.0 172.16.3.1
其中:0。0。0。0 0。0。0。0代表任意地址和任意掩码,即所有网络,其它参数同静态路由。
选择性通告路由:
如在RIP设置中,让S0端口只收不发RIP通告。
Router(config)#router rip
Router(config-router)#passive-interface serial 0
常见路由协议的管理距离:
TABLE 5 . 2 Default Administrative Distances
Route Source Default AD
Connected interface 0
Static route 1
EIGRP 90
IGRP 100
OSPF 110
RIP 120
External EIGRP 170
Unknown 255 (this route will never be used)
ISDN(DDR,PRI,BRI,PPP)
相关命令
r1(config)#isdn switch-type ? (设置ISDN交换类型)
basic-1tr6 1TR6 switch type for Germany
basic-5ess AT&T 5ESS switch type for the U.S.
basic-dms100 Northern DMS-100 switch type
basic-net3 NET3 switch type for UK and Europe
basic-ni National ISDN switch type
basic-ts013 TS013 switch type for Australia
ntt NTT switch type for Japan
vn3 VN3 and VN4 switch types for France
primary-5ess
basic-ni1 Basic-Ni1
r1(config)#username name password secret (指定口令)
r1(config)#interface bri0 (接口BRI设置)
r1(config-if)#encapsulation ppp (设置PPP封装)
r1(config-if)#ppp authentication {chap|chap pap |pap chap|pap}[callin](设置认证方式)
r1(config-if)# dialer map ip 200.10.1.1 name router1 broadcast 7782001 (设置协议地址与电话号码的映射)
r1(config-if)#ppp multilink (启动PPP多连接)
r1(config-if)#dialer load-threshold load(设置启动另一个B通道的阈值)
r1(config-if)#clock rate speed (设置DCE端的线速度)
r1#sh isdn ? (查看ISDN相关信息)
active ISDN active calls
history ISDN call history
memory ISDN memory information
status ISDN Line Status
timers ISDN Timer values
一般需要配置的信息有ISDN交换机类型,IP地址,封装类型,拨号串,拨号组,拨号列表等信息。
r2(config)#isdn switch-type basic-net3 (设置ISDN交换类型)
r2(config)#int bri0 (进入BRI接口配置模式)
r2(config-if)#ip address 192.168.1.2 255.255.255.0(设置接口IP地址)
r2(config-if)#encapsulation ppp (封装协议为PPP)
r2(config-if)#dialer string 88888888 (设置拨号串,R1的ISDN号码)
r2(config-if)#dialer-group 1 (设置拨号组号码为1,把BRI0接口与拨号列表1相关联)
r2(config-if)#no sh (激活接口)
%LINK-3-UPDOWN: Interface Bri0, changed state to up
r2(config-if)#exit
r2(config)#dialer-list 1 protocol ip permit (设置拨号列表1)
r1(config-if)#dialer idle-timeout 30
r1(config-if)#dilaer load-threshold 128
r1(config-if)#ppp authentication chap
r1(config)#dialer-list 1 protocol ip permit
上面整理得有点乱,详细实例见以下三个实验,建议大家用模拟器实践以强化记忆。
LAB 17 – ISDN BRI-BRI using Legacy DDR
Router IP Address Mask SPID1 Local Tel# ISDN Switch
router1 200.10.1.1 /24 32177820010100 7782001 basic-ni
router2 200.10.1.2 /24 32177820020100 7782002 basic-ni
router1(config)# isdn switch-type basic-ni
router1(config)# dialer-list 1 protocol ip permit
router1(config)# username router2 password cisco
router1(config)# interface bri0
router1(config-if)# encap ppp
router1(config-if)# ip address 200.10.1.1 255.255.255.0
router1(config-if)# isdn spid1 32177820010100
router1(config-if)# dialer-group 1
router1(config-if)# dialer map ip 200.10.1.2 name router2 broadcast 7782002
router1(config-if)# ppp authentication chap
router1(config-if)# no shut
router2(config)# isdn switch-type basic-ni
router2(config)# dialer-list 1 protocol ip permit
router2(config)# username router1 password cisco
router2(config)# interface bri0/0
router2(config-if)# encap ppp
router2(config-if)# ip address 200.10.1.2 255.255.255.0
router2(config-if)# isdn spid1 32177820020100
router2(config-if)# dialer-group 1
router2(config-if)# dialer map ip 200.10.1.1 name router1 broadcast 7782001
router2(config-if)# ppp authentication chap
router2(config-if)# no shut
LAB 18 – ISDN BRI-BRI using Dialer Profiles
Router IP Address Mask SPID1 Local Tel# ISDN Switch
router1 200.10.1.1 /24 32177820010100 7782001 basic-ni
router2 200.10.1.2 /24 32177820020100 7782002 basic-ni
router1(config)# isdn switch-type basic-ni
router1(config)# dialer-list 1 protocol ip permit
router1(config)# username router2 password cisco
router1(config)# interface bri0
router1(config-if)# encap ppp
router1(config-if)# ppp authentication chap
router1(config-if)# isdn spid1 32177820010100
router1(config-if)# dialer pool-member 1
router1(config-if)# no shut
router1(config-if)# interface dialer 1
router1(config-if)# no shut
router1(config-if)# ip address 200.10.1.1 255.255.255.0
router1(config-if)# encap ppp
router1(config-if)# dialer-group 1
router1(config-if)# dialer pool 1
router1(config-if)# dialer remote-name router2
router1(config-if)# dialer string 7782002
router1(config-if)# ppp authentication chap
router2(config)# isdn switch-type basic-ni
router2(config)# dialer-list 1 protocol ip permit
router2(config)# username router1 password cisco
router2(config)# interface bri0/0
router2(config-if)# encap ppp
router2(config-if)# ppp authentication chap
router2(config-if)# isdn spid1 32177820020100
router2(config-if)# dialer pool-member 1
router2(config-if)# no shut
router2(config-if)# interface dialer 1
router2(config-if)# no shut
router2(config-if)# ip address 200.10.1.2 255.255.255.0
router2(config-if)# encap ppp
router2(config-if)# dialer-group 1
router2(config-if)# dialer pool 1
router2(config-if)# dialer remote-name router1
router2(config-if)# dialer string 7782001
router2(config-if)# ppp authentication chap
LAB 19 – ISDN PRI using Dialer Profiles
Router IP Address Mask SPID1 Local Tel# ISDN Switch
router1 201.10.1.1 /24 32177820010100 7782001 basic-ni
router2 201.10.1.2 /24 ----- 7782002 primary-5ess
router1(config)# isdn switch-type basic-ni
router1(config)# dialer-list 1 protocol ip permit
router1(config)# username router2 password cisco
router1(config)# interface bri0/0
router1(config-if)# encap ppp
router1(config-if)# ppp authentication chap
router1(config-if)# isdn spid1 32177820010100
router1(config-if)# dialer pool-member 1
router1(config-if)# no shut
router1(config-if)# interface dialer 2
router1(config-if)# no shut
router1(config-if)# ip address 201.10.1.1 255.255.255.0
router1(config-if)# encap ppp
router1(config-if)# dialer-group 1
router1(config-if)# dialer pool 1
router1(config-if)# dialer remote-name router2
router1(config-if)# dialer string 7782002
router1(config-if)# ppp authentication chap
router2(config)# isdn switch-type primary-5esss
router2(config)# dialer-list 1 protocol ip permit
router2(config)# username router1 password cisco
router2(config)# controller t1 0/0
router2(config-controller)# framing esf
router2(config-controller)# linecode b8zs
router2(config-controller)# pri-group timeslots 1-24
router2(config-controller)# exit
router2(config)# interface serial0/0:23
router2(config-if)# encapsulation ppp
router2(config-if)# ppp authentication chap
router2(config-if)# dialer pool-member 2
router2(config-if)# no shut
router2(config-if)# interface dialer 2
router2(config-if)# ip address 201.10.1.2 255.255.255.0
router2(config-if)# encapsulation ppp
router2(config-if)# dialer-group 1
router2(config-if)# dialer pool 2
router2(config-if)# dialer remote-name router1
router2(config-if)# dialer string 7782001
router2(config-if)# ppp authentication chap
router2(config-if)# no shut
FR的配置
Router(config-if)#encapsulation frame-relay [ietf|cisco] (在相关接口上封装FR)
Router(config-if)#frame-relay lmi-type ? (设置LMI类型)
cisco
ansi
q933a
Router(config-if)#frame-relay interface-dlci 100 (设置FR DLCL