module-tinc/templates/tinc-up.erb
2014-12-28 13:30:11 +01:00

16 lines
753 B
Text

#!/bin/sh
grep <%= @real_tinc_bridge_interface %> /proc/net/dev | awk -F: '{ print $1 }' | grep -q <%= @real_tinc_bridge_interface %>
if [ $? -gt 0 ]; then
brctl addbr <%= @real_tinc_bridge_interface %>
ip addr delete <%= @real_tinc_internal_ip %>/<%= @real_tinc_internal_netmask %> <%= @tinc_internal_interface %>
ip addr add <%= @real_tinc_internal_ip %>/<%= @real_tinc_internal_netmask %> <%= @real_tinc_bridge_interface %>
brctl addif <%= @real_tinc_bridge_interface %> <%= @tinc_internal_interface %>
ip link set dev <%= @tinc_internal_interface %> up
fi
brctl addif <%= @real_tinc_bridge_interface %> $INTERFACE
ip link set dev $INTERFACE up
<% if @override_mtu -%>
ip link set dev $INTERFACE mtu <%= @override_mtu.to_i %>
<% end -%>