You have to check if the ip
ifconfig
shows you are on the same network as the host,
192.168.1.X or 10.0.0.X
If you don't get a ip
from your router then you need to set it manually:
ifconfig eth0 192.168.1.11 netmask 255.255.255.0 broadcast 192.168.1.1
If that's not enough:
Maybe you need to set up dhcp
if ti is not enabled:
To configure your Ubuntu distribution to be a DHCP
client, you need to modify the /etc/network/interfaces
file. You will need to add the following line to the file(INTERFACE is the name Linux gave your network card and you find it with ifconfig
):
iface INTERFACE inet dhcp
Maybe you need to modify this file manually.To make changes open the interfaces file using nano and set the values in the file as necessary. First change dhcp to static, then add lines for address
, netmask
, gateway
, and DNS
servers according to your network.
sudo nano /etc/network/interfaces
it should look like this(eho0 is the networkCardName and you find it with ifconfig
):
iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
gateway 192.168.1.254
To setup eth0 to dhcp
, enter:
auto eth0
iface eth0 inet dhcp
To expose your virtualMachine to your local network you want to set network to BridgedAdapter
in VirtualBox
settings->Network->Adapter1 or add another(Adapter2)->attatched to:->Bridged Adapter
then you get a ip
from you router when you connect and then you can ssh
and ping
the virtualMachine on you network and from other hosts.
Set DNS Servers:
You need to configure the /etc/network/interfaces file if you want to change your DNS server via the command line.
It should look something like this:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.X.X
netmask 255.255.255.0
gateway 192.168.X.X
dns-nameservers X.X.X.X
If you have more than one DNS server, just add a space between each:
dns-nameservers X.X.X.X Y.Y.Y.Y Z.Z.Z.Z
Just replace the Xs, Ys, and Zs with your own IPs of the DNS servers of choice, and when this is done, run this command to update the settings:
sudo ifdown eth0 && sudo ifup eth0