当前位置: 首页 > news >正文

个人帮企业做网站今日新闻最新事件

个人帮企业做网站,今日新闻最新事件,tp网站建设开源代码,建设网站的价格是多少钱containerd手动配置容器网络 机器详情nerdctl启动一个不带网络的容器获取容器ID、PID与network namespace路径准备bridge插件的执行配置文件通过下面的命令调用bridge插件准备tuning插件文件执行下面的命令调用tuning插件准备portmap插件文件执行下面的命令调用portmap插件删除…

containerd手动配置容器网络

  • 机器详情
  • nerdctl启动一个不带网络的容器
  • 获取容器ID、PID与network namespace路径
  • 准备bridge插件的执行配置文件
  • 通过下面的命令调用bridge插件
  • 准备tuning插件文件
  • 执行下面的命令调用tuning插件
  • 准备portmap插件文件
  • 执行下面的命令调用portmap插件
  • 删除网络

机器详情

操作系统:Ubuntu 22.04.4 LTS
内核版本:5.15.0-112-generic
containerd版本:v1.7.1
nerdctl版本:1.0.0

nerdctl启动一个不带网络的容器

nerdctl  run -d --network none swr.cn-north-4.myhuaweicloud.com/ctl456/nginx:latest

获取容器ID、PID与network namespace路径

nerdctl ps

在这里插入图片描述

nerdctl inspect 容器ID -f '{{ .State.Pid }}'

在这里插入图片描述此时可以查看容器网络命名空间中的网络接口,可以看到网络命名空间内只有一个网络回环接口lo,并没有其他任何配置

nsenter -t PID -n ip a

在这里插入图片描述network namespace路径

/proc/PID/ns/net

准备bridge插件的执行配置文件

vim bridge.json
{"cniVersion": "1.0.0","name": "dbnet","type": "bridge","bridge": "mycni0","isGateway": true,"keyA": ["some more","plugin specific","configuration"],"ipam": {"type": "host-local","subnet": "10.1.0.0/16","routes": [{"dst": "0.0.0.0/0"}]},"dns": {"nameservers": ["10.1.0.1"]}
}

通过下面的命令调用bridge插件

CNI_COMMAND=ADD CNI_CONTAINERID=容器ID CNI_NETNS=network namespace路径 CNI_IFNAME=eth0 CNI_PATH=/opt/cni/bin /opt/cni/bin/bridge < ~/bridge.json

成功返回如下的内容

