blob: 17ce5239c8845353a84f45cb71a08927554a909a [file] [log] [blame]
Andrea Campanella362b7d32018-12-11 18:57:12 +01001#!/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
8ip netns add $1
9ip link set dev $2 netns $1
10ip netns exec $1 ip link add link $2 name $2.$3 type vlan id $3
11ip netns exec $1 ifconfig $2.$3 $4
12ip netns exec $1 ifconfig $2 up
13ip netns exec $1 ifconfig $2.$3 up