• 容器网络之网桥


    创建网桥

    # brctl addbr mhc

    绑定到物理网卡(网卡会失效)

    # brctl addif mhc enp3s0

    # ifconfig enp3s0 0.0.0.0

    给网桥配置一个ip (启用了)

    # ifconfig mhc 109.105.4.65

    # ifconfig

    docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        

      inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255        

      inet6 fe80::42:f1ff:fe10:e3bc  prefixlen 64  scopeid 0x20<link>        

      ether 02:42:f1:10:e3:bc  txqueuelen 0  (Ethernet)        

      RX packets 59506  bytes 3109306 (2.9 MiB)        

      RX errors 0  dropped 0  overruns 0  frame 0        

      TX packets 100421  bytes 169871693 (162.0 MiB)        

      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        

      inet6 fe80::d556:c0ae:b9f6:b958  prefixlen 64  scopeid 0x20<link>        

      ether dc:fe:07:d6:10:67  txqueuelen 1000  (Ethernet)        

      RX packets 59147107  bytes 6300109859 (5.8 GiB)        

      RX errors 0  dropped 0  overruns 0  frame 0        

      TX packets 2979383  bytes 617716890 (589.1 MiB)       

      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 1  (Local Loopback)        

      RX packets 144962  bytes 11750064 (11.2 MiB)        

      RX errors 0  dropped 0  overruns 0  frame 0        

      TX packets 144962  bytes 11750064 (11.2 MiB)        

      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    mhc: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        

      inet 109.105.4.65  netmask 255.0.0.0  broadcast 109.255.255.255        

      inet6 fe80::defe:7ff:fed6:1067  prefixlen 64  scopeid 0x20<link>       

      ether dc:fe:07:d6:10:67  txqueuelen 1000  (Ethernet)        

      RX packets 2089  bytes 113670 (111.0 KiB)        

      RX errors 0  dropped 0  overruns 0  frame 0        

      TX packets 147  bytes 13274 (12.9 KiB)        

      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    # brctl show
    bridge name bridge id  STP enabled interfaces
    docker0  8000.0242f110e3bc no  veth879059f
    mhc  8000.dcfe07d61067 no  enp3s0
    virbr0  8000.525400eae708 yes  virbr0-nic

    停用网桥(ifconfig 就看不见了)

    # ifconfig mhc down

    删除网桥

    # brctl delbr mhc

  • 相关阅读:
    IDEA 远程调试springboot
    Mybatitas-plus实现逻辑删除
    java通过poi导出excel
    js 展示当前时间
    Linux环境下服务自启
    Spring自带定时器@Scheduled
    Quartz任务调度框架相关方法、参数理解
    Quartz 实现定时任务
    mysql 使用union(all) + order by 导致排序失效
    mongodb的查询操作
  • 原文地址:https://www.cnblogs.com/mhc-fly/p/8970806.html
Copyright © 2020-2023  润新知