我有一个gentoo负载平衡器和gentoo真实服务器之间的ldirectord /心跳HA设置。 由于我的主机的限制,我有通过ipip隧道负载平衡工作。
我在gentoo真实服务器上有以下设置:
(附加到…)/etc/conf.d/net结尾
iptunnel_tunl0="mode ipip" config_tunl0=( "xxx.xxx.xxx.xxx netmask 255.255.255.255" "yyy.yyy.yyy.yyy netmask 255.255.255.255" "zzz.zzz.zzz.zzz netmask 255.255.255.255" )
那些xxx / yyy / zzz是我的共享IP地址。
'ip address show'产生这个:
4: tunl0: <NOARP,UP,LOWER_UP> mtu 1480 qdisc noqueue state UNKNOWN link/ipip 0.0.0.0 brd 0.0.0.0 inet xxx.xxx.xxx.xxx/32 scope global tunl0 inet yyy.yyy.yyy.yyy/32 scope global tunl0:1 inet zzz.zzz.zzz.zzz/32 scope global tunl0:2
这一切工作正常。
我现在试图build立ipip隧道到Ubuntu真正的服务器。
我可以使用以下界面来显示界面:
ip tunnel add tunl0 mode ipip
然后通过将其添加到/ etc / network / interfaces来为其添加IP地址
auto tunl0 iface tunl0 inet static address xxx.xxx.xxx.xxx netmask 255.255.255.255
然后我的“ip地址显示”命令显示在gentoo机器上相同
问题是,ip tunnel add ..不会在重新启动时持续存在,所以下次联网尝试加载时,我们会得到这个结果
# /etc/init.d/networking restart * Reconfiguring network interfaces... ssh stop/waiting ssh start/running, process 2442 ssh stop/waiting ssh start/running, process 2482 SIOCSIFADDR: No such device tunl0: ERROR while getting interface flags: No such device SIOCSIFNETMASK: No such device tunl0: ERROR while getting interface flags: No such device Failed to bring up tunl0. ...done.
我如何使Gentoo中的隧道接口保持原样?
有两种方法来处理这个问题。 如果你所需要的只是一个简单的命令,最简单的方法是在/ etc / network / interfaces中为你的条目添加pre-up和后pre-down :
auto tunl0 iface tunl0 inet static pre-up ip tunnel add tunl0 mode ipip post-down ip tunnel del tunl0 mode ipip address xxx.xxx.xxx.xxx netmask 255.255.255.255
另外,如果你想做更复杂的事情,你可以添加脚本到启动之前运行的/etc/network/if-pre-up.d/和/etc/network/if-post-down.d/ ,closures后,networking分别。
五年来,事情已经走过了很长的一段路。 行属于(/ etc / network / interfaces)
有关更多详细信息,请参见man 5 intefaces 。
# Choose your own name for your tunnel interface (example uses 'mytun') auto mytun iface mytun inet tunnel mode ipip # Best I can tell, value of 'netmask' does nothing but is required: netmask 255.255.255.255 # Local address (inside tunnel) (required) address 192.168.1.1 # dstaddr = remote address (inside tunnel) dstaddr 192.168.2.2 # local = address of tunnel interface local xxxx # endpoint = destination ip applied to ipip encapsulated packets (required) endpoint yyyy # You may want to also consider using these two options # mtu 1480 # ttl 63