Wednesday, February 13, 2008

Setup network interfaces file

I'll just analyze how to setup a network interface. In this case it's a wireless lan with hidden essid and static ip. Let's open the interfaces file:

root@ubuntu:~# gedit /etc/network/interfaces


We will found inside something like this:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

Now let's add the following lines:

auto ath0
iface ath0 inet static
wireless-essid myEssid
address 192.168.3.90
gateway 192.168.3.1
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255

And last but not least let's restart the network:

root@ubuntu:~# /etc/init.d/networking restart



Setup network

I will just post a quick way to setup a network interface from command line. We will analyze the case of wireless lan with hidden essid and static ip address:

root@ubuntu:~# iwconfig ath0 essid "myEssid"
root@ubuntu:~# ifconfig ath0 192.168.3.3

root@ubuntu:~# route add default gw 192.168.3.1