基本上,我在同一个网络上有 2 个 NIC 的 Linux。第二个 NIC 除了 192.168.3.1 之外看不到任何东西
eno1 192.168.3.25
eno2 192.168.3.26
以下情况失败:
1. ping -I eno2 8.8.8.8 (或任何外部 IP)
2. ping -I eno1 192.168.3.26
3. ping -I eno2 192.168.3.25
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eno1
iface eno1 inet static
address 192.168.3.25
netmask 255.255.255.0
gateway 192.168.3.1
hwaddress ether 18:03:73:ec:81:c1
#eno2 is used for VM addresses. It should be assigned 192.168.3.26 automatically by dhcp
auto eno2
iface eno2 inet static
address 192.168.3.26
netmask 255.255.255.0
hwaddress ether 18:03:73:ec:81:c3
auto eno4
iface eno4 inet static
address 192.168.10.25
netmask 255.255.255.0
hwaddress ether 18:03:73:ec:81:c7
post-up ip route add default via 192.168.10.1 dev eno4 table dmz
post-up ip rule add from 192.168.10.0/24 table dmz
route -n显示
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.3.1 0.0.0.0 UG 0 0 0 eno1
192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eno2
192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eno1
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eno4
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
提前致谢。