本期重点 认识
veth - Virtual Ethernet Device
The veth devices are virtual Ethernet devices. They can act as tunnels between network namespaces to create a bridge to a physical network device in another namespace, but can also be used as standalone network devices.
像隧道一样连接 不同的 netns 。隧道中不会对数据包进行修改
自内核3.8以后 linux 定义了6大命名空间
UTS 主机和域名
IPC 信号量、消息队列和共享内容
PID 进程编号
network 网络设备、网络栈、端口等
mount 挂载点(文件系统)
user 用户和用户组
clone() setns() unshare() 三个 系统函数定义了 命名空间三个基础操作
veth 与其中 network ns 紧密相关
ip link add veth0 type veth peer name veth1 ip link list ip link set dev veth0 up ip link set dev veth1 up ifconfig ifconfig veth0 172.13.0.1/24 ifconfig ip netns add song ip link set veth1 netns song ifconfig
原文:https://www.cnblogs.com/leleyao/p/13268962.html