ip netns {list | add delete | exec | identify | pids | monitor等}
ip [{-s | -v 等等}] link [ {add | delete | set | show} ] type [{bridge| bond | can | vcan | veth | vlan 等}]
-
创建 namespace: ip netns add [name]
-
在namespace中执行: ip netns exec [name] command
-
查看namespace:ip netns list
-
创建虚拟网卡:ip link add XXX type veth peer name XXX
-
网卡加入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
网友评论