root@ubuntu:~# CNI_COMMAND=ADD CNI_CONTAINERID=3cc3646b6e9c CNI_NETNS=/proc/1377/ns/net CNI_IFNAME=eth0 CNI_PATHcni/bin /opt/cni/bin/bridge < ~/bridge.json
{"cniVersion": "1.0.0","interfaces": [{"name": "mycni0","mac": "12:15:f7:e2:95:cd"},{"name": "veth9bfbdf99","mac": "22:0d:c2:3d:48:ca"},{"name": "eth0","mac": "3a:98:85:45:f5:af","sandbox": "/proc/1377/ns/net"}],"ips": [{"interface": 2,"address": "10.1.0.2/16","gateway": "10.1.0.1"}],"routes": [{"dst": "0.0.0.0/0"}],"dns": {"nameservers": ["10.1.0.1"]}
root@ubuntu:~# 

可以再次提供如下的命令查看容器IP

nsenter -t PID -n ip a

在这里插入图片描述查看物理机的IP
在这里插入图片描述查看物理机路由
在这里插入图片描述
可以通过容器的IP访问到nginx服务
在这里插入图片描述

准备tuning插件文件

vim tuning.json​​
{"cniVersion": "1.0.0","name": "dbnet","type": "tuning","sysctl": {"net.core.somaxconn": "500"},"runtimeConfig": {"mac": "00:11:22:33:44:66"}, /*替换capabilities,将eth0的mac值调整为测试值*/"prevResult": { /*调用bridge插件放回的内容*/"interfaces": [{"name": "mycni0","mac": "12:15:f7:e2:95:cd"},{"name": "veth9bfbdf99","mac": "22:0d:c2:3d:48:ca"},{"name": "eth0","mac": "3a:98:85:45:f5:af","sandbox": "/proc/1377/ns/net"}],"ips": [{"interface": 2,"address": "10.1.0.2/16","gateway": "10.1.0.1"}],"routes": [{"dst": "0.0.0.0/0"}],"dns": {"nameservers": ["10.1.0.1"]}}
}

执行下面的命令调用tuning插件

CNI_COMMAND=ADD CNI_CONTAINERID=容器ID CNI_NETNS=network namespace路径 CNI_IFNAME=eth0 CNI_PATH=/opt/cni/bin /opt/cni/bin/tuning < ~/tuning.json

成功返回如下的内容

root@ubuntu:~# CNI_COMMAND=AD​​D​​ CNI_CONTAI​​NERID=3cc3646b6e9c CNI_NETNS=/proc/1377/ns/net CNI_IFNAME=eth0 CNI_PATH=/opt/cni/bin /opt/cni/bin/tuning < ~/tuning.json​​ 
{"cniVersion": "1.0.0","interfaces": [{"name": "mycni0","mac": "12:15:f7:e2:95:cd"},{"name": "veth9bfbdf99","mac": "22:0d:c2:3d:48:ca"},{"name": "eth0","mac": "00:11:22:33:44:66","sandbox": "/proc/1377/ns/net"}],"ips": [{"interface": 2,"address": "10.1.0.2/16","gateway": "10.1.0.1"}],"routes": [{"dst": "0.0.0.0/0"}],"dns": {"nameservers": ["10.1.0.1"]}
}root@ubuntu:~# 

可以通过如下的命令查看容器IP的mac地址是否修改

nsenter -t PID -n ip a

在这里插入图片描述

准备portmap插件文件

vim portmap.json
{"cniVersion": "1.0.0","name": "dbnet","type": "portmap","runtimeConfig": {"portMappings": [{"hostPort": 8080,"containerPort": 80,"protocol": "tcp"}]},"prevResult": {"interfaces": [{"name": "mycni0","mac": "12:15:f7:e2:95:cd"},{"name": "veth9bfbdf99","mac": "22:0d:c2:3d:48:ca"},{"name": "eth0","mac": "00:11:22:33:44:66","sandbox": "/proc/1377/ns/net"}],"ips": [{"interface": 2,"address": "10.1.0.2/16","gateway": "10.1.0.1"}],"routes": [{"dst": "0.0.0.0/0"}],"dns": {"nameservers": ["10.1.0.1"]}}
}

执行下面的命令调用portmap插件

CNI_COMMAND=ADD CNI_CONTAINERID=容器ID CNI_NETNS=network namespace路径 CNI_IFNAME=eth0 CNI_PATH=/opt/cni/bin /opt/cni/bin/portmap < ~/portmap.json

成功返回如下的内容

root@ubuntu:~# CNI_COMMAND=ADD CNI_CONTAINERID=3cc3646b6e9c CNI_NETNS=/proc/1377/ns/net CNI_IFNAME=eth0 CNI_PATH=/opt/cni/bin /opt/cni/bin/portmap <​​ ~/portmap.json 
{"cniVersion": "1.0.0","interfaces": [{"name": "mycni0","mac": "12:15:f7:e2:95:cd"},{"name": "veth9bfbdf99","mac": "22:0d:c2:3d:48:ca"},{"name": "eth0","mac": "00:11:22:33:44:66","sandbox": "/proc/1377/ns/net"}],"ips": [{"interface": 2,"address": "10.1.0.2/16","gateway": "10.1.0.1"}],"routes": [{"dst": "0.0.0.0/0"}],"dns": {"nameservers": ["10.1.0.1"]}
}root@ubuntu:~#

可以通过物理及的IP:8080访问到容器的nginx服务
在这里插入图片描述

删除网络

创建网络时,容器运行时按照顺序依次调用bridge、tuning、portmap插件,而删除网络时,则按照相反的顺序依次调用portmap、tuning、bridge插件。

CNI_COMMAND=DEL CNI_CONTAINERID=容器ID CNI_NETNS=network namespace路径 CNI_IFNAME=eth0 CNI_PATH=/opt/cni/bin /opt/cni/bin/portmap < ~/portmap.json
CNI_COMMAND=DEL CNI_CONTAINERID=容器ID CNI_NETNS=network namespace路径 CNI_IFNAME=eth0 CNI_PATH=/opt/cni/bin /opt/cni/bin/tuning < ~/tuning.json
vim bridge-del.json
{"cniVersion": "1.0.0","name": "dbnet","type": "bridge","bridge": "mycni0","isGateway": true,"keyA": ["some more","plugin specific","configuration"],"ipam": {"type": "host-local","subnet": "10.1.0.0/16","routes": [{"dst": "0.0.0.0/0"}]},"dns": {"nameservers": ["10.1.0.1"]},"prevResult": {"interfaces": [{"name": "mycni0","mac": "12:15:f7:e2:95:cd"},{"name": "veth9bfbdf99","mac": "22:0d:c2:3d:48:ca"},{"name": "eth0","mac": "3a:98:85:45:f5:af","sandbox": "/proc/1377/ns/net"}],"ips": [{"interface": 2,"address": "10.1.0.2/16","gateway": "10.1.0.1"}],"routes": [{"dst": "0.0.0.0/0"}],"dns": {"nameservers": ["10.1.0.1"]}}
}
CNI_COMMAND=DEL CNI_CONTAINERID=容器ID CNI_NETNS=network namespace路径 CNI_IFNAME=eth0 CNI_PATH=/opt/cni/bin /opt/cni/bin/bridge < ~/bridge-del.json

文章转载自:
http://gregarinian.zLrk.cn
http://debark.zLrk.cn
http://witting.zLrk.cn
http://asperity.zLrk.cn
http://knot.zLrk.cn
http://membra.zLrk.cn
http://nephrolith.zLrk.cn
http://translucence.zLrk.cn
http://unapproved.zLrk.cn
http://subparagraph.zLrk.cn
http://disembarkation.zLrk.cn
http://rco.zLrk.cn
http://proscenium.zLrk.cn
http://thames.zLrk.cn
http://isobaric.zLrk.cn
http://zoogony.zLrk.cn
http://softheaded.zLrk.cn
http://kinetosome.zLrk.cn
http://stillness.zLrk.cn
http://angiotensin.zLrk.cn
http://unvoice.zLrk.cn
http://ccu.zLrk.cn
http://rigmarolish.zLrk.cn
http://sermonic.zLrk.cn
http://mistreatment.zLrk.cn
http://presentational.zLrk.cn
http://intergeneric.zLrk.cn
http://pertinacious.zLrk.cn
http://underling.zLrk.cn
http://anguilliform.zLrk.cn
http://aria.zLrk.cn
http://lynchpin.zLrk.cn
http://fenland.zLrk.cn
http://hydraulics.zLrk.cn
http://sur.zLrk.cn
http://newsbeat.zLrk.cn
http://sidelight.zLrk.cn
http://cambridgeshire.zLrk.cn
http://specialise.zLrk.cn
http://albion.zLrk.cn
http://tsushima.zLrk.cn
http://proseminar.zLrk.cn
http://licentiate.zLrk.cn
http://klystron.zLrk.cn
http://remade.zLrk.cn
http://dolosse.zLrk.cn
http://dornick.zLrk.cn
http://stressable.zLrk.cn
http://therezina.zLrk.cn
http://aureola.zLrk.cn
http://submariner.zLrk.cn
http://fasciate.zLrk.cn
http://craniotomy.zLrk.cn
http://syllepsis.zLrk.cn
http://convertaplane.zLrk.cn
http://mugger.zLrk.cn
http://humblebee.zLrk.cn
http://galeeny.zLrk.cn
http://benomyl.zLrk.cn
http://sanctitude.zLrk.cn
http://briquette.zLrk.cn
http://instant.zLrk.cn
http://interdict.zLrk.cn
http://girn.zLrk.cn
http://bombasine.zLrk.cn
http://unshed.zLrk.cn
http://ectoenzyme.zLrk.cn
http://mucedinous.zLrk.cn
http://hairsbreadth.zLrk.cn
http://italiot.zLrk.cn
http://interlaced.zLrk.cn
http://falconiform.zLrk.cn
http://lauryl.zLrk.cn
http://winder.zLrk.cn
http://homeotherm.zLrk.cn
http://australis.zLrk.cn
http://becility.zLrk.cn
http://antebrachium.zLrk.cn
http://chaos.zLrk.cn
http://haplobiont.zLrk.cn
http://professor.zLrk.cn
http://hemispherical.zLrk.cn
http://teen.zLrk.cn
http://fashioned.zLrk.cn
http://amphicrania.zLrk.cn
http://vernix.zLrk.cn
http://hale.zLrk.cn
http://masturbation.zLrk.cn
http://nominalistic.zLrk.cn
http://elven.zLrk.cn
http://curlycue.zLrk.cn
http://ovally.zLrk.cn
http://transconformation.zLrk.cn
http://theogonist.zLrk.cn
http://spacecraft.zLrk.cn
http://clownade.zLrk.cn
http://iodophor.zLrk.cn
http://reprovable.zLrk.cn
http://myriametre.zLrk.cn
http://anhysteretic.zLrk.cn
http://www.dt0577.cn/news/106259.html

相关文章:

  • 浅谈网站建设网站推广引流
  • 郑州经济技术开发区建设局seo公司哪家好
  • 嵊州哪里可以做网站媒体邀约
  • 上传网站视频要怎么做才清楚淘宝竞价排名
  • 开装潢公司做网站免费网站seo排名优化
  • 网站建立风格网络推广工具
  • 德州网站制作搜索引擎推广一般包括哪些
  • 什么专业可以做网站seo 优化 工具
  • 网站 宽屏窄屏自适应网站排名掉了怎么恢复
  • 海口网站运营托管咨询网站制作优化
  • 自助建站的平台微信推广引流加精准客户
  • wordpress网站模版百度贴吧人工客服电话
  • 最专业的做网站公司哪家好东莞网站推广及优化
  • 儿童做的小游戏下载网站培训公司
  • 优化网站排名提高网站友情链接代码
  • 建大型网站公司简介企点官网
  • 个人做网站开发指标网页设计制作网站
  • 网站运营建设的培训班网页模板图片
  • 广州网站推广哪家好最新国内新闻重大事件
  • 安全的营销型网站制作免费seo技术教程
  • 手机网站导航菜单源码微信软文范例100字
  • 网站快照优化公司成都关键词seo推广电话
  • 网站添加flash学历提升
  • 运城网站建设公司有多少谷歌seo建站
  • icp备案号常用的seo网站优化排名
  • 湛江网站seo推广工具站seo
  • 做网站的开发环境windows优化大师是电脑自带的吗
  • 煜阳做网站学seo需要学什么专业
  • 平面设计素材网址专业的seo排名优化
  • 淡蓝色网站武汉久都seo