Chinaunix首页 | 论坛 | 博客
  • 博客访问: 586880
  • 博文数量: 129
  • 博客积分: 6240
  • 博客等级: 准将
  • 技术积分: 1765
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-18 15:42
文章分类

全部博文(129)

文章存档

2015年(1)

2012年(3)

2011年(6)

2010年(14)

2009年(105)

我的朋友

分类: 系统运维

2009-04-02 16:59:28

思科交换机

1900系列 2900系列 2950系列

交换机分二层交换,三层交换,四层交换  CCNA里讲的是第二层

三层交换要4912以下。四层5000

交换机分模块话和固定化 。双绞线 ,而模块化带光钎接口
1900接的都是ethernet 0 普通的以太网口10M
2900接的都是fastethernet 快速以太网口 100M
2948-4000是第三层 4000以上的可以提供语音是四层交换
1900里有两个100M的以太网口。是做级连和叠连用的
交换机可以自动学习MAC地址 但只能记1024个MAC地址
2900能接光钎,ATM模块 单模光钎,多模光钎,
2950多了两个GIgabit(千兆)
刚进入交换机时有三个选项
[M]menus(以菜单的形式配置交换机)
[K]commandline(用命令配置)我们一般的时候都是选K
[I]ip configuration(以IP形式配置)

破解交换机密码:
在掉电的时候。按下MODE按钮,开电源。看第一个端口不闪动了放开
MODE按钮,同时看见操作系统是(switch=)这样的了。就可以破解密码了
然后在:

switch:flash_init(加载文件)
switch:load_helper(加载帮助文件)
switch:rename flash:/config.text flash:/config.aaa
switch:boot

把密码改回来
>enbale
#hostname switch
switch#rename flash:config.aaa flash:config.text
switch#config terminal
switch(config)#enable password level 1 123456
switch(config)#enable secret 5 123456789

----------------------------------------------------------------------

switch#show flash
switch#show mac-address-table
switch#config terminal
switch(config)#ip address 192.168.0.23 255.255.255.0(给交换机设置IP)
switch(config)#interface fastethernet 0/1
switch(config-if)#speed 100(说明是带宽)
switch(config-if)#speed auto(自适当10M 100M)
switch(config-if)#duplex half
switch(config-if)#duplex full
switch(config-if)#no shutdown

案例:有两个交换机分别是switchA  switchB 分别有三个部门 caiwu shichang
    xiaoshou

在A上的接口有 1 2 3 5 在B上接口有 1 3 5 7


-----------------------------------------------------------------------
SERVER switchA

switch#vlan database
switch#config terminal
switch(config)#vtp mode server
switch(config)#vtp domain gongsi
switch(config)#vtp password 123456
switch(config)#vlan 12
switch(config-vlan)#name caiwu
switch(config-vlan)#vlan 13
switch(config-vlan)#name shichang
switch(config-vlan)#vlan 14
switch(config-vlan)#name xiaoshou
switch(config-vlan)#interface f0/2
switch(config-if)#no shutdown
switch(config-if)#switchport mode trunk
switch(config-if)#switchport trunk encap dot1q
switch(config-if)#switchport trunk allowed vlan 12,13,14
switch(config-if)#exit
switch(config)#interface f0/1
switch(config-if)#switchport access vlan 12
switch(config-if)#no shutdown
switch(config-if)#switchport mode access
switch(config-if)#exit
switch(config)#interface f0/3
switch(config-if)#switchport access vlan 13
switch(config-if)#no shutdown
switch(config-if)#switchport mode access
switch(config-if)#exit
switch(config)#interface f0/5
switch(config-if)#no shutdown
switch(config-if)#switchport access vlan 14
switch(config-if)#switchport mode access
switch(config-if)#exit
switch(config)#interface vlan 12
switch(config-vlan)#ip address 192.168.0.89 255.255.255.0
switch(config-vlan)#no shutdown
switch(config-vlan)#exit
switch(config)#interface vlan 13
switch(config-vlan)#ip address 192.168.1.89 255.255.255.0
switch(config-vlan)#no shutdown
switch(config-vlan)#exit
switch(config)#interface vlan 14
switch(config-vlan)#ip address 192.168.2.89 255.255.255.0
switch(config-vlan)#no shutdown
switch(config-vlan)#exit

client switchB

switch#vlan database
switch#config terminal
switch(config)#vtp mode client
switch(config)#vtp domain gongsi
switch(config)#vtp password 123456
switch(config)#interface f0/7
switch(config-if)#no shutdown
switch(config-if)#switchport mode trunk
switch(config-if)#switchport trunk encap dot1q
switch(config-if)#switchport trunk allowed vlan 12,13,14
switch(config-if)#exit
switch(config)#interface f0/1
switch(config-if)#switchport access vlan 12
switch(config-if)#no shutdown
switch(config-if)#switchport mode access
switch(config-if)#exit
switch(config)#interface f0/5
switch(config-if)#switchport access vlan 13
switch(config-if)#no shutdown
switch(config-if)#switchport mode access
switch(config-if)#exit
switch(config)#interface f0/3
switch(config-if)#no shutdown
switch(config-if)#switchport access vlan 14
switch(config-if)#switchport mode access
switch(config-if)#exit

接着我们在路由器上让VLAN 12 13 14 可以互联 也叫做(单臂路由)

