I recently installed Linux Ubuntu 14.04 to my computer. To enable internet connection I needed to change my IP and Gateway address.
I did the following as a root user
# ifconfig eth0 "my ip address here" netmask 255.255.255.0 up
# route add default gw " gw address here"
It works fine for a couple of minutes but then goes back to the previous settings every time.
So, How can I change the IP and the gw addresses permanently?
Best Answer
As stated by jpkotta, network-manager is likely the culprit.
You can see its status by running
ps -aux | grep network-manager | grep <username>
. If you get a result, it is running, otherwise it isn't.It will keep overwriting any changes you make with ifconfig as long as it is running.
Kill network-manager by running
sudo service network-manager stop
.You can bring it back up any time with
sudo service network-manager start
.Once it is disabled, use ifconfig to set your static, OR edit your
/etc/network/interfaces
file to include something like:Finally, run
ifup -a
to bring up the interfaces you have in your/etc/network/interfaces
file.All of this can be avoided though, if you'd rather not mess around with killing network manager. Just click on its icon in the taskbar and click 'edit connections'.