我正在尝试连接一个web服务器A,与一个数据库服务器B,以便他们有尽可能少的延迟。这两台服务器运行Debian,都在同一个机架上,并通过第二个以太网端口上的电缆连接在一起。以下是/etc/网络/接口规范。
服务器A(前端)
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 11.22.33.5
netmask 255.255.255.248
network 11.22.33.3
broadcast 11.22.33.10
gateway 11.22.33.4
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 8.8.8.8
服务器B(后)
auto lo
iface lo inet loopback
auto eth0
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 11.22.77.8
netmask 255.255.255.248
network 11.22.77.6
broadcast 11.22.77.23
gateway 11.22.77.7
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 11.22.77.89
我想知道,为了使服务器A通过电缆直接与B通信,我应该对接口文件做什么更改(S)。谢谢
发布于 2012-10-08 18:06:55
确保IP地址位于同一个IP网络上.在你给的配置片段中,它们不是。
因此,一个有效的配置是:
# Server A
iface eth0 inet static
address 11.22.33.1
netmask 255.255.255.248
network 11.22.33.0
broadcast 11.22.33.7
# Server B
iface eth0 inet static
address 11.22.33.2
netmask 255.255.255.248
network 11.22.33.0
broadcast 11.22.33.7
了解IP网络、它们的大小以及网络掩码的工作原理。你给的配置片段一点意义都没有。network 11.22.33.3
不是网络(网络总是以偶数开始),而11.22.77.23
不是带有255.255.255.248
网络掩码的网络11.22.77.6
的广播地址。
发布于 2012-10-08 17:49:39
两者都不应该有网关集,因为没有路由正在进行。将两个接口配置为位于同一子网上。然后在这两台机器上创建一个持久的静态路由,该路由彼此指向并绑定到第二个接口。如果你不知道该怎么做的话,man route
应该帮你做这部分。
https://serverfault.com/questions/436071
复制相似问题