route#config terminal
routeA(config)#interface ethernet 0
routeA(config-if)#no shutdown
routeA(config-if)#no ip address
routeA(config-if)#exit
routeA(config)#interface ethernet 0.1
routeA(config-subnet)#ip address 192.168.0.90 255.255.255.0
routeA(config-subnet)#encapsulation dot1q 12
routeA(config-subnet)#no shutdown
routeA(config-subnet)#exit
routeA(config)#interface ethernet 0.2
routeA(config-subnet)#ip address 192.168.1.90 255.255.255.0
routeA(config-subnet)#encapsulation dot1q 13
routeA(config-subnet)#no shutdown
routeA(config-subnet)#exit
routeA(config)#interface ethernet 0.3
routeA(config-subnet)#ip address 192.168.2.90 255.255.255.0
routeA(config-subnet)#encapsulation dot1q 14
routeA(config-subnet)#no shutdown
routeA(config-subnet)#exit
routeA(config)#ip route 192.168.1.0 255.255.255.0 192.168.0.89
routeA(config)#ip route 192.168.2.0 255.255.255.0 192.168.0.89
routeA(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.89
routeA(config)#ip route 192.168.0.0 255.255.255.0 192.168.1.89
routeA(config)#ip route 192.168.0.0 255.255.255.0 192.168.2.89
routeA(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.89


1900建vlan 在全局
vlan 9 name yirehe
在接口模式下 interface ethernet0/8
vlan-membreship static 9
启动中继在接口 trunk on
1900用的是0/27是级联口 interface fastethernet 0/27 因为是百兆
在特权下show vlan

做MAC地址表
interface f0/1
switchport port-security(启动安全性)
switchport port-security mac-address 加上PC机上的MAC地址(只让这个MAC地址上网)
如果用集线器街道f0/1可以接多台计算机。制止方法
switchport port-security maximum 1 (限制多少台PC机)
switchport port-security violation shutdown(违背这个规则,把这个接口SHUTDOWN)

还有一种MAC地址绑定

在全局mac-address-table permanent 00-F0-4C-83-65-73(MAC地址) fastethernet 0/3

只让那个接口和我通讯

mac-address-table restricted static 00-F0-4C-83-65-73 fastethernet 0/3 fastethernet 0/1

(只让fastethernet 0/1接口的PC机和我通讯)

在特权下

copy nvram tftp://IP 备份

进入接口

interface fastethernet 0/7

port secure max-mac-count1 (只能接一个电脑)

在全局

address-violation disable (如果接的不是一个电脑禁用掉它)

进入特权模式

show mac-address-table security


子网划分和VLSM案例

类地址
我们把192.168.10.0分为2个子网
2*2-2=2说明我们借走了两个位现在网络位为26
我们看看每一个子网能容下多少个主机2*6-2=62每一个子网能容下62台计算机
那么有效的子网是256-192=64
所以第一个子网是192.168.10.0.64/26
广播地址为192.168.10.127/26
子网不能全为1和0
所以有效的地址为192.168.10.65/26-192.168.10.127/26
第二个子网是192.168.0.128/26
广播地址为192.168.10.191/26
所以有效的地址为192.168.10.129/26-192.168.10.190/26
B类地址,
我们把172.16.0.0/16分为2个子网
2*2-2=2
2*(16-2)-2=16382
那么有效的子网是256-192=64
所以第一个子网是172.16.64.0/18
广播地址为172.16.127.255/18
所以有效的地址为172.16.64.1/18-172.16.127.254
第二个子网是172.1.128.0/18
广播地址为172.16.191.255/18
所以有效的地址为172.16.128.1/18-172.16.191.254

总公司的地址范围空间为172.16.0.0/16
把172.168.12.0/22分配给 ROUTER A,B,C,D 三个路由器
并且D需要2个VLAN然后每个VLAN容纳200台计算机。
A,B和C连接3个以太网,分别用1个24口的交换机相连
也就是说A,B,C容纳24个计算机
我们先从D来划分,主机位为8位,算一下2*8-2=254
为7位 算一下为2*7-2=126。因为D要求的是200台计算机,
所以我们这里要留8位主机位才能满足200台的需要。
那么我们就借走了2位主机位变成网络位
那么分出来了
172.16.12.0/24;从172.16.12.0到172.16.12.255
172.16.13.0/24;从172.16.13.0到172.16.13.255         
172.16.14.0/24;从172.16.14.0到172.16.14.255
172.16.15.0/24;从172.16.15.0到172.16.15.255
我们把172.16.12.0/24;172.16.13.0/24;分给D ROUTER 的
两个VLAN
我们把172.16.14.0/24;172.16.15.0/24;分给A B C 三个ROUTER
我们现在划分172.16.14.0/24
2*5-2=32 ;2*4-2=16
看起来我们该选择主机位为5 ,那么网络位要在主机位上又
借走三个位;
出来了172.16.14.0/27 ;176.16.14.32/27 ;           
      172.16.14.64/27;172.16.14.96/27;
      172.16.14.128/27;   172.16.14.160/27
      172.16.14.192/27;  172.16.14.224/27
我们把172.16.14.0/27 ;176.16.14.32/27 ;           
172.16.14.64/27分别给A,B,C这三个,
我们还要给ABC和D的点到点的串型接口分为IP
我们把172.16.14.224/27再次子网划分一下,
看一看需要6个IP也就是说2*3-2=7满足IP要求。
我们分出来了172.16.14.224/30;172.16.14.228/30
            172.16.14.232/30;172.16.14.236/30
            172.16.14.240/30;172.16.14.244/30
            172.16.14.248/30;172.16.14.252/30
那么我们172.16.14.224/30;到 172.16.14.228/30 之间只有172.16.14.225/30;172.16.14.226/30能用分别分给A和D相连的接口
那么B和D接口IP为172.16.14.229/30;172.16.14.230/30
那么C和D接口IP为172.16.14.133/30; 172.16.14.134/30


阅读(1180) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~