Router>en Router#conf t nter configuration commands, one per line. End with CNTL/Z. Router(config)#no ip domain-lookup Router(config)#host Server Server(config)#line con 0 Server(config-line)#logg syn Server (config-line)#exec-timeout 0 0 Server (config-line)#exit Server (config)#int s0/0/0 Server (config-if)#ip add 202.1.1.1 255.255.255.0 Server(config-if)#ip nat outside Server (config-if)#no shut %LINK-5-CHANGED: Interface Serial0/0/0, changed state to down Server (config-if)#int fa0/0 Server(config-if)#ip nat inside Server (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 Server (config-if)#exit Server(config)#access-list 1 permit 192.168.1.00.0.0.255 Server(config)#ip nat inside source list 1 interface s0/0/0 overload Server (config)#ip route 0.0.0.0 0.0.0.0 s0/0/0 Server (config)#exit Server#
ISP端的配置:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host ISP
ISP(config)#no ip domain-lookup
ISP(config)#line con 0
ISP(config-line)#logg syn
ISP(config-line)#exec-timeout 0 0
ISP(config-line)#exit
ISP(config)#int s0/0/0
ISP(config-if)#ip add 202.1.1.2 255.255.255.0
ISP(config-if)#no shut
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
ISP(config-if)#clock rate 64000
ISP(config-if)#exit
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to up
ISP(config)#int fa0/0
ISP(config-if)#ip add 202.2.2.2 255.255.255.0
ISP(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
ISP(config-if)#int fa0/1
ISP(config-if)#ip add 202.3.3.3 255.255.255.0
ISP(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
ISP(config-if)#exit
ISP(config)#
现在我们将DNS服务器配置起来:
在这里做一个域名解析,以便我们等一会我们公司内部那4台PC通过这个域名去访问我们的WWW服务器。
配置WWW服务器:
WWW服务默认是开启了的,所以不必我们再去开启一次。
现我们来配置交换机!划分两个VLAN出来。
Switch>en Switch#conf t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#vlan 2 Switch(config-vlan)#exit Switch(config)#vlan 3 Switch(config-vlan)#exit Switch(config)#int range fa0/1 -2 Switch(config-if-range)#sw acc vlan 2 Switch(config-if-range)#exit Switch(config)#int range fa0/3 -4 Switch(config-if-range)#sw acc vlan 3 Switch(config-if-range)#exit Switch(config)#int fa0/24 Switch(config-if)#sw mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up Switch(config-if)#exit Switch(config)#
这上面的命令就不多说了吧!大至看一下应该就明白了
我们现在在路由器上面去做一个单臂路由,并将DHCP应用起。
Router(config)#int fa0/0.1
%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up Router(config-subif)#encapsulation dot1Q 2 Router(config-subif)#ip add 192.168.1.1 255.255.255.0 Router(config-subif)#no shut Router(config-subif)#exit Router(config)#int fa0/0.2
%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up Router(config-subif)#encapsulation dot1Q 3 Router(config-subif)#ip add 192.168.2.1 255.255.255.0 Router(config-subif)#no shut Router(config-subif)#exit Router(config)#ip dhcp pool VLAN2 Router(dhcp-config)#network 192.168.1.0 255.255.255.0 Router(dhcp-config)#dns 202.2.2.1 Router(dhcp-config)#default-router 192.168.1.1 Router(dhcp-config)#exit Router(config)#ip dhcp pool VLAN3 Router(dhcp-config)#network 192.168.2.0 255.255.255.0 Router(dhcp-config)#dns 202.2.2.1 Router(dhcp-config)#default-router 192.168.2.1 Router(dhcp-config)#exit Router(config)#ip dhcp excluded-address 192.168.1.1 Router(config)#ip dhcp excluded-address 192.168.2.1 Router(config)#access-list 1 permit 192.168.2.0 0.0.0.255 Router(config)#exit Router(config)#int fa0/0.1 Router(config-subif)#ip nat inside Router(config-subif)#exit Router(config)#int fa0/0.2 Router(config-subif)#ip nat inside Router(config-subif)#exit Router(config)#