在GNS3做单臂路由实验

别等时光非礼了梦想. 提交于 2019-12-18 17:29:47

在GNS3做单臂路由实验
如图所示:
在GNS3做单臂路由实验

用路由器模拟PC,R2模拟PC1,R3模拟PC2,R4模拟PC3。配置如下:
PC1:
R2#conf t
R2(config)#int f0/0
R2(config-if)#ip add
R2(config-if)#ip address 192.168.1.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#ip default-gateway 192.168.1.254 (配置PC网关)
R2(config)#no ip routing
R2(config)#end
R2#

PC2:
R3#conf t
R3(config)#int f0/0
R3(config-if)#ip address 192.168.2.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#no ip routing
R3(config)#ip default-gateway 192.168.2.254(配置PC网关)
R3(config)#end
R3#

PC3:
R4#
R4#conf t
R4(config)#int f0/0
R4(config-if)#ip address 192.168.3.1 255.255.255.0
R4(config-if)#no sh
R4(config-if)#exit
R4(config)#
R4(config)#no ip routing
R4(config)#ip default-gateway 192.168.3.254(配置PC网关)
R4(config)#end
R4#

ESW1:
ESW1#
ESW1#vlan database
ESW1(vlan)#vlan 10 name vlan10
VLAN 10 added:
Name: vlan10
ESW1(vlan)#vlan 20 name vlan20
VLAN 20 added:
Name: vlan20
ESW1(vlan)#vlan 30 name vlan30
VLAN 30 added:
Name: vlan30
ESW1(vlan)#exit
APPLY completed.
Exiting....
ESW1#conf t
ESW1(config)#int f1/0
ESW1(config-if)#switchport mode access
ESW1(config-if)#switchport access vlan 10(把端口加入vlan 10)
ESW1(config-if)#no sh
ESW1(config-if)#exit
ESW1(config)#int f1/1
ESW1(config-if)#switchport mode access
ESW1(config-if)#switchport access vlan 20(把端口加入vlan 20)
ESW1(config-if)#no shutdown
ESW1(config-if)#exit
ESW1(config)#interface f1/2
ESW1(config-if)#switchport mode access
ESW1(config-if)#switchport access vlan 30(把端口加入vlan 30)
ESW1(config-if)#no shutdown
ESW1(config-if)#exit
ESW1(config)#int f1/3
ESW1(config-if)#no sh
ESW1(config-if)#switchport mode trunk
ESW1(config-if)#switchport trunk encapsulation dot1q(二层端口封装802.1q协议(dot1q),也就是trunk链路的中继协议)
ESW1(config-if)#end
ESW1#

R1:
R1#conf t
R1(config)#int f0/0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#int f0/0.1(进入子端口)
R1(config-subif)#ip address 192.168.1.254 255.255.255.0
R1(config-subif)#no sh
R1(config-subif)#encapsulation dot1Q 10(路由器配置了dot1q中继封装,10是vlan 10)
R1(config-subif)#exit
R1(config)#int f0/0.2(进入子端口)
R1(config-subif)#ip address 192.168.2.254 255.255.255.0
R1(config-subif)#encapsulation dot1Q 20(路由器配置了dot1q中继封装,20是vlan 20)
R1(config-subif)#no sh
R1(config-subif)#exit
R1(config)#int f0/0.3(进入子端口)
R1(config-subif)#ip address 192.168.3.254 255.255.255.0
R1(config-subif)#encapsulation dot1Q 30(路由器配置了dot1q中继封装,30是vlan 30)
R1(config-subif)#no shutdown
R1(config-subif)#exit
R1(config)#end
R1#

验证一下:
R2#ping 192.168.1.254(ping 网关)

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/12/24 ms
R2#ping 192.168.2.1(ping PC2)

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/20/28 ms
R2#ping 192.168.3.1(ping PC3)

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/20/28 ms
R2#

R3#ping 192.168.2.254(ping 网关)

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/11/24 ms
R3#ping 192.168.1.1(ping PC1)

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/24/32 ms
R3#ping 192.168.3.1(ping PC3)

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/22/32 ms
R3#

R4#ping 192.168.3.254(ping 网关)

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/12/32 ms
R4#ping 192.168.1.1 (ping PC1)

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/22/40 ms
R4#ping 192.168.2.1(ping PC2)

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/20/36 ms
R4#

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!