cuckoosandbox / cuckoo

Cuckoo Sandbox is an automated dynamic malware analysis system
http://www.cuckoosandbox.org
Other
5.55k stars 1.71k forks source link

The internet connection in the Host machine is lost after "iptables -A POSTROUTING -t nat -j MASQUERADE" command #2831

Open Arpan61 opened 5 years ago

Arpan61 commented 5 years ago

If you want to connect the VMs controlled by cuckoo's sandbox to Internet:

Virtualbox Host-Only network: vboxnet0 IP: 192.168.56.0/24 Configure the VMs so that they belong to this network, i.e.

First machine (just an example): Static IP 192.168.56.101 DNS - any DNS server (8.8.8.8) Default Gateway - 192.168.56.1

Second machine: Static IP 192.168.56.102 etc...

Then configure the host with the IP address: 192.168.56.1 Add the following IP tables rules by paying really a lot of attention to the interfaces (modify them according to your system): iptables -A FORWARD -o eth0 -i vboxnet0 -s 192.168.56.0/24 -m conntrack --ctstate NEW -j ACCEPT iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT iptables -A POSTROUTING -t nat -j MASQUERADE

And then to enable ip forward: echo 1 > /proc/sys/net/ipv4/ip_forward

After doing this, I get the internet connection in VM but the internet in the Host machine gets lost and hence I cannot use cuckoo for analysis.

vhari96 commented 5 years ago

Brother, do you have any latest update on this asin facing the same issue now. If yes, pls help. Urgent!!

secTube91 commented 4 years ago

I had exactly the same problem. In my case I was able to solve it by specifying the network interface in the last iptables command: iptables -A POSTROUTING -t nat -j MASQUERADE -o eth0