组建小型校园网:学生宿舍50台计算机、办公楼30台计算机(办公楼又分为财务处、人事处,以及其他科室)、图书馆10台计算机、教学楼30台计算机、服务器2台(FTP、Web),学校通过一台路由器连接到服务器和Internet。
1.每个部门内部可以二层互通、部门间可以三层互通。
2.使用静态路由、RIP路由配置。
3.校园内部使用私网IP地址,所有用户均可通过校园网访问Internet。
4.所有用户均可在内网实现资源共享,访问Web/FTP服务器。
5.学生宿舍、图书馆、教学楼不能访问人事处、财务处。
6.服务器采用静态IP地址,其他用户采用动态IP地址。
分别在学生宿舍、图书馆、教学楼下设置一台主机和一台Client为代表,以实现二层之间的互通。在办公楼下设置三个交换机,每个交换机下设置一台主机和一台Client为代表,以实现二层之间的互通。
使用一个聚合交换机进行配置,代表教学楼,以实现三层之间可以实现互通。同时满足要求学生宿舍、图书馆、教学楼不能访问人事处、财务处。
以下为IP地址规划
校园网整体部署
分别在LSW1-LSW6上配置VLAN,然后配置入口类型为access,将主机默认vlan设置成配置的vlan,并且将出口设置为trunk类型,设置出口的vlan为默认预设的vlan
undo info-center enable
vlan batch 10
port-group group-member e0/0/1 to e0/0/21
port link-type access
port default vlan 10
q
interface e0/0/22
port link-type trunk
port trunk allow-pass vlan 10
q
q
save
undo info-center enable
vlan batch 20
port-group group-member e0/0/1 to e0/0/21
port link-type access
port default vlan 20
q
interface e0/0/22
port link-type trunk
port trunk allow-pass vlan 20
q
q
save
undo info-center enable
vlan batch 30
port-group group-member e0/0/1 to e0/0/21
port link-type access
port default vlan 30
q
interface e0/0/22
port link-type trunk
port trunk allow-pass vlan 30
q
q
save
undo info-center enable
vlan batch 40
port-group group-member e0/0/1 to e0/0/21
port link-type access
port default vlan 40
q
interface e0/0/22
port link-type trunk
port trunk allow-pass vlan 40
q
q
save
undo info-center enable
vlan batch 50
port-group group-member e0/0/1 to e0/0/21
port link-type access
port default vlan 50
q
interface e0/0/22
port link-type trunk
port trunk allow-pass vlan 50
q
q
save
undo info-center enable
vlan batch 60
port-group group-member e0/0/1 to e0/0/21
port link-type access
port default vlan 60
q
interface e0/0/22
port link-type trunk
port trunk allow-pass vlan 60
q
q
save
在AR1路由器上配置VLAN10、50、60,以实现学生宿舍、图书馆和教学楼之间可以进行部门间的三层访问。
首先,批量创建VLAN10、50、60,设置接口类型为access,将默认VLAN设置成预设的VLAN,然后将出口类型设置为trunk,将默认VLAN设置成预设,使其通过。
同时创建一个VLAN100,目的是为了给办公楼进行使用。
vlan batch 10 50 60 100
interface Ethernet 0/0/7
port link-type trunk
port trunk allow-pass vlan 10
quit
interface Ethernet 0/0/6
port link-type trunk
port trunk allow-pass vlan 100
quit
interface Ethernet 0/0/5
port link-type trunk
port trunk allow-pass vlan 50
quit
interface Ethernet 0/0/4
port link-type trunk
port trunk allow-pass vlan 60
quit
给学生宿舍、图书馆、教学楼配置路由,启用DHCP服务,他们所属网络的电脑能够动态获取IP,并且使得学生宿舍、图书馆、教学楼之间可以相互ping通。
# 启用DHCP服务
dhcp enable
# 进入VLAN接口10的配置模式
interface vlanif 10
ip address 192.168.1.1 24
# 选择通过接口分配IP地址。这通常意味着当设备请求IP地址时,它会从该接口的地址池中获取一个地址。
dhcp select interface
quit
interface vlanif 50
ip address 192.168.5.1 24
dhcp select interface
quit
interface vlanif 60
ip address 192.168.6.1 24
dhcp select interface
quit
配置后,将学生宿舍、图书馆和教学楼下的电脑IP设置为DHCP模式,等待一会儿,它们下面的电脑就可以获取到IP,并且可以相互ping通
在LSW7上批量创建VLAN20、30、40、100,将LSW7上与LSW2、LSW3、LSW4交换机连接的接口类型配置为trunk,并依次设置VLAN设置为20、30、40。
vlan batch 20 30 40 100
interface GigabitEthernet 0/0/23
port link-type trunk
port trunk allow-pass vlan 20
quit
interface GigabitEthernet 0/0/22
port link-type trunk
port trunk allow-pass vlan 30
quit
interface GigabitEthernet 0/0/21
port link-type trunk
port trunk allow-pass vlan 40
quit
interface GigabitEthernet 0/0/24
port link-type trunk
port trunk allow-pass vlan 100
quit
在三个VLANIF中分别配置每一个路由地址
interface vlanif 20
ip address 192.168.2.1 24
quit
interface vlanif 30
ip address 192.168.3.1 24
quit
interface vlanif 40
ip address 192.168.4.1 24
quit
interface vlanif 100
ip address 192.168.100.1 24
quit
# 配置RIP路由协议,版本为100
rip 100
# 为四个网络段(即VLAN接口对应的IP地址范围)添加路由信息
network 192.168.2.0
network 192.168.3.0
network 192.168.4.0
network 192.168.100.0
quit
在LSW7上配置DHCP中继,在LSW7上使能DHCP功能,然后在LSW7上,使能DHCP relay功能并且指定中继到的DHCP服务器地址。
dhcp enable
interface vlanif 20
# 将VLAN接口20配置为DHCP中继模式。这意味着该接口将转发来自客户端的DHCP请求到指定的DHCP服务器。
dhcp select relay
# 指定VLAN接口20的DHCP中继服务器IP地址为192.168.100.2。这意味着当VLAN接口20接收到DHCP请求时,它会将请求转发到这个IP地址的DHCP服务器。
dhcp relay server-ip 192.168.100.2
quit
interface vlanif 30
dhcp select relay
dhcp relay server-ip 192.168.100.2
quit
interface vlanif 40
dhcp select relay
dhcp relay server-ip 192.168.100.2
quit
在DHCP服务器上AR1上使能DHCP功能,然后分别配置全局地址池pool2、pool3、pool4。进入连接下方LSW7的VLANIF 100接口,并且使能全局地址池功能。
dhcp enable
# 进入名为"pool2"的IP池配置模式。
ip pool pool2
# 定义"pool2"的IP地址范围为192.168.2.0至192.168.2.255。
network 192.168.2.0 mask 255.255.255.0
gateway-list 192.168.2.1
quit
ip pool pool3
network 192.168.3.0 mask 255.255.255.0
gateway-list 192.168.3.1
quit
ip pool pool4
network 192.168.4.0 mask 255.255.255.0
gateway-list 192.168.4.1
quit
interface vlanif 100
# 将VLAN接口100配置为全局模式,这意味着该接口将直接从DHCP服务器获取IP地址,而不是使用之前配置的IP池。
dhcp select global
quit
实现资源共享,使得所有用户均可通过校园网访问Web/FTP服务器,也是Server1,IP网关为200.1.1.1。
首先需要在AR1上将直连路由加入其中
interface vlanif 100
ip address 192.168.100.2 24
quit
rip 100
network 192.168.100.0
network 192.168.1.0
network 192.168.5.0
network 192.168.6.0
quit
#然后在AR1路由器和Web/FTP服务器连接的路由上配置VLAN,并且在VLANIF中配置网络地址。将配置的地址加入rip当中进行广播。
vlan batch 1000
interface Ethernet 0/0/2
port link-type access
port default vlan 1000
quit
interface vlanif 1000
ip address 200.1.1.1 24
quit
rip 100
network 200.1.1.0
quit
# 在AR1的GigabitEthernet 0/0/1接口上配置一个IP地址
interface G0/0/1
ip address 150.1.1.1 24
quit
# AR 1和AR2分别配置连通对方的静态地址
ip route-static 0.0.0.0 0.0.0.0 150.1.1.2
测试PC1、PC2 ping 100.1.1.2,FTP服务器访问性
测试PC2ping PC3、PC4,教学区连通性
测试PC1pingPC2能够连通,需要配置acl
通过配置ACL,使得学生宿舍、图书馆和教学楼不能访问人事处、财务处和其他科室。
配置一个acl3000,将具体的地址制定为规则,然后在LSW7的接口下应用其规则。
acl 3000
rule 1 deny ip source 192.168.1.1 0.0.0.255 destination 192.168.2.1 0.0.0.255
rule 2 deny ip source 192.168.1.1 0.0.0.255 destination 192.168.3.1 0.0.0.255
rule 3 deny ip source 192.168.1.1 0.0.0.255 destination 192.168.4.1 0.0.0.255
rule 4 deny ip source 192.168.5.1 0.0.0.255 destination 192.168.2.1 0.0.0.255
rule 5 deny ip source 192.168.5.1 0.0.0.255 destination 192.168.3.1 0.0.0.255
rule 6 deny ip source 192.168.5.1 0.0.0.255 destination 192.168.4.1 0.0.0.255
rule 7 deny ip source 192.168.6.1 0.0.0.255 destination 192.168.2.1 0.0.0.255
rule 8 deny ip source 192.168.6.1 0.0.0.255 destination 192.168.3.1 0.0.0.255
rule 9 deny ip source 192.168.6.1 0.0.0.255 destination 192.168.4.1 0.0.0.255
quit
interface vlanif100
traffic-filter outbound acl 3000
quit
配置NAT需要先配置不同的地址组,分配不同的地址。然后配置不同的acl,分配不同的acl,最后AR1的interface GigabitEthernet0/0/1上将不同的IP地址组和不同的acl相对应起来。此外。还需要在LSW7上配置一个静态路由。
ip route-static 0.0.0.0 0.0.0.0 192.168.100.2
nat address-group 1 150.1.1.100 150.1.1.200
nat address-group 2 150.2.1.100 150.2.1.200
nat address-group 3 150.3.1.100 150.3.1.200
nat address-group 4 150.4.1.100 150.4.1.200
nat address-group 5 150.5.1.100 150.5.1.200
nat address-group 6 150.6.1.100 150.6.1.200
acl 2001
rule permit source 192.168.1.2 0.0.0.255
quit
acl 2002
rule permit source 192.168.2.2 0.0.0.255
quit
acl 2003
rule permit source 192.168.3.2 0.0.0.255
quit
acl 2004
rule permit source 192.168.4.2 0.0.0.255
quit
acl 2005
rule permit source 192.168.5.2 0.0.0.255
quit
acl 2006
rule permit source 192.168.6.2 0.0.0.255
quit
interface GigabitEthernet0/0/1
nat outbound 2001 address-group 1 no-pat
nat outbound 2002 address-group 2 no-pat
nat outbound 2003 address-group 3 no-pat
nat outbound 2004 address-group 4 no-pat
nat outbound 2005 address-group 5 no-pat
nat outbound 2006 address-group 6 no-pat
quit
# 在AR2路由器上配置VLAN,并且将接口类型设置为access。默认VALN设置为预设的200
vlan batch 200
interface Ethernet 0/0/7
port link-type access
port default vlan 200
quit
# 在AR2上配置VLANIF中的地址,并且给GigabitEthernet 0/0/1配置一个IP地址
interface vlanif 200
ip address 100.1.1.1 24
quit
interface G0/0/1
ip address 150.1.1.2 24
quit
# AR 1和AR2分别配置连通对方的静态地址
ip route-static 0.0.0.0 0.0.0.0 150.1.1.1
设置外网电脑
觉得不错,麻烦点个关注点个赞,也可以赞助(一,哈哈!),元两元都是爱有疑问也可以在评论区留言。