Friday, 18 March 2011

Backtrack basics: Networking

First Check recognised HW:
# dmesg|grep eth
jme: JMicron JMC2XX ethernet driver version 1.0.4
eth0: registered as PCnet/PCI II 79C970A
eth1: registered as PCnet/PCI II 79C970A
eth2: registered as PCnet/PCI II 79C970A


Option 1 - The manual way:

Static IP assignment and nework configuration:
a) Sets your IP address
# ifconfig eth0 192.168.0.123
b) Set the default gateway / router
# route add default gw 192.168.0.1
c) Set DNS server (you can resolve DNS names with the router as in this example or an OpenDNS server IP or whatever)
# echo nameserver 192.168.0.1 > /etc/resolv.conf

Option 2 - Lazy automated way:
Update: In Backtrack 5 it is easier to do:
# dhclient

This is very useful when you have somebody boot a laptop from a Backtrack DVD so that you can test from it (less things to explain, this will automatically get an IP address and basic connectivity on its own):
# /etc/init.d/networking start

Option 3 - Traditional dhcpcd way
dhcpcd can still be used but does not come by default so we have to install it first, assuming we have to network connectivity this won't work so refer to options 1 & 2 to setup network connectivity first, then you will be able to apt-get install packages...

a) Install missing package:
# apt-get install dhcpcd
b) Get a dynamic IP address from the DHCP server:
# dhcpcd eth0