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 |
Andrea Campanella | 362b7d3 | 2018-12-11 18:57:12 +0100 | [diff] [blame] | 11 | ip netns exec $1 ifconfig $2 up |
| 12 | ip netns exec $1 ifconfig $2.$3 up |
Andrea Campanella | a85af8b | 2019-03-19 10:46:54 -0700 | [diff] [blame] | 13 | ip netns exec $1 ifconfig $2.$3 $4 |