如何利用ensp模拟三层网络
1、打开ensp,点击新建,会出现一个空白的界面
2、首先我们把网络拓扑搭建好,怎么搭建可以查看我的另一篇介绍《 如何利用ensp进行简单的网络搭建》
3、将设备全部选中,点击启动设备
4、首先我们将两台pc的ip地址配置好,因为是模拟三层网络,两台pc的地址不能是同一个地址段的,如下
5、在两台交换机上进行如下配置,即可实现交换机至pc以及交换机之间的互通
交换机1:
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan batch 10
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int vlan 10
[Huawei-Vlanif10]ip address 192.168.0.1 24
[Huawei-Vlanif10]quit
[Huawei]int GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 10
[Huawei-GigabitEthernet0/0/2]quit
[Huawei]ping 192.168.0.2
PING 192.168.0.2: 56 data bytes, press CTRL_C to break
Reply from 192.168.0.2: bytes=56 Sequence=1 ttl=128 time=80 ms
Reply from 192.168.0.2: bytes=56 Sequence=2 ttl=128 time=40 ms
Reply from 192.168.0.2: bytes=56 Sequence=3 ttl=128 time=30 ms
Reply from 192.168.0.2: bytes=56 Sequence=4 ttl=128 time=30 ms
Reply from 192.168.0.2: bytes=56 Sequence=5 ttl=128 time=40 ms
--- 192.168.0.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/44/80 ms
[Huawei]vlan batch 30
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int vlan 30
[Huawei-Vlanif30]ip address 10.10.10.1 30
[Huawei-Vlanif30]quit
[Huawei]interface GigabitEthernet0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan 30
交换机2:
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan batch 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int vlan 20
[Huawei-Vlanif20]ip address 172.16.0.1 24
[Huawei-Vlanif20]quit
[Huawei]int GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 20
[Huawei-GigabitEthernet0/0/2]quit
[Huawei]ping 172.16.0.2
PING 172.16.0.2: 56 data bytes, press CTRL_C to break
Reply from 172.16.0.2: bytes=56 Sequence=1 ttl=128 time=80 ms
Reply from 172.16.0.2: bytes=56 Sequence=2 ttl=128 time=50 ms
Reply from 172.16.0.2: bytes=56 Sequence=3 ttl=128 time=30 ms
Reply from 172.16.0.2: bytes=56 Sequence=4 ttl=128 time=30 ms
Reply from 172.16.0.2: bytes=56 Sequence=5 ttl=128 time=30 ms
--- 172.16.0.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/44/80 ms
[Huawei]vlan batch 30
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int vlan 30
[Huawei-Vlanif30]ip address 10.10.10.2 30
[Huawei-Vlanif30]quit
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan 30
[Huawei-GigabitEthernet0/0/1] quit
[Huawei]ping 10.10.10.1
PING 10.10.10.1: 56 data bytes, press CTRL_C to break
Reply from 10.10.10.1: bytes=56 Sequence=1 ttl=255 time=50 ms
Reply from 10.10.10.1: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 10.10.10.1: bytes=56 Sequence=3 ttl=255 time=1 ms
Reply from 10.10.10.1: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 10.10.10.1: bytes=56 Sequence=5 ttl=255 time=40 ms
--- 10.10.10.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/30/50 ms
6、因为是三层网络,还需在交换机上写静态路由,两台交换机均需添加,如下
交换机1:
[Huawei]ip route-static 172.16.0.0 24 10.10.10.2
交换机2:
[Huawei]ip route-static 192.168.0.0 24 10.10.10.1
7、在两台pc上分别进行测试,可以看到两台pc已经可以互相ping通了。