有些公司规定禁止私接HUB,一些员工心存侥幸心理,有朝一日被发现了,心里很委屈,“网管怎么发现我的呢?”
也许我们就是那个无辜的员工,既然已经被逮到了,那我们就看看网管是怎么逮到的吧~
还有,公司既然规定禁止私接HUB,作为网管,我们是不是也应该在交换机上做一下设置,减少给别人犯错误的机会呢?
好了,开工!
今天我们还是用CISCO的PacketTracert4.11模拟器来仿真
首先,我们还是先看看网络的拓扑图吧:
开始我们的配置吧。在实验开始,交换机未进行任何配置。局域网内所有主机均由路由器DHCP分配。我们将图中的SERVER0设置为DNS服务器和HTTP服务器,地址为:192.168.1.253。
路由器配置如下:
Router_0#sh run
Building configuration...
Current configuration : 566 bytes
!
version 12.3
service password-encryption
!
hostname Router_0
!
!
!
!
interface FastEthernet0/0
 ip address 192.168.1.254 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
ip classless
!
!
ip dhcp excluded-address 192.168.1.240 192.168.1.254
!
ip dhcp pool tiger
 network 192.168.1.0 255.255.255.0
 default-router 192.168.1.254
 dns-server 192.168.1.253

!
line con 0
 password 7 0822455D0A16
 login
line vty 0 4
 password 7 0822455D0A16
 login
!
!
end
经过DHCP地址分配
PC0:192.168.1.1
PC1:192.168.1.2
PC2:192.168.1.6
PC3:192.168.1.7
PC4:192.168.1.8
PC5:192.168.1.9
局域网内的主机与网内或往外的主机通信是,交换机会记录源数据帧的MAC地址,并与所连接的交换机端口相对应,形成一张MAC地址表(两项内容:交换机端口号,MAC地址)。
如下图:

我们会看到交换机的F0/3端口出现了3个MAC地址,说明该交换机端口上连接了HUB。该谁倒霉那也没辙了~
 
现在是我们网管应该出手的时候了,预防用户犯错误我们要做好我们该做的,对了——Port security!
开始设置交换机:
Switch#sh run
Building configuration...
Current configuration : 1113 bytes
!
version 12.1
no service password-encryption
!
hostname Switch
!
!
!
interface FastEthernet0/1
 switchport mode access     要配置Port Security必须将需要配置的端口设置成ACCESS模式!
 switchport port-security

!
interface FastEthernet0/2
 switchport mode access
 switchport port-security

!
interface FastEthernet0/3
 switchport mode access
 switchport port-security

!
interface FastEthernet0/4
 switchport mode access
 switchport port-security

!
interface FastEthernet0/5
 switchport mode access
 switchport port-security
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface Vlan1
 no ip address
 shutdown
!
line con 0
!
line vty 0 4
 login
line vty 5 15
 login
!
!
end
查看一下Port Security启用情况:
Switch#sh port-security int f0/5
Port Security              : Enabled
Port Status                : Secure-up
Violation Mode             : Shutdown
Aging Time                 : 0 mins
Aging Type                 : Absolute
SecureStatic Address Aging : Disabled
Maximum MAC Addresses      : 1
Total MAC Addresses        : 0
Configured MAC Addresses   : 0
Sticky MAC Addresses       : 0
Last Source Address:Vlan   : 0000.0000.0000:0
Security Violation Count   : 0
配置完以后,当用户在此用HUB上网时,交换机由于启用了端口安全机制,即每个端口只能对应一个MAC地址,否则将端口关闭。
如图:
\
本文引用