Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like to configure my wlan0 so it would work with my router which is using WPA2 encription, and i would like my adress to be static not to interfere with other computers on the network. I removed Network manager and Wicd as i don't like them and would also like to learn a bit more about how to set up a network connection myself.

Soo i started searching the web and came across many threads talking about how to reconfigure file /etc/network/interfaces. From my past experiences i connected to the router by typing 192.168.1.1 into browser adress bar and logged into my router settings panel, where i checked how two things are set:

  • router IP adress: 192.168.1.1
  • subnet mask: 255.255.255.0 (type C)

I looked even further into the problem and figured out that i can calculate my network IP by doing a logic "bitwise and" operation between router IP adress and subnet mask above.

  • network IP: 192.168.1.0

This was perfectly clear to me so i decided to write my own /etc/network/interfaces file where i first wanted to set my static adress withouth configuring WPA2 encryption. My file now looked like this:

auto wlan0
iface wlan0 inet static
    address 192.168.1.10      #this is an IP i want for my machine 
    gateway 192.168.1.1       #this is an IP of my router
    netmask 255.255.255.0     #netmask i got from my router
    network 192.168.1.0       #i calculated this as described above
    broadcast 192.168.1.12    #???

Only thing i don't understand at the moment is a broadcast adress which i just set and i don't even know what it does. I would need some explaination on this one.

For setting the WPA2 i followed this guide and my file /etc/network/interfaces got a bit larger:

auto wlan0
iface wlan0 inet static
    address 192.168.1.10      #this is an IP i want for my machine 
    gateway 192.168.1.1       #this is an IP of my router
    netmask 255.255.255.0     #netmask i got from my router
    network 192.168.1.0       #i calculated this as described above
    broadcast 192.168.1.12    #???
    wpa-driver wext
    wpa-ssid lausi
    wpa-ap-scan 2
    wpa-proto RSN
    wpa-pairwise CCMP
    wpa-group CCMP
    wpa-key-mgmt WPA-PSK
    wpa-psk 8952a447c860d13847ba1cabd15314ba9caf2fb207f19598f90c43fcd43c0d97

Well this looked OK so i saved my file /etc/network/interfaces and restarted my network using comand /etc/init.d/networking restart. Although i got some error messages my Skype client worked, BUT i couldn't browse the web using my Chrome browser. Every addres like "www.google.com" ended up in a blank page with a warning that stating that the page does not exist.

This was weird, but i remembered that in Windows i allways had to specify my perferred DNS server which translates words like "www.google.com" into an IP adress like "173.194.35.180". You can check this by typing "173.194.35.180" into your browser addres bar and you will get the Google site.

Well this problem could easily be solved by adding 1 last line into my /etc/network/interfaces and it might look weird to you but it is like this dns-nameservers 193.2.1.66. This line tells my Linux machine to look at address "193.2.1.66" where my internet provider keeps a database of translations from words like "www.google.com" to addresses like "173.194.35.180" and back.

Well in my final state my file /etc/network/interfaces looked like below and it worked perfectly:

auto wlan0
iface wlan0 inet static
    address 192.168.1.10          #this is an IP i want for my machine 
    gateway 192.168.1.1           #this is an IP of my router
    netmask 255.255.255.0         #netmask i got from my router
    network 192.168.1.0           #i calculated this as described above
    broadcast 192.168.1.12        #???
    dns-nameservers 193.2.1.66    #DNS server of my internet provider
    wpa-driver wext
    wpa-ssid lausi
    wpa-ap-scan 2
    wpa-proto RSN
    wpa-pairwise CCMP
    wpa-group CCMP
    wpa-key-mgmt WPA-PSK
    wpa-psk 8952a447c860d13847ba1cabd15314ba9caf2fb207f19598f90c43fcd43c0d97

But still i don't know what is an broadcast IP address...

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Usually the broadcast address for an IPv4 network is at the very end of the network address space. In your case, a network 192.168.1.0 using subnet mask of 255.255.255.0 results in a broadcast address of 192.168.1.255. This is basic IPv4 networking matter (not OS specific). Without specifying a broadcast line in your interfaces file for an interface will make Ubuntu to guess it.

So, generally speaking, just remove your broadcast line there. Check the results by inspecting the output of ifconfig wlan0.

I do recommend to read about some IPv4 basics and try to put them in practise in Ubuntu. It will help much of your understanding in future occasions.

share|improve this answer
1  
+1. Just to add some info, you also don't need to specify network, it is calculated from address and netmask. –  Eric Carvalho Sep 12 '12 at 13:32
    
I did edit my post a lot as i have discovered my problem, but still even now broadcast adress isn't totaly clear to me. Is this an adress my machine gets if it becomes a server? –  71GA Sep 12 '12 at 13:40
1  
@71GA No, as I said, a broadcast address is something basic IPv4 networking. It is irrelevant of the type of application of the machine. Once your host is configured to listen to a broadcast address, it is able to send and receive to all machines in the same LAN (layer 2 network) using that address. See also this Wikipedia article. –  gertvdijk Sep 12 '12 at 13:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.