ip netns {list | add delete | exec | identify | pids | monitor等}
ip [{-s | -v 等等}] link [ {add | delete | set | show} ] type [{bridge| bond | can | vcan | veth | vlan 等}]
創(chuàng)建 namespace: ip netns add [name]
在namespace中執(zhí)行: ip netns exec [name] command
查看namespace:ip netns list
創(chuàng)建虛擬網(wǎng)卡:ip link add XXX type veth peer name XXX
網(wǎng)卡加入namespace:ip link set [XXX] netns [name]
1)ip netns exec ns1 ip link show|list
2)ip netns exec ns1 ip link set dev tap1 down
3)ip netns exec ns1 ip address add 192.68.102.40/24 broadcast + dev tap1
4)ip netns exec ns1 ip link set dev tap1 up