> 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/)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
