Browse Source

Added an ifdown before adding an interface into a container

Dmitry Yu Okunev 6 years ago
parent
commit
143fbe2b4e
1 changed files with 2 additions and 1 deletions
  1. 2 1
      ipw

+ 2 - 1
ipw

@@ -650,7 +650,8 @@ case "$CMD" in
 					[[ "$CONTAINER_PID" == '' ]] &&
 						CONTAINER_PID=$(lxc-info -p -n "$CONTAINER" | awk '{ print $2 }')
 
-					ip link add name "$HNAME" type veth peer name ".c$GNAME"
+					ip link add name "$HNAME" type veth peer name ".c$GNAME" &&
+					lxc-attach -n "$CONTAINER" ifdown "$GNAME"
 					ip link set "$HNAME" up
 					ip link set ".c$GNAME" netns "$CONTAINER_PID"
 					lxc-attach -n "$CONTAINER" ip link set ".c$GNAME" name "$GNAME"