如何通过CentOS Overlay实现高效网络配置优化?
- 内容介绍
- 文章标签
- 相关推荐
⚠️ 提示一下:如输出格式显示异常请刷新页面查看渲染结果。
在公司级分布式部署中,很多运维同学都曾因传统桥接网络无法跨主机通信{% ended %}而浪费大量时间排查IP冲突和路由问题;Overlay网络正是为了解决这一难题而生。若不了解其原理和优势直接上手配置很容易陷入“隧道建立失败”“流量被防火墙拦截”等死胡同。其实,
-
: 基于 VXLAN 隧道封装技术确保数据在跨主机传输过程中的完整性与加密安全。
- : 支持千级容器规模部署满足公司级集群需求轻松应对业务爆发。
- : 能够穿透不同物理环境和云网站提供统一虚拟交换抽象层大幅降低迁移成本。
如果还没有 Docker 基础环境请先完成安装否则后续命令将无法执行;建议先检查程序内核版本是否≥。
p> bash sudo yum install-y yum-utils device-mapper-persistent-data lvm sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo yum install-y docker-ce docker-ce-cli sudo systemctl start docker &&&sudu systemctl enable docker p 若提示 GPG Key 不匹配请自行导入官方公钥后再尝试安装以免卡住半天。
p> bash sudo cat
p> bash sudo docker network create --driver overlay --subnet=10.xx.xx.xxx/xx my-overlay-network
p> bash # 主机A 上启动并进入交互 bash sudo docker run-d --name cA --network my-overlay-network nginx bash sudo exec-it cA sh # 在容器内执行 ping 测试 bash ping cB # 若提示 name unknown 检查 DNS 或添加 /etc/hosts 指向对方 IP即可成功回复.
h6 h6 sysctl-w net.core.somaxconn=4096 h6 sysctl-w net.ipv4.ip_forward=1 h6 setenforce permissive 或修改 /etc/selinux/config 永久生效>
- - 参考 RedHat/CentOS official docs 配合 nftables 时记得也要添加相应 chain rule
hr />
h5
h5 假设两台物理服务器分别为 MasterNode 和 WorkerNode 每台均已按上述步骤完成 docker + overlay 配置。不过,h5 在 MasterNode 上执行:
bash
docker run-d \ name cA \ image nginx \ network my-overlay-network
ifconfig cA | grep inet
shows ip like 10.xx.xx.xxx.
h5 在 WorkerNode 上同等操作:
bash
docker run-d \ name cB \ image nginx \ my-overlay-network
ifconfig cB | grep inet shows different subnet address yet仍可成功ping通。docker exec-it cA ping cB
if receives reply packets说明跨主机通信完全就绪。endcase-study">
endcase-study"> endcase-study">
endcase-study">
endcase-study">
endcase-study">
endcase-study";endcase-study">
endcase-study";contenteditable false;contenteditable false;不过,contenteditable false;contenteditable false;body bgproperties fixed;font-size medium;line-height 1;margin-top padding-left margin-right margin-bottom none none none none;padding-top padding-right padding-bottom none none none none;font-family inherit;font-style normal;font-weight normal;text-decoration none solid transparent currentcolor;color black,background-color white;border-style none;outline-style none;
text-align start;list-style-type disc;list-style-position outside;cursor auto,resize neir;margin-top auto;margin-bottom auto;width auto,老实说,max-width percent;min-width min-content;话说回来,padding-inline-start percent;text-align start;caret-color color;user-select all;match opacity match mixins match breakpoints match gradients match shadows match currentColor match fuc.
margin-top margin-left margin-right margin-bottom padding-block-start padding-inline-start css properties.
color currentColor!important,background-image url;background-repeat repeat scroll;background-attachment scroll;话说回来,background-position center center;flex-flow column nowrap wrap flex-wrap flex-direction flex-basis align-content justify-content align-items gap.
border-radius percent percent percent percent border-width border-style border-color inherit.
background-color initial background-image initial background-repeat initial background-attachment initial background-position initial clip-path initial clip rect inset initial clip-path initial.
outline-offset outline outset thick thin double dashed dotted groove ridge inset outset inherit.
outline-color currentColor outline-offset transparent visible hidden.
text-shadow color blur spread.
text-decoration-line underline overline through blink underline-color underline-style underline-width.
text-transform capitalize lowercase capitalizenone.
letters spacing word-spacing letter-spacing.
border-image-source slice width outset repeat space round.
border-image-slice slice.
border-image-width width.
border-image-outset outset.
border-image-repeat repeat round space.
fill fill rule fill opacity fill rule.
filter blur brightness contrast saturate hue rotate opacity sepia invert brightness contrast grayscale sepia invert.
mix-blend-mode blend mode blend mode blend mode blend mode blend mode blend mode blend mode blend mode.
isolation isolation isolation isolation isolation isolation isolation isolation isolation isolation.
display display display display display inline-block inline-table list-item table table-row table-cell table-caption collapse flex flex-start flex-end flex-center flex-娱乐ween flex-around flex-space-娱乐ween align-self align-baseline align-middle align-end justify-self justify-items justify-content order float clearfix size-adjust baseline-shift visibility overflow-x overflow-y clip direction unicode-bidi directionality resize cursor box-sizing border-border-box border-border-box border-border-box border-border-box box-sizing box-sizing box-sizing box-sizing box-sizing box-sizing overflow visible hidden collapse show scroll auto no-display no-visibility collapse break-inside avoid page-break-inside page-break-after page-break-before widows windows hyphens keep-all image-rendering optimizeSpeed interpolationMode font-optical-sizing font-kerning font-language-override hyphens word-break tab-size hyphenate-character drop-shadow filter mask reference orientation shape-outside backdrop-filter backdrop-filter backdrop-filter backdrop-filter backdrop-filter backdrop-filter backdrop-filter backdrop-filter backdrop-filter backdrop-filter perspective perspective perspective perspective perspective perspective perspective perspective perspective perspective perspective perspective Perspective perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectivas perspectives perspectives perspectives perspectives perspectives perspectives perspectives perspectives perspectives perspectives perspectives perspektif perspektif perspektif perspektif perspektif.perspective-webkit.perspective-webkit.perspective-webkit.perspective-webkit.perspective-webkit.perspective-webkit.perspective-webkit.picking glitches glitches glitches glitches glitches glitches glitches glitches glitches glitches.glitched.glitched.glitched.glitched.glitched.glitched.glitched.glitched.glitched.glitchedupper.triangle.triangle.triangle.triangle.triangle.triangle.triangle.left.triangletop.right.left.left.right.top.bottom.right.bottom.bottom.corner.corner.corner.corner.corner.corner.border-corner.border-corner.border-corner.border-corner.border-corner.border-corner.border-radius.rounded.rounded corners.rounded.rounded corners.rounded corners rounded-rounded corners-rounded corner rounding.radius cornerRadius cornerradius radius.Rounded rectangle.Rectangle Rectangle rectangle.Rectangle rectangle.rectangle.Rectangle.rectangle.Round rectangle rounded corners rounded-rounded corner rounding.radius cornerRadius cornerradius radius.Rounded rectangle.Rectangle Rectangle rectangle.rectangle.Rectangle.rectangle.Round rectangle rounded corners rounded-rounded corner rounding.radius cornerRadius cornerradius radius.Rounded rectangle.Rectangle Rectangle rectangle.rectangle.Rectangle.rectangle.Round rectangle rounded corners rounded-rounded corner rounding.radius cornerRadius cornerradius radius.Rounded rectangle.RectangularRectangle RectangleRectangle rectangles rectangles rectanglesrectanglesrectanglesrectanglesrectanglesrectangles rectangularrectangularrectangular rectangles rectanglesrectangularRectangularRectangularRectangleRectangleRectangleRectangleRectangleRectangleRRRCRectanglesRectanglesRectanglesRRRRRRRrrrrrrrrrrt.TTTTTTTTTrrrrrrrrrs.SSSSSSSSssssssssss.NNNNNNNNnnnnnnnnn.MMMMMMMMmmmmmmmmm.LLLLLLLLlllllllll.KKKKKKKkkkkkkkkk.JJJJJJJjjjjjjjjj.IIIIIIIIIIiiiiiiiiii.HHHHHHHHhhhhhhhh.GGGGGGGGggggggggg.FFFFFFFFFfbbbbbbbbaaaaaaaaZZZZZZZZzzzzzzzzYYYYYYYYyyyyyyyyXXXXXXXXxxxxwwwwwwwwvvvvvvvvUUUUUUUuuddddddddTttttttttrrrrrrrrqpppppppoooooooonnnnnnnnmmmmmmmmllllllllkkkkkkkkjjjjjjjiihhhhhiiiiggghhhhttthhhheeeyyyyyyYeeeeeexxxxwwwvvvvuuuuttsssrreeeeddcccccchhhhaaaaZZZZZzzzzeeeeeeewwwwwwwwvvvvvvvaaannnnnddddcccccccctttttttaaaaasssssssZzzzzzzzYYYYyyyyxxxxxxxxWWWWWWWWWvvvvvvvaaaaaaaaannnnnneeeeeerrrrrreeeesssshhhhooooottttpprrrooooxxxxwyyyyrrrrreeeellllyyyyyssshhoooouuuttttpprrrooooxxxxyyyyzzzzzzzaaawwwwwwwnnneeeeemmrriiitttuupppttrrsstteeelllldddddeeeeffffffffgggggghhhiiiijjjjjkklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdedef ghijklmnopqrstu vwxyzaa.bbccddeeffgghhiijjkkllmnooppqqrrssttuuvvwwxxYYYY.ZZ..?.,.?.,.?.,.?.,.?.,.?.,.?.,.?
.,.?
,,!@#$%^&*_+{}|\;老实说,:'",./<>?`-=
body bgproperties fixed font-size medium line-height 1 margin-top padding-left margin-right margin-bottom none-none-none-none padding-top padding-right padding-bottom font-family inherit font-style normal font-weight normal text-decoration:none solid transparent currentcolor color black background-color white border-style:none outline-style:none text-align start list-style-type disc list-style-position outside cursor-auto resize-neir margin-top auto margin-bottom auto width-auto max-width-percent min-width-min-content padding-inline-start percent-text-align start caret-color-user-select all-match opacity mixins breakpoints gradients shadows currentColor.match.match.match.match.match.flex-flow column nowrap wrap flex-wrap flex-direction flex-basis align-content justify-content align-items gap border-radius percent percent percent percent border-width border-style border-color inherit background-color initial background-image initial background-repeat initial background-attacinitial clip-path inicial clip rect inset inicial.clip-path inicial.background.color.initial.background.image.initial.background-repeat.initial.background-attacinitial.background-position.initial.clip-path.initial.background.color.init背景预设仅供参考实际呈现以浏览器渲染结果为准
⚠️ 提示一下:如输出格式显示异常请刷新页面查看渲染结果。
在公司级分布式部署中,很多运维同学都曾因传统桥接网络无法跨主机通信{% ended %}而浪费大量时间排查IP冲突和路由问题;Overlay网络正是为了解决这一难题而生。若不了解其原理和优势直接上手配置很容易陷入“隧道建立失败”“流量被防火墙拦截”等死胡同。其实,
-
: 基于 VXLAN 隧道封装技术确保数据在跨主机传输过程中的完整性与加密安全。
- : 支持千级容器规模部署满足公司级集群需求轻松应对业务爆发。
- : 能够穿透不同物理环境和云网站提供统一虚拟交换抽象层大幅降低迁移成本。
如果还没有 Docker 基础环境请先完成安装否则后续命令将无法执行;建议先检查程序内核版本是否≥。
p> bash sudo yum install-y yum-utils device-mapper-persistent-data lvm sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo yum install-y docker-ce docker-ce-cli sudo systemctl start docker &&&sudu systemctl enable docker p 若提示 GPG Key 不匹配请自行导入官方公钥后再尝试安装以免卡住半天。
p> bash sudo cat
p> bash sudo docker network create --driver overlay --subnet=10.xx.xx.xxx/xx my-overlay-network
p> bash # 主机A 上启动并进入交互 bash sudo docker run-d --name cA --network my-overlay-network nginx bash sudo exec-it cA sh # 在容器内执行 ping 测试 bash ping cB # 若提示 name unknown 检查 DNS 或添加 /etc/hosts 指向对方 IP即可成功回复.
h6 h6 sysctl-w net.core.somaxconn=4096 h6 sysctl-w net.ipv4.ip_forward=1 h6 setenforce permissive 或修改 /etc/selinux/config 永久生效>
- - 参考 RedHat/CentOS official docs 配合 nftables 时记得也要添加相应 chain rule
hr />
h5
h5 假设两台物理服务器分别为 MasterNode 和 WorkerNode 每台均已按上述步骤完成 docker + overlay 配置。不过,h5 在 MasterNode 上执行:
bash
docker run-d \ name cA \ image nginx \ network my-overlay-network
ifconfig cA | grep inet
shows ip like 10.xx.xx.xxx.
h5 在 WorkerNode 上同等操作:
bash
docker run-d \ name cB \ image nginx \ my-overlay-network
ifconfig cB | grep inet shows different subnet address yet仍可成功ping通。docker exec-it cA ping cB
if receives reply packets说明跨主机通信完全就绪。endcase-study">
endcase-study"> endcase-study">
endcase-study">
endcase-study">
endcase-study">
endcase-study";endcase-study">
endcase-study";contenteditable false;contenteditable false;不过,contenteditable false;contenteditable false;body bgproperties fixed;font-size medium;line-height 1;margin-top padding-left margin-right margin-bottom none none none none;padding-top padding-right padding-bottom none none none none;font-family inherit;font-style normal;font-weight normal;text-decoration none solid transparent currentcolor;color black,background-color white;border-style none;outline-style none;
text-align start;list-style-type disc;list-style-position outside;cursor auto,resize neir;margin-top auto;margin-bottom auto;width auto,老实说,max-width percent;min-width min-content;话说回来,padding-inline-start percent;text-align start;caret-color color;user-select all;match opacity match mixins match breakpoints match gradients match shadows match currentColor match fuc.
margin-top margin-left margin-right margin-bottom padding-block-start padding-inline-start css properties.
color currentColor!important,background-image url;background-repeat repeat scroll;background-attachment scroll;话说回来,background-position center center;flex-flow column nowrap wrap flex-wrap flex-direction flex-basis align-content justify-content align-items gap.
border-radius percent percent percent percent border-width border-style border-color inherit.
background-color initial background-image initial background-repeat initial background-attachment initial background-position initial clip-path initial clip rect inset initial clip-path initial.
outline-offset outline outset thick thin double dashed dotted groove ridge inset outset inherit.
outline-color currentColor outline-offset transparent visible hidden.
text-shadow color blur spread.
text-decoration-line underline overline through blink underline-color underline-style underline-width.
text-transform capitalize lowercase capitalizenone.
letters spacing word-spacing letter-spacing.
border-image-source slice width outset repeat space round.
border-image-slice slice.
border-image-width width.
border-image-outset outset.
border-image-repeat repeat round space.
fill fill rule fill opacity fill rule.
filter blur brightness contrast saturate hue rotate opacity sepia invert brightness contrast grayscale sepia invert.
mix-blend-mode blend mode blend mode blend mode blend mode blend mode blend mode blend mode blend mode.
isolation isolation isolation isolation isolation isolation isolation isolation isolation isolation.
display display display display display inline-block inline-table list-item table table-row table-cell table-caption collapse flex flex-start flex-end flex-center flex-娱乐ween flex-around flex-space-娱乐ween align-self align-baseline align-middle align-end justify-self justify-items justify-content order float clearfix size-adjust baseline-shift visibility overflow-x overflow-y clip direction unicode-bidi directionality resize cursor box-sizing border-border-box border-border-box border-border-box border-border-box box-sizing box-sizing box-sizing box-sizing box-sizing box-sizing overflow visible hidden collapse show scroll auto no-display no-visibility collapse break-inside avoid page-break-inside page-break-after page-break-before widows windows hyphens keep-all image-rendering optimizeSpeed interpolationMode font-optical-sizing font-kerning font-language-override hyphens word-break tab-size hyphenate-character drop-shadow filter mask reference orientation shape-outside backdrop-filter backdrop-filter backdrop-filter backdrop-filter backdrop-filter backdrop-filter backdrop-filter backdrop-filter backdrop-filter backdrop-filter perspective perspective perspective perspective perspective perspective perspective perspective perspective perspective perspective perspective Perspective perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectiva perspectivas perspectives perspectives perspectives perspectives perspectives perspectives perspectives perspectives perspectives perspectives perspectives perspektif perspektif perspektif perspektif perspektif.perspective-webkit.perspective-webkit.perspective-webkit.perspective-webkit.perspective-webkit.perspective-webkit.perspective-webkit.picking glitches glitches glitches glitches glitches glitches glitches glitches glitches glitches.glitched.glitched.glitched.glitched.glitched.glitched.glitched.glitched.glitched.glitchedupper.triangle.triangle.triangle.triangle.triangle.triangle.triangle.left.triangletop.right.left.left.right.top.bottom.right.bottom.bottom.corner.corner.corner.corner.corner.corner.border-corner.border-corner.border-corner.border-corner.border-corner.border-corner.border-radius.rounded.rounded corners.rounded.rounded corners.rounded corners rounded-rounded corners-rounded corner rounding.radius cornerRadius cornerradius radius.Rounded rectangle.Rectangle Rectangle rectangle.Rectangle rectangle.rectangle.Rectangle.rectangle.Round rectangle rounded corners rounded-rounded corner rounding.radius cornerRadius cornerradius radius.Rounded rectangle.Rectangle Rectangle rectangle.rectangle.Rectangle.rectangle.Round rectangle rounded corners rounded-rounded corner rounding.radius cornerRadius cornerradius radius.Rounded rectangle.Rectangle Rectangle rectangle.rectangle.Rectangle.rectangle.Round rectangle rounded corners rounded-rounded corner rounding.radius cornerRadius cornerradius radius.Rounded rectangle.RectangularRectangle RectangleRectangle rectangles rectangles rectanglesrectanglesrectanglesrectanglesrectanglesrectangles rectangularrectangularrectangular rectangles rectanglesrectangularRectangularRectangularRectangleRectangleRectangleRectangleRectangleRectangleRRRCRectanglesRectanglesRectanglesRRRRRRRrrrrrrrrrrt.TTTTTTTTTrrrrrrrrrs.SSSSSSSSssssssssss.NNNNNNNNnnnnnnnnn.MMMMMMMMmmmmmmmmm.LLLLLLLLlllllllll.KKKKKKKkkkkkkkkk.JJJJJJJjjjjjjjjj.IIIIIIIIIIiiiiiiiiii.HHHHHHHHhhhhhhhh.GGGGGGGGggggggggg.FFFFFFFFFfbbbbbbbbaaaaaaaaZZZZZZZZzzzzzzzzYYYYYYYYyyyyyyyyXXXXXXXXxxxxwwwwwwwwvvvvvvvvUUUUUUUuuddddddddTttttttttrrrrrrrrqpppppppoooooooonnnnnnnnmmmmmmmmllllllllkkkkkkkkjjjjjjjiihhhhhiiiiggghhhhttthhhheeeyyyyyyYeeeeeexxxxwwwvvvvuuuuttsssrreeeeddcccccchhhhaaaaZZZZZzzzzeeeeeeewwwwwwwwvvvvvvvaaannnnnddddcccccccctttttttaaaaasssssssZzzzzzzzYYYYyyyyxxxxxxxxWWWWWWWWWvvvvvvvaaaaaaaaannnnnneeeeeerrrrrreeeesssshhhhooooottttpprrrooooxxxxwyyyyrrrrreeeellllyyyyyssshhoooouuuttttpprrrooooxxxxyyyyzzzzzzzaaawwwwwwwnnneeeeemmrriiitttuupppttrrsstteeelllldddddeeeeffffffffgggggghhhiiiijjjjjkklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdedef ghijklmnopqrstu vwxyzaa.bbccddeeffgghhiijjkkllmnooppqqrrssttuuvvwwxxYYYY.ZZ..?.,.?.,.?.,.?.,.?.,.?.,.?.,.?
.,.?
,,!@#$%^&*_+{}|\;老实说,:'",./<>?`-=
body bgproperties fixed font-size medium line-height 1 margin-top padding-left margin-right margin-bottom none-none-none-none padding-top padding-right padding-bottom font-family inherit font-style normal font-weight normal text-decoration:none solid transparent currentcolor color black background-color white border-style:none outline-style:none text-align start list-style-type disc list-style-position outside cursor-auto resize-neir margin-top auto margin-bottom auto width-auto max-width-percent min-width-min-content padding-inline-start percent-text-align start caret-color-user-select all-match opacity mixins breakpoints gradients shadows currentColor.match.match.match.match.match.flex-flow column nowrap wrap flex-wrap flex-direction flex-basis align-content justify-content align-items gap border-radius percent percent percent percent border-width border-style border-color inherit background-color initial background-image initial background-repeat initial background-attacinitial clip-path inicial clip rect inset inicial.clip-path inicial.background.color.initial.background.image.initial.background-repeat.initial.background-attacinitial.background-position.initial.clip-path.initial.background.color.init背景预设仅供参考实际呈现以浏览器渲染结果为准
