IPIP tunnels and GRE tunnels 的差異在於 IPIP tunnel 只能跑 IP unicast,
GRE tunnels 可以跑任何 L3 協定, 即 GRE tunnels 的功能性大於 IPIP tunnel
IPIP tunnels 封包前加了 Outer IP Header, GRE tunnels 封包前加了 Outer IP Header 及 GRE Header
Linux 上的兩者設定方式很像, 設定範例
Site A IP 121.xx.xx.xx
Site B IP 203.xx.xx.xx
IPIP tunnels
Site A command:
modprobe ipip
ip tunnel add ipiptun mode ipip local 121.xx.xx.xx remote 203.xx.xx.xx ttl 64 dev eth0
ip addr add dev ipiptun 172.17.1.1 peer 172.17.1.2/32
ip link set dev ipiptun up
Site B command:
modprobe ipip
ip tunnel add ipiptun mode ipip local 203.xx.xx.xx remote 121.xx.xx.xx ttl 64 dev eth0
ip addr add dev ipiptun 172.17.1.2 peer 172.17.1.1/32
ip link set dev ipiptun up
GRE tunnels
Site A command:
modprobe ip_gre
ip tunnel add gretun mode gre local 121.xx.xx.xx remote 203.xx.xx.xx ttl 64 dev eth0
ip addr add dev gretun 172.17.1.1 peer 172.17.1.2/32
ip link set dev gretun up
Site B command:
modprobe ip_gre
ip tunnel add gretun mode gre local 203.xx.xx.xx remote 121.xx.xx.xx ttl 64 dev eth0
ip addr add dev gretun 172.17.1.2 peer 172.17.1.1/32
ip link set dev gretun up
ref. tunneling