我有一个运行SNMP池的Debian机器,但我遇到了一个问题,让池使用特定的接口。
Debian机器有3个接口
allow-hotplug eth0 iface eth0 inet static address 10.1.1.3 netmask 255.255.255.0 gateway 10.1.1.1 dns-nameservers 10.1.1.6 allow-hotplug eth1 iface eth1 inet static address 10.1.1.7 netmask 255.255.255.0 allow-hotplug eth2 iface eth2 inet static address 10.1.1.8 netmask 255.255.255.0
在本机尝试从中获取SNMP信息的客户端机器上,它将允许来自10.1.1.3的SNMP请求,但由于某种原因,当Debian发送请求时,其使用10.1.1.7(eth1)。 我也注意到,当我从Debian机器ping客户端(10.1.1.5)时,Wireshark说ICMP数据包来自10.1.1.7。 为什么不使用列表中的第一个接口(10.1.1.3)?
路线:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 10.1.1.1 0.0.0.0 UG 0 0 0 eth0 localnet * 255.255.255.0 U 0 0 0 eth1 localnet * 255.255.255.0 U 0 0 0 eth0 localnet * 255.255.255.0 U 0 0 0 eth2
其他说明:
正如迈克尔·汉普顿在OP的评论中提到的那样,我调整了我的接口文件以使用多个IP的单个接口。
这里是更新的接口:
allow-hotplug eth0 iface eth0 inet static address 10.1.1.3 netmask 255.255.255.0 gateway 10.1.1.1 dns-nameservers 10.1.1.6 allow-hotplug eth1 iface eth0:0 inet static address 10.1.1.7 netmask 255.255.255.0 allow-hotplug eth2 iface eth0:0 inet static address 10.1.1.8 netmask 255.255.255.0
现在它从第一个主地址发送请求。