# 主机网络驱动

如果容器配置了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/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gitbook.cdxiaodong.life/rong-qi-an-quan/tao-yi-ji-shu/host-networking-driver.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
