我试图在Ubuntu 12.04上设置路由表。 networking环境如下:
server -----eth0 192.168.0.1 (DMZ)---LAN----10.13.xx
由于192.168.0.1与局域网之间的通信过于繁重,防火墙将会崩溃。 因此,我试图暂时和服务器的接口,以便我们可以绕过防火墙。 configuration如下。
---eth0 192.168.0.1(DMZ) | server-----eth1 10.13.0.1 (LAN)
当eth1启动时,局域网中的主机(10.13.xx)可以ping通eth1,但不能ping通eht0。 路由表如下
Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.0.254 0.0.0.0 UG 0 0 0 eth0 10.13.0.0 0.0.0.0 255.255.255.0 U 1 0 0 eth1 192.168.0.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
我如何设置路由表,使局域网中的主机可以同时连接eth0和eth1(IP地址为10.13.xx的主机可以ping通eth1和eth2)?
您需要在服务器中启用ip_forwarding。
你可以通过编辑/etc/sysctl.conf改变:
net.ipv4.ip_forward = 1