blob: 4856bf2fa74a9855bc1e7784eea0d02b7cf7de15 [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
Andrea Campanella362b7d32018-12-11 18:57:12 +010011ip netns exec $1 ifconfig $2 up
12ip netns exec $1 ifconfig $2.$3 up
Andrea Campanellaa85af8b2019-03-19 10:46:54 -070013ip netns exec $1 ifconfig $2.$3 $4