# 强的, 只有一个loop设备, 状态害是DOWN呢, loop设备DOWN了会怎样?
$ ip link list # 检查网络设备
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN
# 太强了, 这世界上有人ping自己都ping不通, 果然是强者的世界
$ ping localhost
connect: Network is unreachable
# 给我起!
$ ip link set dev lo up
# 可以了嘿嘿
$ ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.014 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.032 ms
$ ip link add veth0 \ # 创建一个名为veth0的设备
type veth \ # 类型为veth设备
peer name veth1 # 对端名称为veth1
$ ip link set veth1 \ # 设置一下veth1这一头
netns xiaohan # 放到xiaohan的命名空间里
$ ifconfig veth0 10.1.1.1/24 up # veth0 一个IP
$ ip netns exec xiaohan bash # 然后进入命名空间
$ ifconfig veth1 10.1.1.2/24 up # veth1 也一个IP
$ ping 10.1.1.2 # 两个veth开始聊天...
64 bytes from 10.1.1.2: icmp_seq=1 ttl=64 time=0.022 ms
64 bytes from 10.1.1.2: icmp_seq=2 ttl=64 time=0.030 ms
int clone(
void* child_func,
void* child_stack,
void* child_args,
int flags,
)