一、实验拓扑图:
二、配置网络需求:
(1)园区内每个设备都要配置hostname——接入层交换机左边为sw1(456),右边为sw2(456);汇聚层交换机为s1;网络边缘层路由器为r1。
Ho r1
Enable pass 456
(2)按照上图为PC和服务器配置好相应的IP地址以及网关,网关IP地址的最后一位都是254。
(3)按照上图配置vlan、trunk(都用802.1Q封装协议);通过VTP协议同步整个园区的交换机上vlan信息,VTP域名为abc.com,VTP版本为2,VTP密码为abc12345,汇聚层交换机为VTP服务器模式,接入层交换机都为VTP客户端模式。
注意:交换机设备管理vlan为vlan 1,IP网段是172.44.1.0/24。
(4)在汇聚层交换机实现vlan间通信,并使得汇聚层交换机能与边缘路由器R1进行通信。
使得R1能与所有vlan的PC或服务器通信。
(5)配置Server 1(192.44.1.1/24)为DHCP服务器,为vlan 2、3、4分配IP地址。
使得vlan 2、3、4的PC都能获取到相应的IP地址。
(6)配置Server2(192.44.1.2/24)为HTTP、FTP服务器;配置Server 1(192.44.1.1/24)为DNS服务器,添加域名www.abc.com、ftp.abc.com并对应相应的IP地址,以及Internet HTTP服务的域名为www.internet.com<-->17.44.1.55/24:
(6.1)FTP服务,开账户——用户名:mike,密码是12345,拥有所有FTP功能。
(7)配置所有园区内设备:
(7.1)本地登录密码为abc12345。
(7.2)Console登录,用户名为admin,密码为admin,并按上图所示,PC 1通过Console连接到Sw1,进行测试。
(7.3)配置SSH远程登录,用户名为admin,密码为admin。
(7.4)配置只有vlan 2的用户能通过SSH远程登录到园区内所有设备。
(8)配置Server 1(192.44.1.1/24)为网络时间服务器,调整时间与日期为实验当天当时,验证key为1,验证密码为abc12345,使得园区内所有设备能与时间服务器的时间、日期同步一致。
(9)配置Server 1(192.44.1.1/24)为日志服务器,使得园区内所有设备的日志都能存放到这个服务器。
(10)按照上图所示,配置好Internet区域相应的IP地址与网关以及服务器的服务。
(10.1)在R2上,配置DHCP服务,使得Laptop 1能获得IP地址并能与外界进行通信。
(11)R1上配置PAT:
(11.1)所有PC的vlan的用户上网都转换为公网IP地址:61.44.1.10/27。
(11.2)Internet用户Laptop 1通过公网IP地址61.44.1.20/24,可访问ABC Company的HTTP、FTP。其中:HTTP服务的域名为www.abcservice.com、FTP服务的域名为ftp.abcservice.com,由Server 3进行DNS域名解释。
(11.3)Internet所有的网络设备的时间与日期,以及日志都存放到ABC Company的NTP服务器以及Syslog服务器。
(12)ABC Company园区内的网络安全:
(12.1)vlan 4所有用户不能访问vlan 2所有用户;
(12.2)vlan 3所有用户不能访问ABC Company内的FTP服务。
(13)模拟设备故障:
(13.1)把Server 1(192.44.1.1/24)配置为TFTP服务器,使得S1的IOS能上传到TFTP服务器;能把任何一个TFTP服务器的IOS下载到Sw1。
(13.2)假设你忘记了R2的本地登录密码,现在需要在进入到命令配置界面后修改寄存器的值后,使得重启R2后,直接绕过startup-config直接登录到设备,并修改本地登录密码为abc67890,并修改寄存器的值使得以后R2重启后,仍然需要读取startup-config。
(13.3)现在需要一个干净的无任何配置的sw2,实施操作前请把交换机的所有连线都断开(删除)
全部实验代码:
En
Conf t
Host name Sw1
Vlan 2
Vlan 3
Vlan 4
Exit
Int f0/1
Sw ac vlan 2
Int f0/2
Sw ac vlan 3
Int f0/3
Sw ac vlan 4
Int f0/4
Sw mot r
Vtp version 2
Vtp domain kb
Vtp pass 123
Vtp mode client
Line con 0
Login local
Username admin password admin
Int vlan 1
No sh
Ip add 172.44.1.1 255.255.255.0
Exit
Ip default-gateway 172.44.1.254
Ip domain-name kb.com
Enable password abc12345
Username admin password admin
Cry key generate rsa
Line vty 0 15
Login local
Transport input ssh
Transport output ssh
Ip access-list standard kb
Permit 172.44.2.0 0.0.0.255
Deny any
Line vty 0 15
Access-class kb in
En
Conf t
Host name Sw2
Enable password abc12345
vlan 99
exit
int range f0/1-2
sw ac vlan 99
int f0/3
sw mot r
en
conf t
host name S1
enable password abc12345
exit
vlan 2
vlan 3
vlan 4
vlan 99
exit
int range f0/2-3
sw tr en dot
sw mot r
exit
int vlan 2
ip add 172.44.2.254 255.255.255.0
ip helper-address 192.44.1.1
int vlan 3
ip access-group cp in
ip add 172.44.3.254 255.255.255.0
ip helper-address 192.44.1.1
int vlan 4
ip access-group kb in
ip add 172.44.4.254 255.255.255.0
ip helper-address 192.44.1.1
int vlan 99
ip add 192.44.1.254 255.255.255.0
int vlan 1
no sh
ip add 172.44.1.254 255.255.255.0
int f0/1
no sw
ip add 172.44.254.1 255.255.255.252
no sh
exit
ip routing
ip route 0.0.0.0 0.0.0.0 172.44.254.2
exit
ip access-list extended kb
deny ip 172.44.4.0 0.0.0.255 172.44.2.0 0.0.0.255
permit ip any any
ip access-list extended cp
deny tcp 172.44.3.0 0.0.0.255 host 192.44.1.2 eq 21
permit ip any any
exit
ntp authentication-key 1 md5 abc12345
ntp trusted-key 1
ntp server 192.44.1.1
ntp update-calendar
logging on
logging host 192.44.1.1
logging trap debugging
en
conf t
host name R1
enable password abc12345
int f0/1
ip nat inside
ip add 172.44.254.2 255.255.255.252
no sh
int f0/0
ip nat outside
ip add 61.44.1.1 255.255.255.224
no sh
exit
ip route 0.0.0.0 0.0.0.0 61.44.1.30
ip route 172.44.0.0 255.255.0.0 172.44.254.1
ip route 192.44.1.0 255.255.255.0 172.44.254.1
exit
ip access-list standard kb
permit 172.44.2.0 0.0.0.255
permit 172.44.3.0 0.0.0.255
permit 172.44.4.0 0.0.0.255
permit 192.44.1.0 0.0.0.255
deny any
ip access-list standard cp
permit 17.44.1.0 0.0.0.255
deny any
exit
ip nat pool 1 61.44.1.10 61.44.1.10 netmask 255.255.255.224
ip nat inside source list kb pool 1 overload
ip nat inside source static tcp 192.44.1.2 80 61.44.1.20 80
ip nat inside source static tcp 192.44.1.2 21 61.44.1.20 21
ip nat inside source static udp 192.44.1.1 123 61.44.1.11 123
ip nat inside source static udp 192.44.1.1 514 61.44.1.12 514
en
conf t
host name R2
enable password abc12345
int f0/1
ip add 61.44.1.30 255.255.255.224
no sh
int f0/0
ip add 17.44.1.254 255.255.255.0
no sh
exit
ip dhcp excluded-address 17.44.1.100
ip dhcp pool Laptop1
net 17.44.1.0 255.255.255.0
default-router 17.44.1.254
dns-server 17.44.1.55
exit
ntp authentication-key 1 md5 abc12345
ntp trusted-key 1
ntp server 61.44.1.11
ntp update-calendar
logging on
logging host 61.44.1.12
logging trap debugging
R2密码恢复
rommon > confreg 0x2142
rommon > boot
en
copy start run
conf t
enable password abc67890
config-register 0x2102
exit
copy run start