I have some hard time with routing between two virtual interfaces. Here is the setup.
- 1 physical interface (eth0 192.168.1.51)
- 1 alias interface (eth0:1 192.168.10.1)
1 alias interface (eth0:2 192.168.20.1)
1 virtual machine with 1 interface (eth0 192.168.10.2)
- 1 virtual machine with 1 interface (eth0 192.168.20.2)
All I try to do is to route traffic between 192.168.20.0/24 and 192.168.10.0/24
For this purpose:
- on the 1st virtual machine, I add a default route to 192.168.10.1
- on the 2nd virtual machine, I add a default route to 192.168.20.1
On the physical machine I add routes (they are automatically added though) to the respective networks.
From virtual machine 1 I am able to ping 192.168.10.1 and 192.168.20.1, but not 192.168.20.2. Same thing from the second virtual machine -- I ping 192.168.10.1 and 20.1, but not 20.2)
The ip forwarding is activated : root@expire:~/.ovpn# sysctl -a | grep forward
net.ipv4.conf.all.forwarding = 1 net.ipv4.conf.all.mc_forwarding = 0 net.ipv4.conf.default.forwarding = 1 net.ipv4.conf.default.mc_forwarding = 0 net.ipv4.conf.docker0.forwarding = 1 net.ipv4.conf.docker0.mc_forwarding = 0 net.ipv4.conf.eth0.forwarding = 1 net.ipv4.conf.eth0.mc_forwarding = 0 net.ipv4.conf.lo.forwarding = 1 net.ipv4.conf.lo.mc_forwarding = 0 net.ipv4.conf.tun0.forwarding = 1 net.ipv4.conf.tun0.mc_forwarding = 0 net.ipv4.conf.wlan0.forwarding = 1 net.ipv4.conf.wlan0.mc_forwarding = 0 net.ipv4.ip_forward = 1
Do anyone has some hints about how to proceed.
PS. I would like not to use iptables
edit: eth0:1 and eth0:2 are alias interfaces and not virtual interfaces. Thanks Tero Kilkanen