简体   繁体   English

apache2 Web代理服务器上的多个NIC

[英]Multiple NIC's on apache2 web proxy server

I have a question regarding traffic routing on a Linux machine with two NIC's. 我有一个关于带有两个NIC的Linux机器上的流量路由的问题。 One of the NIC's is on our DMZ net ( 10.1.9.0/24 ) and the other is on our local net ( 10.1.0.0./21 ): NIC之一在我们的DMZ网络( 10.1.9.0/24 )上,另一个在我们的本地网络( 10.1.0.0./21 )上:

default via `10.1.4.1` dev eth0 
default via `10.1.9.1` dev eth1  metric 100 
`10.1.0.0/21` dev eth0  proto kernel  scope link  src `10.1.0.132` 
`10.1.9.0/24` dev eth1  proto kernel  scope link  src `10.1.9.25` 

We use the server as web proxy. 我们使用服务器作为Web代理。 The dmz interface (eth1) gets traffic from one of our external internet addresses. dmz接口(eth1)从我们的外部Internet地址之一获取流量。 So there exists a NAT rule on our main Firewall/Router that translates requests to 10.1.9.25 . 因此,在我们的主防火墙/路由器上存在一个NAT规则,可将请求转换为10.1.9.25 This works fine, requests are accepted and responded. 这可以正常工作,请求被接受并得到响应。 In this situation the connection is established on eth1 and response is also on eth1. 在这种情况下,连接在eth1上建立,响应也在eth1上建立。

The problem: When we want to access the webserver from inside our local network the firewall translates the external ip to the DMZ ip. 问题:当我们要从本地网络内部访问Web服务器时,防火墙会将外部IP转换为DMZ IP。 Connections can be established to DMZ servers from within our local network, but not the other way around. 可以从本地网络中建立到DMZ服务器的连接,但不能相反。 In this case the connection is instantiated from the local net to DMZ, but the webserver dosn't respond. 在这种情况下,将从本地网络实例化到DMZ的连接,但Web服务器不响应。

sudo tcpdump -i eth1 port 443 and src host 10.1.1.154
10:09:35.626450 IP 10.1.1.154.48870 > 10.1.9.25.https: Flags [S], seq 2491947547, win 14600, options [mss 1460,sackOK,TS val 2066949 ecr 0,nop,wscale 4], length 0
10:09:35.825619 IP 10.1.1.154.48871 > 10.1.9.25.https: Flags [S], seq 1827990665, win 14600, options [mss 1460,sackOK,TS val 2067011 ecr 0,nop,wscale 4], length 0
10:09:36.575239 IP 10.1.1.154.48870 > 10.1.9.25.https: Flags [S], seq 2491947547, win 14600, options [mss 1460,sackOK,TS val 2067199 ecr 0,nop,wscale 4], length 0
10:09:36.823264 IP 10.1.1.154.48871 > 10.1.9.25.https: Flags [S], seq 1827990665, win 14600, options [mss 1460,sackOK,TS val 2067261 ecr 0,nop,wscale 4], length 0
10:09:38.579373 IP 10.1.1.154.48870 > 10.1.9.25.https: Flags [S], seq 2491947547, win 14600, options [mss 1460,sackOK,TS val 2067700 ecr 0,nop,wscale 4], length 0
10:09:38.827290 IP 10.1.1.154.48871 > 10.1.9.25.https: Flags [S], seq 1827990665, win 14600, options [mss 1460,sackOK,TS val 2067762 ecr 0,nop,wscale 4], length 0

SSH is the same, the interface recieves connections, but doesn't respond. SSH相同,接口可以接收连接,但是不响应。 I'm not sure exactly where the problem is (on the server or on the firewall/routersetup). 我不确定问题出在哪里(在服务器上还是在防火墙/路由器设置上)。 We have other servers on in the DMZ that works fine, and the sysadmin here says the network configuration is the same. 我们在DMZ中还有其他运行良好的服务器,并且sysadmin在这里说网络配置是相同的。

Can anyone help me diagnose this problem? 谁能帮我诊断这个问题?

Your problem is here 你的问题在这里

default via `10.1.4.1` dev eth0 
default via `10.1.9.1` dev eth1  metric 100 
`10.1.0.0/21` dev eth0  proto kernel  scope link  src `10.1.0.132` 
`10.1.9.0/24` dev eth1  proto kernel  scope link  src `10.1.9.25`

IP cannot use multiple default routes in the same routing table... think about it, if you ping 4.2.2.2 from the shell, which interface should it use? IP不能在同一路由表中使用多个默认路由...考虑一下,如果您从Shell ping 4.2.2.2,应该使用哪个接口?

The Linux Advanced Routing and Traffic Control Howto has some tricks you can use to implement multiple routing tables, but this is frequently making things more complicated than you will want to maintain. Linux Advanced Routing and Traffic Control Howto提供了一些技巧,可用于实现多个路由表,但这通常会使事情变得比您想要维护的更为复杂。

The simplest solution is to pick an interface where you can aggregate all internal corporate networks into one supernet and assign a route for it... for instance, this route covers all 10.xxx networks that are not directly connected to the linux machine... 最简单的解决方案是选择一个接口,您可以在其中将所有内部公司网络聚合到一个超网中并为其分配路由...例如,此路由涵盖了所有未直接连接到linux计算机的10.xxx网络。 。

route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.1.0.132

Then remove the default from eth0 然后从eth0删除默认值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM