Andrea Campanella | 362b7d3 | 2018-12-11 18:57:12 +0100 | [diff] [blame] | 1 | #!/bin/bash |
2 | # first argument is name of name-space | ||||
3 | # second argument is name of interface to assign | ||||
4 | # third argument is vlan | ||||
5 | # fourth argument is IP to assing to interface | ||||
6 | |||||
7 | |||||
8 | ip netns add $1 | ||||
9 | ip link set dev $2 netns $1 | ||||
10 | ip netns exec $1 ip link add link $2 name $2.$3 type vlan id $3 | ||||
11 | ip netns exec $1 ifconfig $2.$3 $4 | ||||
12 | ip netns exec $1 ifconfig $2 up | ||||
13 | ip netns exec $1 ifconfig $2.$3 up |