为多个NICconfigurationiproute2并进行validation

为了避免为具有多个NIC的CentOS 6服务器分离路由,我正在configurationiproute2,以便将源自特定NIC(VLAN)的stream量仅通过该NIC而不是在服务器的eth0上设置的默认路由返回。 这就是现在的样子。

ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 00:50:56:9b:1c:1d brd ff:ff:ff:ff:ff:ff inet 10.2.130.206/24 brd 10.2.130.255 scope global eth3 inet6 fe80::250:56ff:fe9b:1c1d/64 scope link valid_lft forever preferred_lft forever 3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 00:50:56:9b:6c:b3 brd ff:ff:ff:ff:ff:ff inet 10.2.220.206/24 brd 10.2.220.255 scope global eth0 inet6 fe80::250:56ff:fe9b:6cb3/64 scope link valid_lft forever preferred_lft forever 4: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 00:50:56:9b:4b:b1 brd ff:ff:ff:ff:ff:ff inet 10.2.120.206/24 brd 10.2.120.255 scope global eth1 inet6 fe80::250:56ff:fe9b:4bb1/64 scope link valid_lft forever preferred_lft forever 5: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 00:50:56:9b:4b:14 brd ff:ff:ff:ff:ff:ff inet 10.2.100.206/24 brd 10.2.100.255 scope global eth2 inet6 fe80::250:56ff:fe9b:4b14/64 scope link valid_lft forever preferred_lft forever 

ip路由

 10.2.130.0/24 dev eth3 proto kernel scope link src 10.2.130.206 10.2.100.0/24 dev eth2 proto kernel scope link src 10.2.100.206 10.2.220.0/24 dev eth0 proto kernel scope link src 10.2.220.206 10.2.120.0/24 dev eth1 proto kernel scope link src 10.2.120.206 169.254.0.0/16 dev eth3 scope link metric 1002 169.254.0.0/16 dev eth0 scope link metric 1003 169.254.0.0/16 dev eth1 scope link metric 1004 169.254.0.0/16 dev eth2 scope link metric 1005 default via 10.2.220.1 dev eth0 

ip规则

 0: from all lookup local 32762: from 10.2.130.0/24 lookup development 32763: from 10.2.100.0/24 lookup protected 32764: from 10.2.120.0/24 lookup external 32765: from 10.2.220.0/24 lookup management 32766: from all lookup main 32767: from all lookup default 

现在一切“似乎”都按预期工作,但是我怎样才能真正validation这一点呢?

我怎么实际validation这一点

运行tcpdump / wireshark,使用-i interface一个特定的接口,并使用任何你喜欢的工具生成一些应该通过特定接口的stream量。 Netcat到tcp服务可能是一个不错的select。 确保你看到连接的所有东西,用tcp,确保你看到三方握手的两个方向,连接的所有数据包都closures。