A
A
Alexander Didenko2015-04-01 14:55:41
linux
Alexander Didenko, 2015-04-01 14:55:41

How can I prevent the network settings in /etc/network/interfaces from being reset after a reboot?

Upon reboot, the IP address changes to the one issued by the router 192.168.1.49, and I need 100 at the end.
I opened the file sudo nano /etc/network/interfaces
I entered:

auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1

After a reboot, the IP address is again 49.
# ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:0c:a4:8a
          inet addr:192.168.1.49  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::ba27:ebff:fe0c:a48a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST DYNAMIC  MTU:1500  Metric:1
          RX packets:4750 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1814 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:619136 (604.6 KiB)  TX bytes:676681 (660.8 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:158 errors:0 dropped:0 overruns:0 frame:0
          TX packets:158 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:13160 (12.8 KiB)  TX bytes:13160 (12.8 KiB)

When running the command:
sudo ifconfig eth0 down && ifconfig eth0 192.168.1.100 netmask 255.255.255.0 up

The IP address changes and the machine is reachable at IP address 192.168.1.100.
But after a reboot, the carriage turns into a pumpkin with an IP address of 192.168.1.49.
What to do?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
S
Saboteur, 2015-04-01
@saboteur_kiev

Stop the networking manager service.
But at the same time, remember that now - all changes in the network are only on command, without automation. And desktop icons will stop responding to changes.

N
neol, 2015-04-01
@neol

Do you have NetworkManager running? By the way, if this is a desktop, then it's better to configure it through NM without getting into the configs.

C
cssman, 2015-04-01
@cssman

/etc/init.d/networking restart
what's in /var/log ?

E
Eugene, 2015-04-01
@zolt85

Or maybe it's better to configure the router so that it gives you the desired IP?

A
AVKor, 2015-04-01
@AVKor

Look at the router settings. Perhaps it is configured to give out IP via DHCP.

S
ShamblerR, 2015-04-03
@ShamblerR

Well, the most stupid option is to put 444 on the file.
However, you must understand that someone is trying to rewrite it and this is not the best option.
There are several options
, for example, some web panel has network settings and tries to generate them every time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question