1
1
Although there are several articles discussing about the issue, I need some advice because I am still facing the problem.
I have 3 interfaces on a virtual machine (cents 6.6)
[root@localhost network-scripts]# ip addr list
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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:bf:6e:7b brd ff:ff:ff:ff:ff:ff
inet 192.168.1.140/24 brd 192.168.1.255 scope global eth0
inet6 fe80::20c:29ff:febf:6e7b/64 scope link_
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:bf:6e:85 brd ff:ff:ff:ff:ff:ff
inet 172.16.64.7/24 brd 172.16.64.255 scope global eth1
inet6 fe80::20c:29ff:febf:6e85/64 scope link_
valid_lft forever preferred_lft forever
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:bf:6e:8f brd ff:ff:ff:ff:ff:ff
inet 192.168.1.151/24 brd 192.168.1.255 scope global eth2
inet6 fe80::20c:29ff:febf:6e8f/64 scope link_
valid_lft forever preferred_lft forever
eth1 is used for management line. I want to assign 192.168.1.140 and 192.168.1.150 to eth0 and eth2 respectively. Since both eth0 and eth2 participate on a same subnet, I configured policy-based routing.
[root@localhost /]# cat /etc/sysconfig/network-scripts/route-eth0
192.168.1.0/24 dev eth0 src 192.168.1.140 table eth0
default via 192.168.1.1 dev eth0 table eth0
[root@localhost /]# cat /etc/sysconfig/network-scripts/route-eth2
192.168.1.0/24 dev eth2 src 192.168.1.151 table eth2
default via 192.168.1.1 dev eth2 table eth2
[root@localhost /]# cat /etc/sysconfig/network-scripts/rule-eth0
from 192.168.1.140 table eth0 priority 1000
[root@localhost /]# cat /etc/sysconfig/network-scripts/rule-eth2
from 192.168.1.151 table eth2 priority 1001
Then I setup the following parameter in /etc/sysctl.conf
net.ipv4.conf.all.arp_filter = 1
net.ipv4.conf.default.rp_filter = 0
Restarted the virtual machine in order to activate the changes in the kernel parameter and network configuration. The result in the routing table is the following.
[root@localhost /]# ip rule show
0: from all lookup local
1000: from 192.168.1.140 lookup eth0
1001: from 192.168.1.151 lookup eth2
32766: from all lookup main
32767: from all lookup default
[root@localhost /]# ip route show table eth0
192.168.1.0/24 dev eth0 scope link src 192.168.1.140
default via 192.168.1.1 dev eth0
[root@localhost /]# ip route show table eth2
192.168.1.0/24 dev eth2 scope link src 192.168.1.151
default via 192.168.1.1 dev eth2
The configuration looked fine but it is somehow impossible to ping to the Internet.
[root@localhost /]# ping -c 1 -I eth0 8.8.8.8_
PING 8.8.8.8 (8.8.8.8) from 192.168.1.140 eth0: 56(84) bytes of data.
From 192.168.1.140 icmp_seq=1 Destination Host Unreachable
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 3001ms
[root@localhost /]# ping -c 1 -I eth2 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from 192.168.1.151 eth2: 56(84) bytes of data.
From 192.168.1.151 icmp_seq=1 Destination Host Unreachable
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 3003ms
Any ideas?
are your VMs all set for NAT? – Ben Plont – 2014-11-17T13:51:37.253
No configuration for NAT – D Rivero – 2014-11-17T14:41:51.890
What's the host environment? – Ben Plont – 2014-11-17T21:56:32.497
This is a virtual machine of VMware Fusion 7 running on MacOSX. Both eth0 and eth2 on the VM are associated with the network interface on Mac which is recognized as en1. The IP address of en1 is assigned by DHCP. – D Rivero – 2014-11-18T04:49:25.240