BackTrack 4: Assuring Security by Penetration Testing
上QQ阅读APP看书,第一时间看更新

Configuring network connection

After logging in to the BackTrack 4, we are going to configure and start the network interface, as this is an important step if we want to do penetration testing to remote machines.

Ethernet setup

In the default VMWare image configuration, the BackTrack 4 virtual machine is using NAT (Network Address Translation) as the network connection used. In this connection mode, by default the BackTrack 4 machine will be able to connect to the outside world through the host operating system, whereas the outside world, including the host operating system, will not be able to connect to the BackTrack virtual machine.

For the penetration testing task, you need to change the virtual machine networking method to bridge mode. First make sure you have switched off the virtual machine. Then open up the VirtualBox Manager, select the virtual machine, in this case we are using BT4VB, then choose Settings. Next go to Network and change the Attached to to Bridged Adapter. In the Name field you can select whichever network interface is connected to the network you want to test.

In the VMWare image configuration all of the network card are set to use DHCP to get their IP addresses. Just make sure you are able to connect to the network you want to test.

If you are aware, a DHCP IP address is not a permanent IP address, it's just a lease IP address. After 37297 seconds (as defined in the DHCP lease time), the BackTrack 4 virtual machine will need to get a lease IP address again. This IP address might be the same as the previous one or it might be a different one.

If you want to make the IP address permanent, you can do so by putting the IP address in the /etc/network/interfaces file.

The default content of this file in BackTrack 4 is:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet dhcp
auto eth2
iface eth2 inet dhcp
auto ath0
iface ath0 inet dhcp
auto wlan0
iface wlan0 inet dhcp

We can see that all of the network cards are set to use DHCP to get the IP address. To make a network card bind to an IP address permanently, we have to edit that file and change the content to the following:

auto eth0
iface eth0 inet static
address 10.0.2.15
netmask 255.255.255.0
network 10.0.2.0
broadcast 10.0.2.255
gateway 10.0.2.2

Here we set the first network card to bind to IP address 10.0.2.15. You may need to adjust this configuration according to the network environment you want to test.

Wireless setup

By running BackTrack 4 in the virtual machine, you can't use the wireless card embedded in your laptop. You can only use the USB wireless card. Before you buy the USB wireless card, you may want to check the compatibility of the card with BackTrack 4 at http://backtrack.offensive-security.com/index.php/HCL:Wireless.

If you have successfully installed the USB wireless card, you can use the wicd program to connect to the wireless access point.

However, first you need to start the wicd service:

# /etc/init.d/wicd start

The above command will start the networking interface.

Starting Network connection manager: wicd.

Also, if you run the preceding command before you start the X Windows system, it will run the wicd-client too. However, if you start the above command after you login to the X Windows system, you need to start the wicd client:

# wicd-client
Loading...
Attempting to connect tray to daemon...
Success.
Done.

In the tray you will see the wicd manager. You just need to click on its icon to restore the window.

You will see several networks, either wired or wireless, available around your machine. The network displayed will be sorted according to the signal strength. The higher the number, the better.

If you need to configure your network connection settings, such as:

  • Static IP address
  • Static DNS server
  • Wireless encryption

You can enter this information in the Properties window.

Starting the network service

After configuring the wired network interface, you need to start the wired network interface. To control the networking process (start-up or shut-down), you can use a helper script called service.

To start networking service, just give the following command:

service networking start

Whereas to stop networking service, type:

service networking stop

You can test whether your network is functional by sending the ICMP request to the host machine using the ping command.

You may find that after you reboot your BackTrack machine, the networking service needs to be started again. To make the networking service start automatically, you can give the following command:

update-rc.d networking defaults

It will insert the necessary links to the /etc/rc*.d directories to start the networking script.