blob: 4856bf2fa74a9855bc1e7784eea0d02b7cf7de15 [file] [log] [blame]
#!/bin/bash
# first argument is name of name-space
# second argument is name of interface to assign
# third argument is vlan
# fourth argument is IP to assing to interface
ip netns add $1
ip link set dev $2 netns $1
ip netns exec $1 ip link add link $2 name $2.$3 type vlan id $3
ip netns exec $1 ifconfig $2 up
ip netns exec $1 ifconfig $2.$3 up
ip netns exec $1 ifconfig $2.$3 $4