首页 > 其他 > 详细

容器网络专题(一)

时间:2020-07-08 21:41:45      阅读:73      评论:0      收藏:0      [点我收藏+]

本期重点 认识 

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!