alf*_*ish -3 networking linux-networking
我正在尝试将 Web 服务器 A 与数据库服务器 B 连接起来,以便尽可能减少延迟。两台服务器都运行 Debian,位于同一个机架上,并通过第二个以太网端口上的电缆连接在一起。这是 /etc/network/interfaces 规范。
服务器 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
Run Code Online (Sandbox Code Playgroud)
服务器 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
Run Code Online (Sandbox Code Playgroud)
我想知道我应该对接口文件进行哪些更改才能使服务器 A 通过电缆直接与 B 通信。谢谢
确保 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
Run Code Online (Sandbox Code Playgroud)
了解 IP 网络、它们的大小以及网络掩码的工作原理。您提供的配置剪辑根本没有任何意义。network 11.22.33.3不是网络(网络总是以偶数开头)并且11.22.77.23
不是网络11.22.77.6掩码为的网络的广播地址255.255.255.248。
两者都不应该设置网关,因为没有路由正在进行。将两个接口配置为位于同一子网上。然后在两台机器上创建一个持久的静态路由,它们相互指向并绑定到第二个接口。man route如果您不确定如何做,应该可以帮助您完成这部分。
| 归档时间: |
|
| 查看次数: |
1604 次 |
| 最近记录: |