Professional Documents
Culture Documents
CNS599/397
Backtrack 5 Networking
Objective
This supplement will explain how to modify ip addresses, gateways, and DNS settings in BackTrack 5 for those who may be new to Linux as well describe how to apply settings and start the networking service. Please note that this supplement applies ONLY to those who are running Backtrack as a VM on their personal systems. DO NOT modify the network settings on the VMs hosted in the lab environment (either mine or the CDM lab) as this may aect other systems if there is an address conict or your ability to use the system to complete a lab.
Materials
For the purposes of this document, you will need the following:
Access to the BT5 VM installed on your own personal system VMWare Player or Workstation to launch the BT5 VM
Procedures
Checking and Setting IP Addresses
First, everything well describe here is related to using a terminal windows (with the exception of the text editor gedit). So lets check what our current IP address is. To do so, open a terminal window, and at the prompt type:
ifcong
You should get some output on the screen which shows which adapters are active. This should include the lo (loopback adapter) and at least one other adapter labelled ethX (where X is some number 0-4). If you do not see an ethX adapter and only see a lo it means the adapter is not specied in the interfaces le. If that is the case skip down to the common issues section to troubleshoot.
PAGE 1 OF 6
BT5 SUPPLEMENT #1
CNS599/397
Now, lets see how we modify our IP address settings for the ethX adapter. From now on Ill assume that eth0 is the active adapter. The actual adapter number is dependent on your system, the install, and VMWare Player congurations. So substitute for eth0 where necessary. To set the ip address, again from the terminal prompt type:
gedit /etc/network/interfaces
PAGE 2 OF 6
BT5 SUPPLEMENT #1
CNS599/397
This will open a text editor which should look something like this:
You can see from this screen that multiple adapters are listed and have various network settings applied. The main things to point out here are the dhcp and static commands. If the interface is set to dhcp then it will get its address from the local dhcp server. If set to static it will use the information contained below the interface name to set the address, gateway, and so on. To change an adapter from dhcp to statically assigned simply modify the line that says: iface eth0 inet dhcp, and change it to iface eth0 inet static Now we need to ll in the following information under this line:
address - ip address to assign to the interface (i.e. 10.0.0.100) netmask - subnet mask of the network you are on (i.e. 255.255.255.0) network - this is the network address, obtained through the ip and subnet mask you assigned
PAGE 3 OF 6
BT5 SUPPLEMENT #1
CNS599/397
broadcast - broadcast address for the network (i.e. 10.0.0.255) gateway - address of the next hop which is usually a router which gets us access to the
The next step is to ensure that our DNS settings are correct. To check or modify these, again from a terminal prompt type:
gedit /etc/resolv.conf
This command will open gedit and display the contents of the resolv.conf le. Within this le are the DNS name servers which are dened for your system. Each line starts with the word nameserver followed by an ip address. You can modify this le by simply correcting the ip address to that of your name server (most likely your ISPs DNS server address). If you would like to use more than one name server you can add additional nameserver lines to the le. When nished simply save this document and move on to restarting the network as described below.
The Networking Service
Once editing of the le is complete make sure to save the le and close the open gedit window. Now, in order for our changes to take eect we need to restart the networking service. To do so, again from a terminal prompt type:
/etc/init.d/networking restart
This command will restart the networking service and apply the changes in our interfaces le. If you receive an error here make sure you read the output as it means you mistyped something in
PAGE 4 OF 6
BT5 SUPPLEMENT #1
CNS599/397
the interfaces le. If you get an error the interface settings will not be applied. A common mistake, especially for router/rewall admins, is to type ip address and not simply address when dening the network address of the interface. If no errors are received you can check the settings for the interfaces by again typing ifcong from a terminal prompt. If all looks correct make sure you can browse or ping other system to validate your settings.
Common Issues
2. Check your VMWare Player or Workstation settings to ensure that the network
3. Try adding an additional ethX section in the interfaces le. It may be that your
system believes the adapter is a higher number than is listed in the interfaces le. For example, if my interfaces le has only line for eth0 and eth1, and my system needs to use eth2 and there is no eth2 line, the adapter will never start. Add an additional ethX interface to the interfaces le and restart the networking service as described above
2. Restarting the network service errors out 1. Make sure you review the output in the terminal window as it generally directs you to
2. Correct the interfaces le, based on the issue, and restart the networking service as 3. Restarting the network service does not apply the address change 1. This issue is related to the location and/or interface you edited in the interfaces le.
Review the output from the ifcong command to make sure you are modifying the setting for the correct adapter
The following commands may be useful, but are not needed in order to set the interface address, gateway, or DNS information as described above. Nevertheless, you may nd these useful as well.
ifcong ethX up = brings an interface up ifcong ethX down - shuts an interface down
PAGE 5 OF 6
BT5 SUPPLEMENT #1
CNS599/397
<IP_address> and netmask <Netmask> (in slash notation) to an interface (i.e. eth0)
route add default gw IP_address - sets the default route to the IP_address you insert here echo nameserver <IP_address > /etc/resolv.conf - sets the nameserver address
dhclient ethX - sets an adapter to dhcp mode update-rc.d networking defaults - sets the network to start automatically on restart...this was
passwd - changes the password of root (the logged in user) man <command>- opens the manual page for the specic command you need more info
cat - display the le contents to the terminal window gedit - opens gedit, a graphical text editor, of the le you specify the TAB key - when you start typing a command in the terminal window you can use the
TAB key to auto ll the rest of the command, directory, or le. For example, typing /etc/ne and hitting tab lls in network, so my line would read /etc/network/ system down like this as opposed to using the GUI
shutdown -h now - shuts the system down from a terminal window. I nd it faster to shut the
PAGE 6 OF 6