路由器、三层交换机、交换机实现PC机通信:
第一步,在交换机中先配置vlan数值(vlan batch)10 20 30,再设置接口。
使用命令:
①vlan batch 10 20 30
②port link-type access port default vlan 10
port link-type access port default vlan 20
port link-type access port default vlan 30
③port link-type trunk port trunk allow-pass 10 20 30 100
最后查下vlan表,display port vlan active
第二步,在三层交换机中,先配置vlan数值(vlan batch)10 20 30 100,再设置接口(包括虚拟)。
使用命令:
①vlan batch 10 20 30 100
②port link-type trunk port trunk allow-pass 10 20 30 100
③port link-type access port default vlan 100
④int vlanif 10 ip address 192.168.1.254 24
int vlanif 20 ip address 192.168.2.254 24
int vlanif 30 ip address 192.168.3.254 24
int vlanif 100 ip address 192.168.4.1 24
这里要注意,虚拟接口必须是设置vlanif,还有就是三层交换机把他看成路由器;
第三步,在路由器中配置接口,
使用命令:
①ip address 192.168.4.254 24
ip address 192.168.5.254 24
第四步,下一跳(记住他只是单向的),
使用命令:
ip route-static 0.0.0.0 0.0.0.0 192.168.4.1(这里因为路由器右边只连接了终端设备所以可以默认)
ip route-static 192.168.5.0 24 192.168.4.254
最后ping一下 就都通了!
PS:这里有个提示,单臂路由的命令(不常用)
这里需要虚拟接口,虚拟接口int g0/0/0.10
①ip address 192.168.10.1 24(配ip)
②dotlp termination vis 10(配vlan)
③arp broadcast enable(开启arp广播)