2

I have a static IP set on my web-server. When I change static to dhcp the server needs to be reboot for the changes to take effect. Is there any way to make it so I can use ifdown and ifup to change it?

I know that it should work because I have had a server that was able to be changed from static to dhcp without rebooting. I am just not sure if I am missing something.

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 10.8.105.8
netmask 255.255.0.0
gateway 10.8.1.1

auto eth1
iface eth1 inet static
address 169.254.1.1
netmask 255.255.0.0

To set it to to dhcp I change the iface eth0 inet static to iface eth0 inet dhcp

I am also running into an issue of slow boot times when I declare eth1 as another interface as it is.

Added info

default via 10.8.1.1 dev eth0 metric 100
10.8.0.0/16 dev eth0 proto kernel scope link 10.8.105.8
169.254.0.0/16 dev eth1 proto kernel scope link src 169.254.1.1
169.254.0.0/16 dev eth0 scope link metric 100
10
  • @Letizia the sudo /etc/init.d/networking restart ran but did not switch my network to a dhcp address when it is declared as dhcp
    – Keith
    Oct 7, 2014 at 15:20
  • Could you describe what you did to change static to dhcp and post /etc/network/interfaces file content?
    – Lety
    Oct 7, 2014 at 15:54
  • Did you use ifdown eth0 and ifup eth0?
    – Lety
    Oct 7, 2014 at 22:53
  • @Letizia Yes, that is what I normally use but sometimes I get this error RTNETLINK answers: File Exists I have another post trying to solve that but they could very well deal with each other.
    – Keith
    Oct 8, 2014 at 11:51

1 Answer 1

2

What about using

sudo ip addr flush dev eth0

would that force the interface to pick up a new address?

2
  • It seemed to work. I had to follow that command by a ifdown eth0 and an ifup eth0. It did however work so let me do some more situational testing on it.
    – Keith
    Oct 13, 2014 at 11:56
  • Good! If it works, could you post ip route output after flush? I'm curious to know how it changes.
    – Lety
    Oct 13, 2014 at 22:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .