過程有點兒複雜. 共分為三個部分.
第一部分.
我用一台多IP位址的linux與對端網絡裝置相建立兩條gre通道.
我得出了下面的結論.
就算是指定本機不同的 local IP 與對端建立第二條通道. 通道也建立不起來. 但執行指令時并不會有出錯提示.
如果使用 ip tunnel change來改變原有虛接口的 remote也是一樣. 如果對端IP已經出現. 修改是不會成功的. 指令執行時也沒有出錯資訊.
第二部分
Yelo_Vint ( https://me.csdn.net/Yelo_Vint )
給我留言說. 我總結得不對. 如果指定了 ikey 和okey. 是可以正确識别多條通道的.
原文為:" 添加key值參數就可以了。就像vxlan的vni一樣 "
第三部分.
我用兩台linux 測試了兩條gre通道的設定. 加上ikey和okey. 通信完全正常.
相關的設定和指令:
ip link del gre01
ip link del gre02
測試機A
ip link add gre01 type gre remote 192.168.122.16 local 192.168.122.1 ikey 1 okey 1
ip addr rep local 10.0.1.1 peer 10.0.1.2 dev gre01
ip link set gre01 up
ip link add gre02 type gre remote 192.168.122.16 local 192.168.122.1 ikey 2 okey 2
ip addr rep local 10.0.2.1 peer 10.0.2.2 dev gre02
ip link set gre02 up
測試機B
ip link add gre01 type gre remote 192.168.122.1 local 192.168.122.16 ikey 1 okey 1
ip addr rep local 10.0.1.2 peer 10.0.1.1 dev gre01
ip link set gre01 up
ip link add gre02 type gre remote 192.168.122.1 local 192.168.122.16 ikey 2 okey 2
ip addr rep local 10.0.2.2 peer 10.0.2.1 dev gre02
ip link set gre02 up
感謝:
非常感謝 Yelo_Vint 的指導. 十分感謝.