Cannot set Static IP in Debian VM

New to Debian (Or Linux in general)? Ask your questions here!

Cannot set Static IP in Debian VM

Postby f0rr0z » 2017-03-15 11:59

Hi there! I'm new in this forum and almost new in the linux world too.
I'm installing a VM of Debian, which I'll need to use in my IT classes, but I'm having troubles to configure a static IP.
I tried to set up a new minimal virtual machine, without any kind of configuration (just defect parameters), and I'm having that same problem. I used the research but any solution worked for me, so here I am looking for it.

If I use my VM in dhcp mode, I don't have any problem with, but our teacher told us to set a static IP, in my case,, to don't have problems with users using the same IP asigned by dhcp. And when I change the configuration file "nano /etc/network/interfaces" and put it on static, I cannot acces internet or debian repositories.

This was the default "interfaces" file:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
And the only modification that I made in, it's in the last command line:
from "iface eth0 inet dhcp" to "iface eth0 inet static"
and add another line, that's " address"

I don't know what's wrong. I tried to adding netmask, broadcast, gateway... but it didn't work, so I put it like I wrote again.
Furthermore, I cannot connect to MV by ssh when IP is static. And I tried the network settings of Virtual Box configured in NAT and Bridged Adapter, with the same result. Don't know if that info could help.

I add a screenshot about the error message, it's in spanish but it just say "Cannot resolve <<>>" and under that "W: Failed to obtain 'repository_url' "
I'm desesperately trying to fix that, help please :(

By the way, I'm sorry for my bad english. Just learned some at school and videogames.
Posts: 1
Joined: 2017-03-15 11:07

Re: Cannot set Static IP in Debian VM

Postby arochester » 2017-03-15 12:24

You could try these as well.
Spanish - - Debian related News. - DesdeLinux - Documentation, news and forums related to Debian. - exDebian - Documentation, news and forums related to Debian.

There is also -New, support questions, discussion
- based in Mexico
"Something to be aware of: Debian is a core or source distribution. This means there are many Debian-based distributions. THEY ARE NOT DEBIAN." - oswaldkelso
Posts: 1185
Joined: 2010-12-07 19:55

Re: Cannot set Static IP in Debian VM

Postby pcalvert » 2017-03-16 02:05


This is the approach I use, and it works well:
Keeping the NAT adapter and adding a second host-only adapter works amazing, and is crucial for laptops (where the external network always changes). ... ux-guests/

Remember to create a host-only network in virtualbox itself (GUI -> settings -> network), otherwise you can't create the host-only interface on the guest.


“Every individual has a place to fill in the world, and is important in some
respect, whether he chooses to be so or not.” — Nathaniel Hawthorne
Posts: 1764
Joined: 2006-04-21 11:19
Location: Sol Sector

Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 6 guests