当前位置:   article > 正文

模拟docker桥接网络

模拟docker桥接网络


本篇文章模拟docker桥接网络的搭建,以加深对其网络模型的理解.涉及到的知识:iptables,linux bridge,veth pair,linux namespace,unshare,nsenter等.

一.搭建图

在这里插入图片描述

二.创建网桥

1.安装brctl命令

yum install bridge-utils -y
  • 1

2.创建网桥并设置ip

#创建网桥 命名为br01
brctl addif br01
#网桥设置ip网段
ip addr add 172.20.0.1/16 dev br0
#启动网桥
ip link set br0 up
#使用ifconfig命令验证如下
[root@localhost ~]# ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.20.0.1  netmask 255.255.0.0  broadcast 0.0.0.0
        inet6 fe80::a4c9:9fff:fe86:ab97  prefixlen 64  scopeid 0x20<link>
        ether a6:c9:9f:86:ab:97  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14  bytes 1172 (1.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.101  netmask 255.255.255.0  broadcast 192.168.100.255
        inet6 fe80::ba99:d1d7:2105:baf7  prefixlen 64  scopeid 0x20<link>
        inet6 fe80::ef4c:a887:b784:7528  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:b6:88:5e  txqueuelen 1000  (Ethernet)
        RX packets 4189  bytes 348799 (340.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3067  bytes 367986 (359.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 40  bytes 3520 (3.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/990684
推荐阅读
相关标签
  

闽ICP备14008679号