下面是详细的使用过程。首先我们先来创建一个新的网络命名空间 - net1。
# ip netns add net1
来查看一下它的 iptable、路由表、以及网络设备
# ip netns exec net1 route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
# ip netns exec net1 iptables -L
ip netns exec net1 iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
......
# ip netns exec net1 ip link list
lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00