In Ubuntu desktop 13.04 changing /etc/network/interfaces
file don't change ip address or convert DHCP to static network interface configuration. after changing the file I tried
sudo service networking restart
----------EDIT----------
I have connected to system with ssh.
By default, Ubuntu (or Network Manager to be specific) ignores the
/etc/network/interfaces
file. To make the changes you made take effect, execute the following commands:Assuming that
wlan0
is the interface you are editing. Once you do that,wlan0
will come up with the settings you have under its stanza in/etc/network/interfaces
.Edit: since you're connected through SSH. You can try the following:
Edit
/etc/NetworkManager/NetworkManager.conf
and changeifdown managed
tofalse
:Then, try:
Try this. Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
This is done with the help of guntbert
Once done save and exit
add this line DHCP mode
Static mode
Once done save the file, and:
You can change your ip address by using the following script:
Open terminal with Ctrl + Alt + t and type the following command:
OR
Find eth0 section and setup IP address as follows:
Save and close the file. Once done, restart network:
Verify new IP address by using the following command :
I am posting this answer to give another dimension to the question and existing answers, not as a direct answer to the original question. Your IP will be lost at reboot. However, I think it's worth you understanding these commands,
iproute2
package is the currently method of on-the-fly interface management via the CLI. Lots of people are still writing scripts usingifconfig
for example.I think it's worth noting the use of the
iproute2
packages;Show current IPs on all interface (
ip addr
)Add an IP address to my wireless interface (
ip addr add
)Show my IP addresses again, note the additional IP on wlan0 (
ip addr
)Show the link state of my interfaces (
ip link
)Delete this 2nd IP address from my wireless interface (
ip addr delete
)Show IP addresses just for wlan0 to check (
ip addr show wlan0
)The same commands could have been used to remove my current IP, 172.22.0.221 then add another, but I would have lost connectivity, which I can't right now. Below are those commands though, after which I would also need to add a new default route route;
From the detailed instructions on this site:
This is the right way to do it.