外网连接
在路由器上进行配置
配置nat功能
NAT配置:
[R1]acl basic 2000 创建acl规则 编号为2000
[R1-acl-ipv4-basic-2000]rule 0 permit source any 允许所有数据包
[R1-acl-ipv4-basic-2000]quit
[R1]nat address-group 1 配置出接口转换地址
[R1-address-group-1]address 172.21.100.1 172.21.100.1 将地址转换为172.21.100.1这个ip
[R1-address-group-1]quit
[R1]int g 0/0 配置出口,并将规则应用到接口
[R1-GigabitEthernet0/0]ip address 172.21.100.1 16
[R1-GigabitEthernet0/0]nat outbound 2000
[R1-GigabitEthernet0/0]quit
配置静态路由(默认路由,目标网络为全部,下一跳地址为172.21.0.254)
[R1]ip route-static 0.0.0.0 0.0.0.0 172.21.0.254
最后在自己电脑上测试访问互联网
访问规则
基本ACL配置(2000-2999)
1.进入2000号的基本访问控制列表视图
[H3C] ]access-list basic 2001
2.定义访问规则过滤192.168.101.2主机发出的报文
[H3C-acl-basic-2001] rule 1 deny source 192.168.101.2 0
3.在接口上应用2001号ACL
[H3C-acl-basic-2001] interface GigabitEthernet0/1.1
[H3C-GigabitEthernet0/1.1] packet-filter 2001 outbound
[H3C-GigabitEthernet0/1.1] quit
高级ACL配置(3000-3999)
1.进入3000号的高级访问控制列表视图
[H3C] access-list advanced 3000
2.定义访问规则,限制财务部门和其他部门互访。禁止源192.168.103.0与其他部门网络之间互访
[H3C-acl-adv-3000]rule 1 deny ip source 192.168.101.0 0.0.0.255 destination 192.168.103..0 0.0.0.255
[H3C-acl-adv-3000]rule 2 deny ip source 192.168.102.0 0.0.0.255 destination 192.168.103..0 0.0.0.255
[H3C-acl-adv-3000]rule 3 deny ip source 192.168.104.0 0.0.0.255 destination 192.168.103..0 0.0.0.255
[H3C-acl-adv-3000]rule 4 deny ip source 192.168.105.0 0.0.0.255 destination 192.168.103..0 0.0.0.255
[H3C-acl-adv-3000]rule 5 deny ip source 192.168.106.0 0.0.0.255 destination 192.168.103..0 0.0.0.255
在接口上应用3000号ACL
[H3C] interface GigabitEthernet0/1.3
[H3C-GigabitEthernet0/1.3] packet-filter 3000 outbound
[H3C-GigabitEthernet0/1.3] quit