OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

5.1.2. On the Command Line with Ifupdown‌


Alternatively, when you prefer not to use (or don’t have access to) a graphical desktop, you can configure the network with the already-installed ifupdown package, which includes the ifup and ifdown tools. These tools read definitions from the /etc/network/interfaces configuration file and are at the heart of the /etc/init.d/networking init script that configures the network at boot time.

Each network device managed by ifupdown can be deconfigured at any time with ifdown network- device. You can then modify /etc/network/interfaces and bring the network back up (with the new configuration) with ifup network-device.

Let’s take a look at what we can put in ifupdown’s configuration file. There are two main directives: auto network-device, which tells ifupdown to automatically configure the network interface once it is available, and iface network-device inet/inet6 type to configure a given interface. For example, a plain DHCP configuration looks like this:


auto lo

iface lo inet loopback


auto eth0

iface eth0 inet dhcp

auto lo

iface lo inet loopback


auto eth0

iface eth0 inet dhcp



Note that the special configuration for the loopback device should always be present in this file. For a fixed IP address configuration, you have to provide more details such as the IP address, the network, and the IP of the gateway:


auto eth0

iface eth0 inet static address 192.168.0.3

netmask 255.255.255.0

broadcast 192.168.0.255

network 192.168.0.0

gateway 192.168.0.1

auto eth0

iface eth0 inet static address 192.168.0.3

netmask 255.255.255.0

broadcast 192.168.0.255

network 192.168.0.0

gateway 192.168.0.1


For wireless interfaces, you must have the wpasupplicant package (included in Kali by default), which provides many wpa-* options that can be used in /etc/network/interfaces. Have a look at /usr/share/doc/wpasupplicant/README.Debian.gz for examples and explanations. The most common options are wpa-ssid (which defines the name of the wireless network to join) and wpa-psk (which defines the passphrase or the key protecting the network).


iface wlan0 inet dhcp wpa-ssid MyNetWork

wpa-psk plaintextsecret

iface wlan0 inet dhcp wpa-ssid MyNetWork

wpa-psk plaintextsecret


Top OS Cloud Computing at OnWorks: