对路由器进行配置
Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/1
Router(config-if)#no ip address
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#int f0/1.10
Router(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/1.10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.10, changed state to up
Router(config-subif)#enc
Router(config-subif)#encapsulation dot1q 40
Router(config-subif)#ip address 192.168.6.1 255.255.255.0
% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.
Router(config-subif)#exit
Router(config)#int f0/1.20
Router(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/1.20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.20, changed state to up
Router(config-subif)#encapsulation dot1q 50
Router(config-subif)#ip address 192.168.7.1 255.255.255.0
% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.
Router(config-subif)#exit
Router(config-subif)#end
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#
Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/1
Router(config-if)#no ip address
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#int f0/1.10
Router(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/1.10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.10, changed state to up
Router(config-subif)#ip address 192.168.6.1 255.255.255.0
% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.
Router(config-subif)#enc
Router(config-subif)#encapsulation dot1q 40
Router(config-subif)#exit
Router(config)#int f0/1.20
Router(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/1.20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.20, changed state to up
Router(config-subif)#ip address 192.168.7.1 255.255.255.0
% Configuring IP routing on a LAN subinterface is only allowed if that
subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q,
or ISL vLAN.
Router(config-subif)#encapsulation dot1q 50
Router(config-subif)#exit
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#ip address 192.168.5.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.5.1
Router(config)#ip route 192.168.2.0 255.255.255.0 192.168.5.1
Router(config)#ip route 192.168.3.0 255.255.255.0 192.168.5.1
Router(config)#ip route 192.168.4.0 255.255.255.0 192.168.5.1
Router(config)#ip route 192.168.8.0 255.255.255.0 192.168.5.1
Router(config)#ip route 192.168.9.0 255.255.255.0 192.168.5.1
以上路由表可用默认路由代替
Router(config)#ip route 0.0.0.0 0.0.0.0 f0/0 {192.168.5.1 }
Router(config)#end
Router#
Router>
Router>en
Router#
Router#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#access-list 101 permit tcp 192.168.1.0 0.0.0.255 host 192.168.6.10 eq www
Router(config)#access-list 101 permit tcp 192.168.1.0 0.0.0.255 host 192.168.7.10 eq www
Router(config)#access-list 101 deny ip 192.168.1.0 0.0.0.255 host 192.168.6.10
Router(config)#access-list 101 deny ip 192.168.1.0 0.0.0.255 host 192.168.7.10
Router(config)#access-list 101 permit tcp 192.168.2.0 0.0.0.255 host 192.168.7.10 eq www
Router(config)#access-list 101 deny tcp 192.168.2.0 0.0.0.255 host 192.168.6.10 eq www
Router(config)#access-list 101 deny ip 192.168.2.0 0.0.0.255 host 192.168.7.10
Router(config)#access-list 101 deny ip 192.168.2.0 0.0.0.255 host 192.168.6.10
Router(config)#int f0/0
Router(config-if)#ip access-group 101 in
Router(config-if)#exit