eth0 is managed by the network manager icon and connects using dhcp when it detects a network cable.
However, very occasionally I want to connect to some special-purpose computers with static IP addresses using a direct ethernet connection (cross-over). Then I set
sudo ifconfig eth0 10.90.90.91
or
sudo ifconfig eth0:1 10.90.90.91
and can connect to the computer in question.
However, after a minute or so, that eth0 looses that IP address and my connections hang until I repeat the ifconfig step.
Right now I'm using a loop and repeat setting the IP address every 10 seconds.
But I wonder if I can tell the network manager (which I suspect is the culprit) somehow to, right now, not try to manage eth0 until I need it again to do it.
Edit: The question How do I set an extra IP for an existing interface? differs from mine. That question wants to perpetuate the setting across reboots. I'm not interested in that. I only want to have that fixed IP address for eth0 very occasionally. Usually the dhcp procedure is ok for me. Only sometimes I want it to back off.
Use
ifdown
(andifup
). Seeman ifdown
. If you don't want use/etc/network/interfaces
, afterifdown
you can useifconfig
to configure by hand. Fromman ifdown
:If I understand correctly you want sometimes a different configuration for your network and you want to use Network Manager - I presume GUI.
So you open the network manager, add another connection (call it static address or so). Now configure this connection with the settings you want, don't set Automatically connect to this network..
Whenever you need this special setting just select it from the Network Manager menu.