华为交换机和华为交换机之间能ping通

时间:2024-05-20 13:29:48

华为交换机和华为交换机之间能ping通

sw-1配置:
<Huawei>sy  进系统视图 (默认在用户视图)
[Huawei]sysname SW-1  修改主机名为SW-1
[SW-1]interface Vlanif 1   进vlan 1接口
[SW-1-Vlanif1]ip address 192.168.1.100 24 配置ip地址和子网掩码

SW-2配置:
<Huawei>sy  进系统视图 (默认在用户视图)
[Huawei]sysname SW-2  修改主机名为 SW-2
[SW-2]interface Vlanif 1  进vlan 1接口
[SW-2-Vlanif1]ip address 192.168.2.100 24  配置IP地址和子网掩码

AR1配置:
<Huawei>system-view    进系统视图 (默认在用户视图)
[Huawei]sysname AR-1  修改主机名为AR-1
[AR-1]interface GigabitEthernet 0/0/0   进g0/0/0接口
[AR-1-GigabitEthernet0/0/0]ip address 192.168.1.254 24   配置IP地址和子网掩码
[AR-1-GigabitEthernet0/0/0]quit   退到上一层的系统视图
[AR-1]
[AR-1]interface GigabitEthernet 0/0/1   进g0/0/1接口
[AR-1-GigabitEthernet0/0/1]ip address 192.168.2.254 24   配置IP地址和子网掩码
----------------------------------------------------------------------------------------------
在交换机上配置能去往路由器ip地址的网关:
sw-1:
<SW-1>sy
[SW-1]ip route-static 0.0.0.0 0 192.168.1.254   在sw1上配置sw1去往AR1的网关地址
--------------------------------------------------------------------------------------------
sw-2:
<SW-2>sy    进系统视图
[SW-2]ip route-static 0.0.0.0 0 192.168.2.254   在sw2上配置sw2去往AR1的网关地址
==========================================================================================
测试交换机和交换机之间是否可以通信:
sw-2测试:
[SW-2]ping 192.168.2.100   ping自己的交换机ip地址
  PING 192.168.2.100: 56  data bytes, press CTRL_C to break
    Reply from 192.168.2.100: bytes=56 Sequence=1 ttl=255 time=30 ms
    Reply from 192.168.2.100: bytes=56 Sequence=2 ttl=255 time=1 ms
    Reply from 192.168.2.100: bytes=56 Sequence=3 ttl=255 time=10 ms
    Reply from 192.168.2.100: bytes=56 Sequence=4 ttl=255 time=1 ms
    Reply from 192.168.2.100: bytes=56 Sequence=5 ttl=255 time=10 ms
[SW-2]ping 192.168.1.100   ping对端交换机的IP地址
  PING 192.168.1.100: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.100: bytes=56 Sequence=1 ttl=254 time=110 ms
    Reply from 192.168.1.100: bytes=56 Sequence=2 ttl=254 time=50 ms
    Reply from 192.168.1.100: bytes=56 Sequence=3 ttl=254 time=50 ms
    Reply from 192.168.1.100: bytes=56 Sequence=4 ttl=254 time=30 ms
    Reply from 192.168.1.100: bytes=56 Sequence=5 ttl=254 time=40 ms

  --- 192.168.1.100 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/56/110 ms
sw-1测试:
[SW-1]ping 192.168.1.100    ping本地交换机ip地址
  PING 192.168.1.100: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.100: bytes=56 Sequence=1 ttl=255 time=60 ms
    Reply from 192.168.1.100: bytes=56 Sequence=2 ttl=255 time=1 ms
    Reply from 192.168.1.100: bytes=56 Sequence=3 ttl=255 time=1 ms
    Reply from 192.168.1.100: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 192.168.1.100: bytes=56 Sequence=5 ttl=255 time=10 ms

  --- 192.168.1.100 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 1/20/60 ms
[SW-1]ping 192.168.2.100   ping对端IP地址
  PING 192.168.2.100: 56  data bytes, press CTRL_C to break
    Reply from 192.168.2.100: bytes=56 Sequence=1 ttl=254 time=40 ms
    Reply from 192.168.2.100: bytes=56 Sequence=2 ttl=254 time=30 ms
    Reply from 192.168.2.100: bytes=56 Sequence=3 ttl=254 time=50 ms
    Reply from 192.168.2.100: bytes=56 Sequence=4 ttl=254 time=40 ms
    Reply from 192.168.2.100: bytes=56 Sequence=5 ttl=254 time=50 ms

  --- 192.168.2.100 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/42/50 ms

==============================================================================