首页 > 编程语言 >route_localnet decides whether a loopback-hosting server can server requests outside of the node

route_localnet decides whether a loopback-hosting server can server requests outside of the node

时间:2024-06-10 17:54:33浏览次数:30  
标签:node localnet loopback ip route destination server

Background

When I was following the RAG example promptflow-resource-hub to trace my application through a promtflow server hosted on the loopback interface, as the local env is a virtual machine on Azure, and after I add NSG rule to allow the requests to 23333 port to the virtual machine and add an iptables rule to DNAT the tcp requests to port 2333 to localhost:2333, the trace server is still unreachable from browser. After some investigations without success, stackoverflow gave the answer to enable route_localnet by this thread.

Explanations

Let's take Linux v6.9.3 for example, per the following code in function ip_rcv, function ip_rcv_finish will be called after NF_INET_PRE_ROUTING, which will finally call ip_route_input_slow for routing decision defined in route.c

	return NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING,
		       net, NULL, skb, dev, NULL,
		       ip_rcv_finish);

This snippet of code at the beginning of ip_route_input_slow checks when the destination is loopback IP address, and the route_localnet is turned off, the code will skip the normal route and goto martian_destination. martian destination represents the destination is not on the Earth, but an invalid or non-existing one.

	/* Following code try to avoid calling IN_DEV_NET_ROUTE_LOCALNET(),
	 * and call it once if daddr or/and saddr are loopback addresses
	 */
	if (ipv4_is_loopback(daddr)) {
		if (!IN_DEV_NET_ROUTE_LOCALNET(in_dev, net))
			goto martian_destination;
	} else if (ipv4_is_loopback(saddr)) {
		if (!IN_DEV_NET_ROUTE_LOCALNET(in_dev, net))
			goto martian_source;
	}

标签:node,localnet,loopback,ip,route,destination,server
From: https://www.cnblogs.com/haoqingchuan/p/18240855

相关文章

  • Serverless部署应用并使用Cloudflare加速和支持HTTPS
    ServerlessServerless是一种云计算模型,它使开发人员能够构建和运行应用程序,而无需关心底层的服务器基础设施。在传统的应用程序开发中,开发人员需要管理服务器的配置、扩展和维护等任务。而在Serverless模型中,这些任务都由云服务提供商来处理,开发人员只需专注于编写应用程序的......
  • 在Linux中,什么是 inode ?
    在Linux中,inode(索引节点)是一个重要的文件系统概念,它用于描述文件系统中的文件和目录的元数据信息。以下是关于inode的详细解释:定义:inode是Linux文件系统中用于存储文件和目录元数据信息的数据结构。每个文件和目录在文件系统中都有一个唯一的inode与之关联。组成信息:inod......
  • SQL Server Management Studio (SSMS) 20.1 - 微软数据库管理工具
    SQLServerManagementStudio(SSMS)20.1-微软数据库管理工具请访问原文链接:https://sysin.org/blog/ssms/,查看最新版。原创作品,转载请保留出处。作者主页:sysin.org笔者注:SQLServer2014及之前版本内置SQLServerManagementStudio(SSMS),SQLServer2016及以后版本......
  • SQL Server 2022 RTM 最新累积更新:Cumulative Update #13 for SQL Server 2022 RTM
    SQLServer2022RTM(最新累积更新)-基于Azure的持续性能和安全创新CumulativeUpdate#13forSQLServer2022RTM请访问原文链接:https://sysin.org/blog/sql-server-2022/,查看最新版。原创作品,转载请保留出处。作者主页:sysin.orgSQLServer2022现已普遍可用2022......
  • VUE + nodejs实战
    BVDN搭建D:cdnodejs::npminstallbootstrap::npminstalljquery::npminstallpopper.js::npminstallvuenpminstallvue-routerpauseapp.html<!DOCTYPEhtml><!DOCTYPEhtml><html><head> <!--bootstrap--> <linkrel=......
  • 视野修炼-技术周刊第87期 | Nodejs 15 周年
    欢迎来到第87期的【视野修炼-技术周刊】,下面是本期的精选内容简介......
  • Idea运行前端项目--配置node配置
    1.idea中配置node.js的路径2.右键点击前端项目package.json-->ShownpmScript右键dev或serve-->Edit'dev'Settings3.右键项目根目录-->openin-->terminal-->执行命令npmi4.最后运行即可......
  • Mac 安装 Node Error: Could not symlink include/node/common.gypi
    根据提示,赋权限,删除文件等jimmy@MacBook-Pro~%brewlinknodeLinking/usr/local/Cellar/node/20.0.0...Error:Couldnotsymlinkinclude/node/common.gypiTarget/usr/local/include/node/common.gypialreadyexists.Youmaywanttoremove......
  • 通过 Docker 启动的 .NET Core 解决方案无法找到本地 Microsoft SQL Server
    我遇到的问题是,当我使用Docker启动.NETCore项目时,无法找到在本地(而不是作为容器)运行的MicrosoftSQLServer。SwaggerUI的响应如下所示。TypeError:NetworkErrorwhenattemptingtofetchresource.这是我的连接。这是我的连接字符串......
  • Java SpringBoot 如何使用 IdentityServer4 作为验证服务器学习笔记
    作者:https://www.cnblogs.com/BeautifulBoy1301/p/11193488.html https://github.com/Danni-Ke/SpringBootDemo  JavaSpringBoot如何使用IdentityServer4作为验证服务器学习笔记 这边记录下如何使用IdentityServer4作为JavaSpringBoot的认证服务器和令牌颁......