> For the complete documentation index, see [llms.txt](https://gitbook.cdxiaodong.life/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.cdxiaodong.life/rong-qi-an-quan/tao-yi-ji-shu/host-networking-driver.md).

# 主机网络驱动

如果容器配置了Docker[主机网络驱动（--network=host）](https://docs.docker.com/network/host/)，则该容器的网络栈与Docker主机不隔离（容器共享主机的网络命名空间），并且容器不会获得分配给自己的IP地址。换句话说，容器将所有服务直接绑定到主机的IP。此外，容器可以拦截主机在共享接口`tcpdump -i eth0`上发送和接收的所有网络流量。

例如，您可以使用此功能嗅探甚至欺骗主机和元数据实例之间的流量。

参考资料：

* [技术分析：如何联系Google SRE：在云SQL中放置shell](https://offensi.com/2020/08/18/how-to-contact-google-sre-dropping-a-shell-in-cloud-sql/)
* [元数据服务MITM允许root权限提升（EKS / GKE）](https://blog.champtar.fr/Metadata_MITM_root_EKS_GKE/)
