IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    简单聊 Tunnel

    Teacher Du发表于 2024-11-01 03:51:26
    love 0

    首先简单说下 Tunnel 的意思,翻译成中文叫隧道,类似生活中的隧道,里面的内容我们看不到,除非身处隧道。企业在进行跨网数据传输时,为了数据安全,就会用到隧道技术。

    实验拓扑

    下图中的实验,我们在 R1 和 R3 上面建立隧道,而 R2 是隧道传输数据的介质:

    实验配置

    • R1 路由器:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    R1#configure terminal
    R1(config)#interface fastEthernet 0/0
    R1(config-if)#ip address 192.168.10.1 255.255.255.0
    R1(config-if)#no shutdown
    R1(config-if)#exit
    R1(config)#interface fastEthernet 1/0
    R1(config-if)#ip address 12.1.1.2 255.255.255.0
    R1(config-if)#no shutdown
    R1(config)#interface tunnel 1
    R1(config-if)#tunnel source 12.1.1.2
    R1(config-if)#tunnel destination 23.1.1.2
    R1(config-if)#ip address 100.1.1.1 255.255.255.0
    R1(config-if)#exit
    R1(config)#ip route 0.0.0.0 0.0.0.0 f1/0
    R1(config)#ip route 192.168.20.0 255.255.255.0 tunnel 1
    • R2 路由器:
    1
    2
    3
    4
    5
    6
    7
    8
    R2#configure terminal
    R2(config)#interface fastEthernet 0/0
    R2(config-if)#ip address 12.1.1.1 255.255.255.0
    R2(config-if)#no shutdown
    R2(config-if)#exit
    R2(config)#interface fastEthernet 1/0
    R2(config-if)#ip address 23.1.1.1 255.255.255.0
    R2(config-if)#no shutdown
    • R3 路由器:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    R3#configure terminal
    R3(config)#interface fastEthernet 0/0
    R3(config-if)#ip address 192.168.20.1 255.255.255.0
    R3(config-if)#no shutdown
    R3(config-if)#exit
    R3(config)#interface fastEthernet 1/0
    R3(config-if)#ip address 23.1.1.2 255.255.255.0
    R3(config-if)#no shutdown
    R3(config-if)#exit
    R3(config)#interface tunnel 2
    R3(config-if)#tunnel source 23.1.1.2
    R3(config-if)#tunnel destination 12.1.1.2
    R3(config-if)#ip address 100.1.1.2 255.255.255.0
    R3(config-if)#exit
    R3(config)#ip route 0.0.0.0 0.0.0.0 f1/0
    R3(config)#ip route 192.168.10.0 255.255.255.0 tunnel 2

    测试结果

    成功通信:

    再次测试

    接下来我们在 R2 上添加 ACL 禁止 192.168.10.0 网段通过 R2 路由器,命令如下:

    1
    2
    3
    4
    R2(config)#access-list 1 deny 192.168.10.0 0.0.0.255
    R2(config)#access-list 1 permit any
    R2(config)#interface fastEthernet 0/0
    R2(config-if)#ip access-group 1 in

    数据成功通过。因为 R2 并未处在隧道中,只是数据通信介质,所以并不能对数据进行限制:



沪ICP备19023445号-2号
友情链接