Pages

Showing posts with label network. Show all posts
Showing posts with label network. Show all posts

Friday, May 17, 2013

Troubleshooting network connectivity for Holynix on VirtualBox

Holynix is a "Linux vmware image that was deliberately built to have security holes for the purposes of penetration testing".  It has 2 levels and solutions are already published.  In this post I'll details my approach to set up network connectivity for the 2 Holynix VMs and another Backtrack VM, all running in VirtualBox.
After some unsuccessful attempts to make it run under VirtualBox and have connectivity, I decided to reset the root password and actually check and understand the network settings.

To reset the root password

  • I've first install VmWare Player on Ubuntu.
  • The open VM in VMWare player
         - Edit Virtual Machine Settings
         - Go to Hard Disk
         - Utilities (at the bottom)
         - Mount Disk and select the second ext partition
  • Make a copy of the /etc/shadow file
  • Delete the password hash of root from /etc/shadow
  • Start again the VM in VirtualBox and login as root without password!

Holynix Level 1

To have connectivity between this machine and the bt machine, I just added an internal network adapter and put Holynix VM in the same lan as bt machine
Then got an IP through DHCP server of the internal network (already configured!)
 # dhclient eth1
(or just apply the steps in next session to have eth0 instead eth1 and get IP automatically on eth0)

Holynix Level 2

First I've also removed root password.

Then for the network settings
  • Add holynix2 and bt to a new internal network
  • Holynix2 assigns static IP 192.168.1.88 on interface eth0 ! (Firewall rules seen when booting show eth0 also)
  • The /etc/network/interfaces  file contains the following:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.1.88
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1


But we just have eth1, not eth0 ?!
If we examine the kernel messages we see:
# dmesg | grep eth
...
udev: renamed network interface eth0 to eth1
..

The explanation for this is found on virtualbox forums:
[SOLVED]Missing eth0 in Ubuntu guest

Basically the problem is that each time a VBox guest has a new/different MAC, Debian and Ubuntu guests udev assigns a new eth number. By deleting that file, it is recreated correctly at the next reboot).

# cd /etc/udev/rules.d
# sudo mv 70-persistent-net.rules 70-persistent-net.rules_old
# sudo reboot


After the reboot, eth0 will be present and configured properly.



For the Bbacktrack machine, we'll configure the interface that's in the same internal network as Holynix 2 VM:
# ifconfig eth4 down
# ifconfig eth4 192.168.1.1 netmask 255.255.255.0
# ifconfig eth4 up


Now check that we have connectivity between bt and holynix machines and happy hacking !

Monday, September 7, 2009

Configure network from command line in Ubuntu 10

A. Temporary settings for the network can be added and tested with the ifconfig command.  to view network settings:

# ifconfig wlan0
or:

# iwconfig wlan0 

iwconfig is similar to ifconfig but dedicated to wireless networks, and shows more information.

For example, to set an ip address for wireless wlan0 interface:

# ifconfig wlan0 192.168.0.22 netmask 255.255.255.0 up

Note that all the commands need super user rights. Use su to switch to root.

$ sudo su

To configure a default gateway, you can use the route command in the following manner. Modify the default gateway address:
# route add default gw 192.168.0.1 wlan0
To verify your default gateway configuration, you can use the route command:

# route -n
To add DNS servers IP addresses, modify the file/etc/resolv.conf. Add nameservers corresponding to your network. For example:
nameserver 89.32.16.2
nameserver 192.168.0.1

B. Permanent settings can be configured for the appropriate interface in the file /etc/network/interfaces. Example for configuring permanent static ip address, gateway and netmask for wireless interface wlan0:

auto wlan0 
iface wlan0 inet static 
address 192.168.0.22 
netmask 255.255.255.0 
gateway 192.168.0.1
After adding interface configuration in this file, the interface can be brought up and down using the commands ifup and ifdown:

sudo ifup eth0
To manually disable the interface, you can use the ifdown command.
sudo ifdown eth0
Links: