33 lines
1.0 KiB
Bash
Executable File
33 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
NETNS_NAME=$1
|
|
if [ -z $NETNS_NAME ]
|
|
then
|
|
echo "NETNS_NAME is empty"
|
|
exit 1
|
|
fi
|
|
|
|
ns=$NETNS_NAME
|
|
case $script_type in
|
|
up)
|
|
#ip netns add $ns
|
|
#ip netns exec $ns ip link set dev lo up
|
|
ip link set dev "$2" up netns $ns mtu "$3"
|
|
ip netns exec $ns ip addr add dev "$2" \
|
|
"$5/${ifconfig_netmask:-30}" \
|
|
${ifconfig_broadcast:+broadcast "$ifconfig_broadcast"}
|
|
if [ -n "$ifconfig_ipv6_local" ]; then
|
|
ip netns exec $ns ip addr add dev "$2" \
|
|
"$ifconfig_ipv6_local"/112
|
|
fi
|
|
;;
|
|
route-up)
|
|
ip netns exec $ns ip route add default via "$route_vpn_gateway"
|
|
if [ -n "$ifconfig_ipv6_remote" ]; then
|
|
ip netns exec $ns ip route add default via \
|
|
"$ifconfig_ipv6_remote"
|
|
fi
|
|
;;
|
|
down)
|
|
;;
|
|
esac
|