There are some networks where DHCP is not yet implemented, and when you enter into those networks asking for connection, the Admin of the network will give you these data.
IP, Netmask, Gateway and sometimes DNS, I see myself in this situations lots of times as I travel with my Laptop, and in the offices where I have to work I found this types of networks with no DHCP server installed.
Well, what will you do with those info?, I like the command line, so I will show you how to assign this IP through the Linux command line console.
We will not make it fixed I mean it will be erased when the PC is restarted, so it will be there only for the current session, the command is.
sudo ifconfig ethX ADDRESS netmask NETMASK
Lets say you have been given this info.
IP: 10.1.1.60
Netmask: 255.255.255.0
Gateway: 10.1.1.1
DNS: 4.2.2.2
And your NIC is named eth0 on you Linux, to find the NICs available, issue the command.
sudo ifconfig
With no options, and all the available interfaces will be on the screen.
Well first assign the IP and the netmask
sudo ifconfig eth0 10.1.1.60 netmask 255.255.255.0 up
Now add the default Gateway
sudo route add default gw 10.1.1.1
The last step is to assign a DNS server, if you travel a lot like me, I hardly recommend to have your own DNS on your Laptop, read here how to do it: Configure pdnsd as local DNS server
Otherwise, you should edit /etc/resolv.conf, and there enter this line, following our example.
nameserver 4.2.2.2







Hey i was wondering if you could explain how to make the settings permanent. In my case it's because my ISP gave me a static IP, and i heard about faster boot in Ubuntu if you disable Network Manager for good and you give your linux rig a static IP configuration. I want to try that on my Ubuntu box but i lack the CLI knowledge. Please help! (T_T)
Hi,
Depends on your distro, if you are using Debian or a derivative edit
/etc/network/interfaces, and make add something like this# Your static IP - change the interface to your needs, also the IP auto eth0 iface eth0 inet static address 192.168.1.1 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.254Change it according to your needs, if it is not Debian nor Ubuntu or any other Debian relative, let me know and I will try to help you.
Oh i use Ubuntu alright. This is just what i needed. So you edit /etc/network/interfaces and if you save the file after changes it won't be overwritten at next boot.That's just sweeeeet. I tried it and it works. Many thanks for this how-to.