I am trying to set up two virtual networks(different subnets) to test site to site VPN in my Laptop. My host OS is Debian Wheezy and i am using Virtual box to virtualise my setup. I have two aliased private IP addresses on my host NIC along with a public IP address assigned from ISP provider. Below is my interface file.
# The loopback network interface auto lo iface lo inet loopback # The primary network interface allow-hotplug eth0 iface eth0 inet dhcp auto eth0:1 iface eth0:1 inet static address 192.168.1.1 netmask 255.255.255.0 auto eth0:2 iface eth0:2 inet static address 192.168.2.1 netmask 255.255.255.0
Output of command "ip a"(only the relevant parts)
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 00:1b:38:99:c3:22 brd ff:ff:ff:ff:ff:ff inet 192.168.1.1/24 brd 192.168.1.255 scope global eth0:1 inet 192.168.2.1/24 brd 192.168.2.255 scope global eth0:2 inet 10.26.136.50/19 brd 10.26.159.255 scope global eth0 inet6 fe80::21b:38ff:fe99:c322/64 scope link valid_lft forever preferred_lft forever
Output of command "ip r"
default via 10.26.128.1 dev eth0 10.26.128.0/19 dev eth0 proto kernel scope link src 10.26.136.50 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.1 192.168.2.0/24 dev eth0 proto kernel scope link src 192.168.2.1 192.168.56.0/24 dev vboxnet0 proto kernel scope link src 192.168.56.1 192.168.57.0/24 dev vboxnet1 proto kernel scope link src 192.168.57.1 192.168.58.0/24 dev vboxnet2 proto kernel scope link src 192.168.58.1
Now i have two VM's bridged to eth0 of host. VM Ip address details.
VM1 --- IP Address --> 192.168.1.10 VM2 --- IP Address --> 192.168.2.10
I can ping both the VM's from the host. Even i can access internet from both the VM's as i have a iptables MASQUERADE rule and ip forwarding enabled on the host.
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sandy@sdebby:~$ sudo iptables -t nat -nvL POSTROUTING Chain POSTROUTING (policy ACCEPT 47 packets, 2928 bytes) pkts bytes target prot opt in out source destination 1629 103K MASQUERADE all -- * eth0 0.0.0.0/0 0.0.0.0/0 sandy@sdebby:~$ sudo sysctl -p net.ipv4.ip_forward = 1
But i can't ping one VM from the other and vice versa. All firewall rules are disabled on the VM's. When i do a tcpdump on the outer interface of the VM, i can see its receiving only icmp echo requests but not replying back. Below is the tcpdump output.
Tcpdump on VM1(192.168.1.10) while pinging from VM2(192.168.2.10)
[Expert@fw1-gw1]# tcpdump -ni eth0 host 192.168.2.10 tcpdump: listening on eth0 12:13:29.435073 192.168.2.10 > 192.168.1.10: icmp: echo request (DF) 12:13:30.461966 192.168.2.10 > 192.168.1.10: icmp: echo request (DF) 12:13:31.511685 192.168.2.10 > 192.168.1.10: icmp: echo request (DF)
Tcpdump on VM2(192.168.2.10) while pinging from VM1(192.168.1.10)
[Expert@fw1-gw2]# tcpdump -ni eth0 host 192.168.1.10 tcpdump: listening on eth0 12:15:55.228300 192.168.1.10 > 192.168.2.10: icmp: echo request (DF) 12:15:56.270639 192.168.1.10 > 192.168.2.10: icmp: echo request (DF) 12:15:57.295431 192.168.1.10 > 192.168.2.10: icmp: echo request (DF)
I have checked each VM can reach till the gateway of the other VM but not beyond that. So, i am suspecting that my routes are not working although they seems to be proper to me.
Do you see anything that i am missing? Any help will be highly appreciated.