ACL的综合应用
公司内部网络已经建成,网络拓扑图如下所示:
公司网络内部规划如下:
(1)根据公司现有各部门主机数量和以后增加主机的情况,为每个部门分配一个C类地址,并且每个部门使用一个VLAN,以便以管理。
(2)分配一个C类地址作为设备的管理地址。
按照上述规划配置设备,已经实现了网络连通。
基于信息安全方面考虑,公司要求如下:
(1)限定不同部门能访问的服务器。例如,财务部只能访问财务部服务器,生产部只能访问生产部服务器。
(2)网络管理员可以访问所有服务器。
(3)网络设备只允许网管区IP地址通过TELNET登陆,并配置设备用户名为ysf,密码为ysf.123
(4)只有网络管理员才能通过远程桌面、TELNET、SSH等登陆方式管理服务器
(5)要求所有部门之间不能互通,但都可以和网络管理员互通
(6)公司有几名信息安全员,要求信息安全员可以访问服务器,但不能访问Internet
(7)外网只能访问特定服务器的特定服务
由于公司网络比较复杂,按照以下网络规划进行配置,如图所示:
1.配置设备,实现全网互通
(1)R1的配置信息如下:
1
2
3
4
5
6
7
8
9
10
11
|
R1(config)
# int f0/0
R1(config-
if
)
# ip add 10.0.0.2 255.0.0.0
R1(config-
if
)
# no sh
R1(config)
# int loopback 0
R1(config-
if
)
# ip add 192.168.1.4 255.255.255.0
R1(config)
# int loopback 1
R1(config-
if
)
# ip add 123.0.1.1 255.255.0.0
R1(config)
# ip route 192.168.0.0 255.255.0.0 10.0.0.1
|
(2)SW1的配置信息如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
SW1(config)
# vlan 2
SW1(config)
# vlan 3
SW1(config)
# vlan 4
SW1(config)
# vlan 10
SW1(config)
# int f0/1
SW1(config-
if
)
# no sw
SW1(config-
if
)
# ip add 10.0.0.1 255.0.0.0
SW1(config)
# ip route 0.0.0.0 0.0.0.0 10.0.0.2
SW1(config)
# ip routing
SW1(config)
# int r f0/23 - 24
SW1(config-
if
-range)
# sw tr en do
SW1(config-
if
-range)
# sw mo tr
SW1(config)
# vlan 1
SW1(config-
if
)
# ip add 192.168.1.1 255.255.255.0
SW1(config-
if
)
# no sh
SW1(config)
# vlan 2
SW1(config-
if
)
# ip add 192.168.2.1 255.255.255.0
SW1(config-
if
)
# no sh
SW1(config)
# vlan 3
SW1(config-
if
)
# ip add 192.168.3.1 255.255.255.0
SW1(config-
if
)
# no sh
SW1(config)
# vlan 4
SW1(config-
if
)
# ip add 192.168.4.1 255.255.255.0
SW1(config-
if
)
# no sh
SW1(config)
# vlan 10
SW1(config-
if
)
# ip add 192.168.10.1 255.255.255.0
SW1(config-
if
)
# no sh
|
(3)SW2的配置信息如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
SW2(config)
# vlan 2
SW2(config)
# vlan 3
SW2(config)
# vlan 4
SW2(config)
# int f0/24
SW2(config-
if
)
# sw mo tr
SW2(config)
# int vlan 1
SW2(config-
if
)
# ip add 192.168.1.2 255.255.255.0
SW2(config-
if
)
# no sh
SW2(config)
# ip default-gateway 192.168.1.1
SW2(config)
# int 0/1
SW2(config-
if
)
# sw ac vlan 2
SW2(config)
# int 0/2
SW2(config-
if
)
# sw ac vlan 3
SW2(config)
# int 0/3
SW2(config-
if
)
# sw ac vlan 4
|
SW3的配置信息如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
SW3(config)
# vlan 10
SW3(config)
# int f0/24
SW3(config-
if
)
# sw mo tr
SW3(config)
# int 0/1
SW3(config-
if
)
# sw ac vlan 10
SW3(config)
# int vlan 1
SW3(config-
if
)
# ip add 192.168.1.3 255.255.255.0
SW3(config-
if
)
# no sh
SW3(config)
# ip default-gateway 192.168.1.1
|
2.配置ACL实现公司要求
(1)配置实现网络设备只允许网管区IP地址通过TELNET登陆,并配置设备用户名为ysf,密码为ysf.123
R1的配置信息如下:
1
2
3
4
5
6
7
8
|
R1(config)
# access-list 1 permit 192.168.2.0 0.0.0.255
R1(config)
# username ysf password ysf.123
R1(config)
# line vty 0 4
R1(config-line)
# login local
R1(config-line)
# access-class 1 in
SW1、SW2、SW3的配置信息与R1相同(略)
|
(2)公司其他要求配置如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
SW1(config)
# ip access-list extended fuwuqi
SW1(config-ext-nacl)
# permit ip 192.168.2.0 0.0.0.255 host 192.168.10.2 //允许网管区访问服务器
SW1(config-ext-nacl)
# deny tcp 192.168.0.0 0.0.255.255 host 192.168.10.2 eq telnet
SW1(config-ext-nacl)
# deny tcp 192.168.0.0 0.0.255.255 host 192.168.10.2 eq 22
SW1(config-ext-nacl)
# deny tcp 192.168.0.0 0.0.255.255 host 192.168.10.2 eq 3389 //以上四条ACL表示,除了网管区外,其他所有内网主机都不能通过访问TELNET、SSH和远程桌面登陆服务器
SW1(config-ext-nacl)
# permit ip 192.168.0.0 0.0.255.255 host 192.168.10.2
SW1(config-ext-nacl)
# permit tcp any host 192.168.10.2 eq 80 //以上两条ACL表示,允许内网主机访问服务器,允许外网主机访问服务器的www服务
SW1(config-ext-nacl)
# deny ip any any
SW1(config)
# int vlan 10
SW1(config-
if
)
# ip access-group fuwuqi out //应用到OUT方向
SW1(config)
# ip access-list extended caiwubu
SW1(config-ext-nacl)
# permit ip 192.168.3.0 0.0.0.255 host 192.168.10.2
SW1(config-ext-nacl)
# permit ip 192.168.3.0 0.0.0.255 192.168.2.0 0.0.0.0.255
SW1(config-ext-nacl)
# deny ip 192.168.3.0 0.0.0.255 192.168.0.0 0.0.0.255.255
SW1(config-ext-nacl)
# permit ip any any //以上四条表示财务部可以访问服务器,可以访问网管区和外网,拒绝访问其他部门
SW1(config)
# int vlan 3
SW1(config-
if
)
# ip access-group caiwubu in //应用到IN方向
SW1(config)
# ip access-list extended anquanyuan
SW1(config-ext-nacl)
# permit ip 192.168.4.0 0.0.0.255 host 192.168.10.2
SW1(config-ext-nacl)
# permit ip 192.168.4.0 0.0.0.255 192.168.2.0 0.0.0.0.255
SW1(config-ext-nacl)
# deny ip any any //以上三条表示安全员可以访问服务器,可以访问网管区,拒绝访问其他部门,拒绝访问外网
SW1(config)
# int vlan 4
SW1(config-
if
)
# ip access-group anquanyuan in
|
(3)配置完成后验证
使用ping命令验证配置是否正确