拓扑图如下:
使用的软件是:ensp
条件:
2台pc机
交换机:
一台 S3700 一台S5700
一台服务器
Server 1
网段为:192.168.10.0网段
pc 1:192.168.10.10/24
pc 2:192.168.10.20/24
Server 1:192.168.10.100/24
配置完 是可以通的
===========================================================================
1、条件是pc2可以ping通,pc1也可以ping通的
配置如下:
SW-1:
system-view //进系统视图
[Huawei]sysname SW-1 //修改主机名为SW-1
[SW-1]int g0/0/1 //进g0/0/1接口
[SW-1-GigabitEthernet0/0/1]port-security enable //开启安全端口模式
[SW-1-GigabitEthernet0/0/1]port-security enable //接口MAC地址信息动态与此接口此端口进行关联
[SW-1-GigabitEthernet0/0/1]port-security max-mac-num 1 //接口关联pc1上的mac地址数量
======================================================================================================
2、先测试PC1 ping Server 1
PC 1 >ping 192.168.10.100
Ping 192.168.10.100: 32 data bytes, Press Ctrl_C to break
From 192.168.10.100: bytes=32 seq=1 ttl=255 time=47 ms
From 192.168.10.100: bytes=32 seq=2 ttl=255 time=31 ms
From 192.168.10.100: bytes=32 seq=3 ttl=255 time=62 ms
From 192.168.10.100: bytes=32 seq=4 ttl=255 time=32 ms
From 192.168.10.100: bytes=32 seq=5 ttl=255 time=31 ms--- 192.168.10.100 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/40/62 ms
3、测试之后 可以通的
然后在SW-1设备上查看动态关联信息
[SW-1-GigabitEthernet0/0/1]dis mac-address sticky
MAC address table of slot 0:
-------------------------------------------------------------------------------
MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID
VSI/SI MAC-Tunnel
-------------------------------------------------------------------------------
5489-98d9-6825 1 - - GE0/0/1 sticky -
-------------------------------------------------------------------------------
Total matching items on slot 0 displayed = 1
4、如果PC2 ping Server1的话 是不通的
PC 2>ping 192.168.10.100
Ping 192.168.10.100: 32 data bytes, Press Ctrl_C to break
From 192.168.10.20: Destination host unreachable
From 192.168.10.20: Destination host unreachable
From 192.168.10.20: Destination host unreachable
From 192.168.10.20: Destination host unreachable
From 192.168.10.20: Destination host unreachable--- 192.168.10.100 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss