1.连接图:
2.配置:
a.端口f0/1的配置:
Switch>enab
Switch#confi ter
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#ip routing //开启路由功能
Switch(config)#inter fa0/1
Switch(config-if)#no switchport //f0/1端口启用三层路由动能
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Switch(config-if)#ip address 192.168.1.1 255.255.255.0
Switch(config-if)#no shut //开启端口
Switch(config-if)#end
Switch#
%SYS-5-CONFIG_I: Configured from console by console
a.端口f0/2的配置:
Switch>enab
Switch#confi ter
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#ip routing //开启路由功能
Switch(config)#inter fa0/2
Switch(config-if)#no switchport //f0/2端口启用三层路由动能
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
Switch(config-if)#ip address 192.168.2.1 255.255.255.0
Switch(config-if)#no shut //开启端口
Switch(config-if)#end
Switch#
%SYS-5-CONFIG_I: Configured from console by console
可参考下图
3.测试结果: