Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

/etc/resolv.conf

IxapeIxape Member
edited October 2011 in Help

Using a OpenVZ VPS.

I've changed my /etc/resolv.conf and then rebooted. Except after the reboot it changes the file back. Any ideas?

Thanks!

Comments

  • Do you have DHCP enabled?

  • option one - chattr +i /etc/resolv.conf (not sure if it will work, maybe try it)

    Option two - modify/overwrite resolv.conf with your own version from rc.local for instance. But the all daemons that start before rc.local runs would use the hosts's resolv.conf

  • Set PEERDNS=no in ifcfg-venet0 file.

  • Just don't reboot :P

  • I think OpenVZ overwrites the resolv.conf file when it boots the VPS.

  • Make a script that overwrites the overwritten file on startup

  • gsrdgrdghd said: Make a script that overwrites the overwritten file on startup

    At times this solution works.

  • your /etc/resolv.conf is being written by solusvm-openvz script on startup generally when the host provider sets its block of IP to a specific dns ip. Maybe easiest way is for you to just create a startup script or a crontab entry and insert the echo commands below

    echo "nameserver 127.0.0.1" >> /etc/resolv.conf

  • SpiritSpirit Barred
    edited October 2011

    nano /etc/rc.local

    echo 'nameserver 4.8.8.8' > /etc/resolv.conf

    or

    nano /etc/rc.local

    cp /backup/resolv.conf /etc/resolv.conf

    Or:

    cripperz said: Maybe easiest way is for you to just create a startup script


    ..and use @reboot crontab command (it will execute your script only after reboot)

    export EDITOR=nano

    crontab -e

    @reboot cd /root; ./resolv.sh >/dev/null 2>&1

Sign In or Register to comment.