华为eNSP配置单臂路由实验
单臂路由(router-on-a-stick)是指在路由器的一个接口上通过配置子接口(或“逻辑接口”,并不存在真正物理接口)的方式,实现原来相互隔离的不同VLAN(虚拟局域网)之间的互联互通
优点:实现不同vlan之间的通信,有助理解、学习VLAN原理和子接口概念。
缺点:容易成为网络单点故障,配置稍有复杂,现实意义不大。
操作方法
- 01
一、配置基本拓扑结构 一台主路由器、二台交换机、二台测试路由器,测试路由器充当电脑使用
- 02
二、配置接口IP地址 R1的接口:[R1-GigabitEthernet0/0/1] ip address 10.0.2.2 255.255.255.0 R2的接口:[R2-GigabitEthernet0/0/2]ip address 10.0.3.2 255.255.255.0 R3的接口:interface GigabitEthernet0/0/1 ip address 10.0.2.1 255.255.255.0 interface GigabitEthernet0/0/2 ip address 10.0.3.1 255.255.255.0
- 03
三、关闭S2的G0/0/4接口并S1、S2的G0/0/09接口加入VLAN3 [S2]interface GigabitEthernet 0/0/4 [S2-GigabitEthernet0/0/4]shutdown [S2]interface GigabitEthernet 0/0/9 [S2-GigabitEthernet0/0/9]port link-type access [S2-GigabitEthernet0/0/9]port default vlan 3 [S1]interface GigabitEthernet 0/0/9 [S1-GigabitEthernet0/0/9]port link-type access [S1-GigabitEthernet0/0/9]port default vlan 3
- 04
四、将S1的G0/0/4接口改成TRUNK模式,允许通过VLAN2、VLAN3 [S1]interface GigabitEthernet 0/0/4 [S1-GigabitEthernet0/0/4]port default vlan 1 [S1-GigabitEthernet0/0/4]port link-type trunk [S1-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3
- 05
五、在R3上的G0/0/1接口上配置子接口,同时在子接口配置ip地址,把接口配置成Dot1q,终结以太网接子接口 [R4]inter GigabitEthernet 0/0/1.2 [R4-GigabitEthernet0/0/1.2]control-vid 20 dot1q-termination [R4-GigabitEthernet0/0/1.2]dot1q termination vid 2 [R4-GigabitEthernet0/0/1.2]arp broadcast enable [R4-GigabitEthernet0/0/1.2]ip address 10.0.20.1 24 [R4-GigabitEthernet0/0/1.2]inter GigabitEthernet 0/0/1.3 [R4-GigabitEthernet0/0/1.3]control-vid 30 dot1q-termination [R4-GigabitEthernet0/0/1.3]dot1q termination vid 3 [R4-GigabitEthernet0/0/1.3]arp broadcast enable [R4-GigabitEthernet0/0/1.3]ip address 10.0.30.1 24
- 06
六、更改R1、R2的IP地址和网关 [R1]inter GigabitEthernet 0/0/1 [R1-GigabitEthernet0/0/1]ip address 10.0.20.2 24 [R1-GigabitEthernet0/0/1]quit [R1]undo ip route-static 0.0.0.0 0 10.0.2.1 [R1]ip route-static 0.0.0.0 0 10.0.20.1 [R2]interface GigabitEthernet 0/0/2 [R2-GigabitEthernet0/0/2]ip address 10.0.30.2 24 [R2-GigabitEthernet0/0/2]quit [R2]undo ip route-static 0.0.0.0 0 10.0.3.1 [R2]ip route-static 0.0.0.0 0 10.0.30.1
- 07
七、验证实验结果 [R1]ping -c 1 10.0.30.2 PING 10.0.30.2: 56 data bytes, press CTRL_C to break Reply from 10.0.30.2: bytes=56 Sequence=1 ttl=254 time=3 ms --- 10.0.30.2 ping statistics --- 1 packet(s) transmitted 1 packet(s) received 0.00% packet loss round-trip min/avg/max = 3/3/3 ms