第十五讲:神州交换机端口安全配置

知识点:

  1. 开启端口安全模式;
  2. 设置端口最大安全数;
  3. 端口绑定MAC地址;
  4. 违规处理;
  5. 锁定安全端口;
  6. MAC地址与IP的绑定;
  7. 端口镜像。

实验拓扑如下图所示

PC机

IP地址

掩码

MAC地址

端口

PC1

192.168.1.10

255.255.255.0

00-0b-4c-9e-2a-1c

E1/0/1

PC2

192.168.1.11

255.255.255.0

00-0b-2e-5d-62-4e

E1/0/2

PC3

192.168.1.12

255.255.255.0

00-0b-cd-4a-97-08

E1/0/3

一、静态绑定单个端口与设备MAC地址:

1.绑定MAC地址

S1(config)#interface ethernet1/0/1

S1(config-if-ethernet1/0/1)#switchport port-security        //开启端口安全

S1(config-if-ethernet1/0/1)#switchport port-security maximum 10  //设置端口安全最大数为10

S1(config-if-ethernet1/0/1)#switchport port-security mac-address 00-0b-4c-9e-2a-1c

     // E1/0/1端口绑定PC1的MAC地址

S1(config-if-ethernet1/1)#switchport port-security violation shutdown   //违规关闭

S1(config-if-ethernet1/1)#switchport port-security lock     //锁定安全端口

 二.验证配置

1.用如下命令验证配置:

Switch#show port-security                 //查看端口安全

Switch#show port-security mac-address      //查看绑定的MAC地址

2.验证PC1只能通过其绑定的E1/1端口与网络进行通信

PC1分别Ping PC2和PC3可以Ping通

    C:\Documents and Settings\Administrator>ping 192.168.1.12

    Pinging 192.168.1.12 with 32 bytes of data:

   Reply from 192.168.1.12: bytes=32 time<1ms TTL=64

    Reply from 192.168.1.12: bytes=32 time<1ms TTL=64

    Reply from 192.168.1.12: bytes=32 time<1ms TTL=64

    Reply from 192.168.1.12: bytes=32 time<1ms TTL=64

    Ping statistics for 192.168.1.12:

        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

    Approximate round trip times in milli-seconds:

        Minimum = 0ms, Maximum = 0ms, Average = 0ms

把PC1更换到E1/4端口,再次Ping PC2和PC3,已无法Ping通:

    C:\Documents and Settings\Administrator>ping 192.168.1.12

    Pinging 192.168.1.12 with 32 bytes of data:

    Request timed out.

    Request timed out.

    Request timed out.

    Request timed out.

    Ping statistics for 192.168.1.12:

        Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

3.验证其他设备在特定端口的绑定情况

    把PC2更换到E0/0/1口,分别Ping E1/3口的PC3和E14口的PC1:

    C:\Documents and Settings\Administrator>ping 192.168.1.12

    Pinging 192.168.1.12 with 32 bytes of data:

    Reply from 192.168.1.12: bytes=32 time<1ms TTL=64

    Reply from 192.168.1.12: bytes=32 time<1ms TTL=64

    Reply from 192.168.1.12: bytes=32 time<1ms TTL=64

    Reply from 192.168.1.12: bytes=32 time<1ms TTL=64

        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

    Approximate round trip times in milli-seconds:

        Minimum = 0ms, Maximum = 0ms, Average = 0ms

  •  

C:\Documents and Settings\Administrator>ping 192.168.1.10

    Pinging 192.168.1.10 with 32 bytes of data:

    Request timed out.

    Request timed out.

    Request timed out.

    Request timed out.

    Ping statistics for 192.168.1.10:

     Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

可见:端口E1/1绑定了PC1,非PC1的MAC地址依然可以与其他MAC地址通信,只是PC1只能通过E1/1端口进行通信。

三、绑定MAC-IP地址:

     MAC-IP地址绑定可以将端口绑定为指定的设备和IP地址,更换设备或IP地址均无法通过此端口访问

    S1(config)#am enable

    S1(config)#interface ethernet1/0/2

    S1(config-if-ethernet1/1)#am port

    S1(config-if-ethernet1/1)#am mac-ip-pool 00-0b-2e-5d-62-4e 192.168.1.11

                             // E1/0/2端口绑定PC2的MAC与PC2的IP地址

将端口E1/0/2绑定为PC2,此时PC2可通过该端口访问PC1或PC3。若更改PC2的IP地址,或将其他设备(如PC3)连接E1/0/2端口则无法进行访问。

四、绑定IP地址区间:

    将端口绑定一个IP地址区间,则此区间的IP地址设备可通过该端口进行访问,不在此区间的IP地址无法通过该端口访问网络

    S1(config)#am enable

    S1(config)#interface ethernet 1/0/3

    S1(config-if-ethernet1/2)#am port

    S1(config-if-ethernet1/2)#am ip-pool   192.168.1.12 2    

           //将端口E1/0/3绑定192.168.1.12和192.168.1.13两个IP地址

    除192.168.1.12和192.168.1.13外的其他IP地址均无法通过此端口通信。

五、端口镜像

第1步:配置源端口

S1(config)#monitor session 1 source interface fastEthernet 1/0/2 both

    //监听E1/0/2端口的进出流量

             both         管理发送和接收的流量

             rx           只管理接收的流量

             tx           只管理发送的流量

第2步:配置端口镜像

S1(config)#monitor session 1 destination interface fastEthernet 1/0/1

     //把监听端口的流量镜像到端口E1/0/1

第3步:验证配置

S1(config)#show monitor session 1

sess-num: 1

span-type: LOCAL_SPAN

src-intf:

FastEthernet 1/0/2            frame-type Both

dest-intf:

FastEthernet 1/0/1

在PC1上启动抓包软件,使PC2 ping PC3,看是否可以捕捉到数据包。

端口镜像的限制

(1) 目前只支持一个镜像目的端口,镜像源端口则没有使用上的限制,可以是1个也可以是多个,多个源端口可以在相同的VLAN,也可以在不同VLAN。但如果镜像目的端口要能镜像到多个镜像源端口的流量,镜像目的端口必须要同时属于这些镜像源端口的所在的VLAN。

(2) 镜像目的端口不能是端口聚合组成员;

(3) 镜像目的端口的吞吐量如果小于镜像源端口吞吐量的总和,则目的端口无法完全复制源端口的流量;请减少源端口的个数或复制单向的流量,或者选择吞吐量更大的端口作为目的端口。

 

  • 4
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北方的流星

你的鼓励是我创作最大动力。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值