Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

How to set a static IP in Ubuntu from the shell (See related posts)

Edit
/etc/network/interfaces 
and adjust it to your needs (in this example setup I will use the IP address 192.168.0.100):

# 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

# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
mapping hotplug
        script grep
        map eth0

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.0.100
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1

Comments on this post

johannes posts on May 13, 2007 at 20:40
Then do
sudo /etc/init.d/networking restart

to restart the network.
av76 posts on Jan 20, 2009 at 05:45
Did it and it worked, but when I tried to reverse the action
my network-manager is gone and I have no ip address at all :-(

What do I do now?

Thanks,
A.
compsfreak17 posts on Apr 28, 2009 at 19:36
i can't change the permissions to edit the file
help
thanks
vijayan posts on May 27, 2009 at 05:56
before vi /etc/network/interfaces
type sudo vi /etc/network/interfaces
it will ask for password, enter and edit.
925ly posts on Dec 21, 2009 at 09:39
Welcome to our website.?Cheap-FakeBags is dedicated to providing?quality?fake bags and?fake purses?to people who love?designer handbags. We all know it will cost much if we want to attract other people's eyeballs. It?will surely work?if you wear a latest LV handbag. But it will cost?$500 US at least. Our product is?a good solution for this problem: buying a?fake Fake Purses,Fake Bags. We believe and we put it in our general works.
We don't sell poor quality Fake Bags which quickly start to break, rip, fade or just fall apart. Our goal is to provide the most proper replicas which means?our fake bags and fake purses have a good balance between price and quality. We deeply understand?all the needs for fake bags and fake purses: Good quality, Good price, Fast delivery, Satisfied Service. We are doing everything we can to make all of our customers fully satisfied.

You need to create an account or log in to post comments to this site.