linux - VM can't ping host that's two switches and a router away through NAT -


i have linux vm (kali) that's connected host switch

eth0: flags=4163<up,broadcast,running,multicast>  mtu 1500     inet 192.168.0.40  netmask 255.255.255.0  broadcast 192.168.0.255 

the interface up, interfaces file looks this

auto eth0 iface eth0 inet static     address 192.168.0.40     netmask 255.255.255     gateway 192.168.0.254     dns-nameservers 8.8.8.8 

the switch connected ubuntu server vm has masquerade nat enabled 192.168.0.0/24 network , connected via bridged switch actual host, running ubuntu 16.04

the nat rule on postrouting chain , goes this

chain postrouting (policy accept 20 packets, 1440 bytes) pkts bytes target     prot opt in     out     source               destination          0     0 masquerade   --  *      ens33   192.168.0.0/24       0.0.0.0/0  

and interfaces file on server machine looks this

 # loopback network interface auto lo iface lo inet loopback  # primary network interface auto ens33 iface ens33 inet static     address 172.16.23.100     netmask 255.255.0.0     gateway 172.16.0.254     dns-nameservers 8.8.8.8 #iface ens33 inet dhcp   #gateway lan1 - 192.168.0.0/24 auto ens38 iface ens38 inet static     address 192.168.0.254     netmask 255.255.255.0 

the routing table on host looks this

default via 172.16.0.254 dev enp3s0  169.254.0.0/16 dev enp3s0  scope link  metric 1000  172.16.0.0/16 dev enp3s0  proto kernel  scope link  src 172.16.0.6  

now i'm trying ping host kali machine (from 192.168.0.40 172.16.0.6), ping isn't going through, did tcpdump on host machine on interface 192.168.0.40 host doesn't pick traffic. nat rules aren't being used reason.

i can ping default gateway , server/router vm kali ping host doesn't go through. doing wrong?

what think should happen packet goes through server through kali's default gateway, once it's in server machine gets translated ens33's address , there go host , host send ens33 because should current source ip, that's not happening

i'm bad @ paying attention things, put nat rule eth33 instead of ens33, fixed , works now


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -