linux - 如何强制用户应用程序使用特定路由表解析 "route lookup"

标签 linux network-programming

我明白了 A。可以使用“ip route ..... table”在 linux 中维护多个路由表 b.可以使用“ip rule add iif dev table”完成对从外部网络进入的数据包的转发决策

但是,如果我想让一个用户应用程序使用特定的路由表与外界通信,除了使用“ip netns”之外,我看不到一个简单的方法。

有没有办法告诉系统使用特定路由表的“查找路由”?

我的理解是“ip 规则”仅在生成数据包后应用,但用户应用程序甚至在生成数据包之前就查询路由表,以便可以发送网关的 ARP。

最佳答案

这个有点复杂。您应该熟悉 SELinux 标签和容器。 RedHat 状态的 Docker 文档:

by default, docker creates a virtual ethernet card for each container. each container has its own routing tables and iptables. in addition to this, when you ask for specific ports to be forwarded, docker creates certain host iptables rules for you. the docker daemon itself does some of the proxying. the takeaway here is that if you map applications to containers, you provide flexibility to yourself by limiting network access on a per-application basis.

关于linux - 如何强制用户应用程序使用特定路由表解析 "route lookup",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36163673/

相关文章:

linux - 暂停/禁用特定电子邮件帐户。 Linux whm cpanel

PHP 通过 exec 运行 linux "less"命令 - 二进制文件警告

c - Linux 中使用 C 的接口(interface)绑定(bind)(聚合)

c - 接收到的网络数据包中的内存对齐问题

linux - 如何使用可加载模块修改Linux网络堆栈?

linux - 无法创建备份文件(添加!覆盖)

c - 有没有一些带有C API的库可以画图?

android - 逻辑 : how to search a local network for a custom service

c - 使 recvfrom() 函数成为非阻塞的

c++ - 更新 glibc 后 std::tan() 非常慢