How can I setup a static IP address for my Debian Virtual Machine?

7,188

The host was unreachable because no DNS server was specified.

The configuration file must be the following (as long as your gateway and nameserver have the same IP address)

auto eth0
iface eth0 inet static
address 192.168.1.59
netmask 255.255.255.0
gateway 192.168.1.254
dns-nameservers 192.168.1.254
Share:
7,188

Related videos on Youtube

David
Author by

David

I'm an Embedded Systems developer and hardware enthusiast. My main interests are algorithm design and optimizations, but I also enjoy learning about hardware design, computer architectures, and operating systems.

Updated on September 18, 2022

Comments

  • David
    David over 1 year

    I have already set a static IP for a virtual machine in a private network in my school's laboratory. However, if I follow the same steps at home I cannot set a static IP for my Debian Virtual Machine.

    My etc/network/interfaces file is configured like this:

    auto eth0
    iface eth0 inet static
    address 192.168.1.59
    netmask 255.255.255.0
    gateway 192.168.1.254
    

    Once I restart my machine, and after I type ifconfig in the terminal, I see that my IP address is 192.168.1.59, but I cannot ping any website, such as google.com. I get a message that reads 'unknown host google.com'.

    What should I do to set a static IP address then?

    I will thank you for any help you can provide.