添加网卡
sudo vi /etc/network/interfaces
#添加下面的配置 >>>>>>>>
auto tap0
iface tap0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
tunctl_user jack
auto br0
iface br0 inet static
address 10.14.24.1
gateway 10.14.24.254 #br0的网关
netmask 255.255.255.0
bridge_ports tap0
bridge_stp off
bridge_maxwait 0
bridge_fd 0
KVM虚拟机的xml设置固定MAC
<mac address='52:54:00:33:a4:10'/>
libvirt开启DHCP,绑定IP-MAC
vim /etc/libvirt/qemu/networks/default.xml
<network>
<name>default</name>
<bridge name="br0"/>
<forward/>
<ip address="10.14.24.1" netmask="255.255.255.0">
<dhcp>
<range start="10.14.24.2" end="10.14.24.254"/>
<host mac="52:54:00:33:a4:10" name="test1" ip="10.14.24.10"/>
</dhcp>
</ip>
</network>
具体可参见 http://libvirt.org/formatnetwork.html
vim /var/lib/libvirt/dnsmasq/default.conf
interface=br0
dhcp-range=10.14.24.2,10.14.24.254
kill dnsmasq进程后重启服务libvirt服务 service libvirt-bin restart,libvirt会自动拉起dnsmasq进程
dnsmasq设置DNS和Gateway
vim /var/lib/libvirt/dnsmasq/default.conf
interface=br0
dhcp-range=10.14.24.2,10.14.24.254
/usr/sbin/dnsmasq --dhcp-option=6,10.14.24.1 --dhcp-option=3,10.14.24.1 --conf-file=/var/lib/libvirt/dnsmasq/default.conf #--dhcp-option=6是DNS,3是Gateway,具体参见dnsmasq –help dhcp
如此KVM虚拟机就能自动获得IP,DNS和Gateway地址
注:若设置br0网卡时的netmask 与/etc/libvirt/qemu/networks/default.xml中的netmask配置的不一致,则以设置br0网卡时的netmask为准
Inetsim绑定网卡
修改Inetsim配置文件,绑定到对应网卡,模拟响应相关请求
vim /etc/inetsim/inetsim.conf
#########################################
# service_bind_address
#
# IP address to bind services to
#
# Syntax: service_bind_address <IP address>
#
# Default: 127.0.0.1
#
service_bind_address 10.14.24.1
重启下inetsim服务即可, service inetsim restart
Cuckoo中Auxiliary.conf 网卡修改为br0