好久没有搞交换机路由器,今天心血来潮下了一个cisco的模拟器来做一下单臂路由和vtp,手生做了1个小时,看来还是要经常联系到起,毕竟是经常用到的。
单臂路由的实验环境如下图:
什么都不说先来配置交换机划分vlan:
Switch>enableSwitch#vlan databaseSwitch(vlan)#vlan 10 Switch(vlan)#vlan 20Switch(vlan)#exitSwitch#configure terminal Switch(config)#interface f0/3Switch(config-if)#switchport mode trunkSwitch(config-if)#spanning-tree portfastSwitch(config-if)#exitSwitch(config)#interface f0/1Switch(config-if)#switchport access vlan 10Switch(config-if)#exitSwitch(config)#interface f0/2Switch(config-if)#switchport access vlan 20Switch(config-if)#spanning-tree portfastSwitch(config-if)#exit
然后是配置路由器:
Router>enableRouter#configure terminalRouter(config)#interface f0/0.1Router(config-subif)#encapsulation dot1Q 10Router(config-subif)#ip address 192.168.1.1 255.255.255.0Router(config-subif)#exitRouter(config)#interface f0/0.2Router(config-subif)#encapsulation dot1Q 20Router(config-subif)#ip address 192.168.2.1 255.255.255.0Router(config-subif)#exitRouter(config)#ip dhcp pool vlan10Router(dhcp-config)#network 192.168.1.0 255.255.255.0Router(dhcp-config)#default-router 192.168.1.1Router(dhcp-config)#dns-server 61.128.128.68Router(dhcp-config)#exitRouter(config)#ip dhcp pool vlan20Router(dhcp-config)#network 192.168.2.0 255.255.255.0Router(dhcp-config)#default-router 192.168.2.1Router(dhcp-config)#dns-server 61.128.128.68Router(dhcp-config)#exitRouter(config)#exitRouter#wr
测试2个网段互ping,没有问题就OK了~