linux – 将传出流量绑定到eth0而不是eth0:1
发布时间:2020-12-30 21:37:57 所属栏目:Linux 来源:网络整理
导读:我们在 linux(debian)机器上添加了第二个IP-Adress,以便为新的Apache vhost实现第二个SSL证书. 我们的ifconfig现在看起来像这样: eth0 Link encap:Ethernet Hardware Adresse 00:0c:29:1b:ab:6c inet Adresse:999.999.999.39 Bcast:999.999.999.63 Maske:25
我们在 linux(debian)机器上添加了第二个IP-Adress,以便为新的Apache vhost实现第二个SSL证书. 我们的ifconfig现在看起来像这样: eth0 Link encap:Ethernet Hardware Adresse 00:0c:29:1b:ab:6c inet Adresse:999.999.999.39 Bcast:999.999.999.63 Maske:255.255.255.192 inet6-Adresse: (...)/64 Gültigkeitsbereich:Verbindung UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1 RX packets:219336884 errors:0 dropped:0 overruns:0 frame:0 TX packets:223169420 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenl?nge:1000 RX bytes:1971307659 (1.8 GiB) TX bytes:713489565 (680.4 MiB) eth0:1 Link encap:Ethernet Hardware Adresse (...) inet Adresse:999.999.999.40 Bcast:999.999.999.63 Maske:255.255.255.192 UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1 问题:所有传出流量(MySQL连接到外部数据库服务器,来自后缀的传出SMTP连接)现在似乎通??过eth0:1,因此第二个(新)IP 999.999.999.40. 我们如何通过eth0,IP-adress 999.999.999.39强制所有传出流量离开? 路线输出: [n1 ~ #] route Kernel-IP-Routentabelle Ziel Router Genmask Flags Metric Ref Use Iface localnet * 255.255.255.192 U 0 0 0 eth0 10.10.10.0 * 255.255.255.0 U 0 0 0 eth1 default gateway4.XXX 0.0.0.0 UG 0 0 0 eth0 default gateway4.XXX 0.0.0.0 UG 0 0 0 eth0 找到解决方案 谢谢你的提示,ip route是要走的路,现在它按照需要工作. ip rule add from 999.999.999.39 table t1 ip rule add from 999.999.999.40 table t2 ip route del default via 999.999.999.1 ip route add default 999.999.999.1 dev eth0 table t1 ip route flush cache 解决方法我想你必须使用 route命令告诉系统如何路由数据包.就像是 : route add -net APACHE_VHOST_IP netmask 255.255.255.0 dev eth0:1 强制APACHE_VHOST_IP目的地的数据包使用eth0:1接口. 和 route add -net MYSQL_SERVER_IP netmask 255.255.255.0 dev eth0 强制MYSQL_SERVER_IP目标中的数据包使用eth0接口. (编辑:威海站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |