二层交换机:
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#int f vlan 10
Switch(config)#int vlan 10
%LINK-5-CHANGED: Interface Vlan10, changed state to up
Switch(config-if)#no shut
Switch(config-if)#exit
Switch(config)#int vlan 20
%LINK-5-CHANGED: Interface Vlan20, changed state to up
Switch(config-if)#no shut
Switch(config-if)#exit
Switch(config)#int f 0/1
Switch(config-if)#sw m a
Switch(config-if)#sw a vlan 10
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#exit
Switch(config)#int f 0/2
Switch(config-if)#sw m a
Switch(config-if)#sw a vlan 20
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#exit
Switch(config)#int r f 0/23-24
Switch(config-if-range)#sw m t
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up
Switch(config-if-range)#
Switch#
三层交换机:
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int r f 0/1-2
Switch(config-if-range)#sw m a
Switch(config-if-range)#sw m t
%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
%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-range)#exit
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#vlan 30
Switch(config-vlan)#exit
Switch(config)#int vlan 10
%LINK-5-CHANGED: Interface Vlan10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#no shut
Switch(config-if)#ip add 192.168.1.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 20
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#no shut
Switch(config-if)#ip add 192.168.2.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 30
%LINK-5-CHANGED: Interface Vlan30, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up
Switch(config-if)#no shut
Switch(config-if)#ip add 192.168.3.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#int f 0/24
Switch(config-if)#sw m a
Switch(config-if)#sw a vlan 30
Switch(config-if)#exit
Switch(config)#ip routing
Switch(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2
Switch(config)#ip route 192.168.5.0 255.255.255.0 192.168.3.2
Switch(config)#ip route 192.168.6.0 255.255.255.0 192.168.3.2
第一个路由:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f 0/0
Router(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#ip add 192.168.3.2 255.255.255.0
Router(config-if)#exit
Router(config)#int f 0/1
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router(config-if)#ip add 192.168.4.1 255.255.255.0
Router(config-if)#exit
Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1
Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1
Router(config)#ip route 192.168.5.0 255.255.255.0 192.168.4.2
Router(config)#ip route 192.168.6.0 255.255.255.0 192.168.4.2
第二个路由:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f 0/0
Router(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#ip add 192.168.4.2 255.255.255.0
Router(config-if)#exit
Router(config)#int f 0/1
Router(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router(config-if)#ip add 192.168.5.1 255.255.255.0
Router(config-if)#exit
Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.4.1
Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.4.1
Router(config)#ip route 192.168.3.0 255.255.255.0 192.168.4.1
Router(config)#ip route 192.168.6.0 255.255.255.0 192.168.5.2
第三个路由:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f 0/0
Router(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#ip add 192.168.5.2 255.255.255.0
Router(config-if)#exit
Router(config)#int f 0/1
Router(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
Router(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#ip add 192.168.6.1 255.255.255.0
Router(config-if)#exit
Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.5.1
网友评论