我正在尝试通过 Netplan 配置在 Ubuntu 18.04 LTS 中建立 IPIP 隧道。
我设法使用下列 ip 命令建立了从服务器 A 到服务器 B 的路由隧道:
85.ll.ll.ll 是服务器 A
85.rr.rr.rr 是服务器 B
ip tunnel add tunnel-to-b mode ipip remote 85.rr.rr.rr local 85.ll.ll.ll
ip link set tunnel-to-b up
ip addr add 10.0.0.18/24 dev tunnel-to-b
ip route add 10.0.0.0/8 dev tunnel-to-b
ip route add 172.16.0.0/12 dev tunnel-to-b
ip route add 192.168.0.0/16 dev tunnel-to-b
但我喜欢用 Netplan 配置
并尝试过
network:
version: 2
renderer: networkd
ethernets:
ens7:
addresses:
- 10.6.170.1/24
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
search: [private.local]
optional: false
ens8:
dhcp4: yes
dhcp6: yes
gateway4: 85.ll.ll.1
tunnels:
tunnel-to-b:
mode: ipip
addresses:
- 10.0.0.0/8
local: 85.ll.ll.ll
remote: 85.rr.r.rr
mtu: 1480
routes:
- to: 10.0.0.0/8
via: tunnel-to-b
我收到以下错误信息:
/etc/netplan/01-netcfg.yaml:27:8: Error in network definition: expected sequence
to: 10.0.0.0/8
^
问题是如何使用 Netplan 设置带有路由的隧道?