现在我们的要求就是让北京总公司与上海分公司通过广域网之后,两边内网能够相互通信,由于是实验环境,我们使用一个
三层交换机来模拟广域网,为了保证其安全性,使用两个H3C的防火墙来做GRE接入
第二阶段:配置广域网通信
1.配置广域网
<Quidway>system
Enter system view, return to user view with Ctrl+Z.
[Quidway]vlan 10 //创建vlan10
[Quidway-vlan10]port eth0/1 //将1端口加入vlan
[Quidway-vlan10]vlan 20 //创建vlan20
[Quidway-vlan20]port eth0/2 //将端口2加入
[Quidway-vlan20]int vlan 10
[Quidway-Vlan-interface10]ip add 61.130.131.1 255.255.255.0 //配置vlan ip
[Quidway-Vlan-interface10]int vlan 20
[Quidway-Vlan-interface20]ip add 61.130.130.1 255.255.255.0 //配置vlan ip
2.北京总公司防火墙配置
<H3C>system
[H3C]int eth0/0
[H3C-Ethernet0/0]ip add 192.168.1.1 24 //配置内网网关
[H3C-Ethernet0/0]int eth0/4
[H3C-Ethernet0/4]ip add 61.130.131.2 24 //配置外网ip
[H3C]firewall zone untrust
[H3C-zone-untrust]add int eth0/4 //将eth0/4加入untrust区域
[H3C-zone-untrust]
[H3C]ip route-static 0.0.0.0 0 61.130.131.1 //配置静态路由
3.上海分公司防火墙配置
<H3C>system
System View: return to User View with Ctrl+Z.
[H3C]int eth0/0
[H3C-Ethernet0/0]ip add 192.168.2.1 24 //内网网关
[H3C-Ethernet0/0]int eth0/4
[H3C-Ethernet0/4]ip add 61.130.130.2 24 //外网IP
[H3C]firewall zone untrust
[H3C-zone-untrust]add int eth0/4 //将eth0/4加入untrust区域
[H3C]ip route-static 0.0.0.0 0 61.130.130.1 //配置静态路由
4.测试
使用北京防火墙ping上海防火墙端口ip
[H3C]ping 61.130.130.2
PING 61.130.130.2: 56 data bytes, press CTRL_C to break
Reply from 61.130.130.2: bytes=56 Sequence=1 ttl=254 time=19 ms
Reply from 61.130.130.2: bytes=56 Sequence=2 ttl=254 time=6 ms
Reply from 61.130.130.2: bytes=56 Sequence=3 ttl=254 time=5 ms
Reply from 61.130.130.2: bytes=56 Sequence=4 ttl=254 time=5 ms
Reply from 61.130.130.2: bytes=56 Sequence=5 ttl=254 time=6 ms
--- 61.130.130.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 5/8/19 ms
第二阶段:隧道配置
1. 北京总公司防火墙配置
[H3C]int Tunnel 10 //创建隧道10
[H3C-Tunnel10]tunnel-protocol gre //gre封装协议
[H3C-Tunnel10]source 61.130.131.2 //源ip(外网合法ip)
[H3C-Tunnel10]destination 61.130.130.2 //目的ip(对端合法ip)
[H3C-Tunnel10]ip add 192.168.4.1 24 //隧道ip
[H3C-Tunnel10]quit
[H3C]ip route-static 192.168.2.0 255.255.255.0 Tunnel 10 //静态路由,指出到达192.168.2.0网段的路由进入tunnel 10进行传输
[H3C]firewall zone untrust
[H3C-zone-untrust]add int Tunnel 10 //把隧道加入非安全区域
2. 上海总公司防火墙配置
[H3C]int Tunnel 20
[H3C-Tunnel20]tunnel-protocol gre
[H3C-Tunnel20]source 61.130.130.2
[H3C-Tunnel20]destination 61.130.131.2
[H3C-Tunnel20]ip add 192.168.4.2 24
[H3C-Tunnel20]quit
[H3C]ip route-static 192.168.1.0 255.255.255.0 Tunnel 20
[H3C]firewall zone untrust
[H3C-zone-untrust]add interface Tunnel 20
3.测试
使用北京总公司一个主机ping上海分公司的网关
C:\Documents and Settings\Administrator>ping 192.168.2.1
Pinging 192.168.2.1 with 32 bytes of data:
Reply from 192.168.2.1: bytes=32 time=8ms TTL=254
Reply from 192.168.2.1: bytes=32 time=5ms TTL=254
Reply from 192.168.2.1: bytes=32 time=4ms TTL=254
Reply from 192.168.2.1: bytes=32 time=4ms TTL=254
Ping statistics for 192.168.2.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 4ms, Maximum = 8ms, Average = 5ms