One day, suddenly found unable to ssh into the virtual machine within the Debian system, has been considered an SSH problem, and then inadvertently ping Ping Baidu, found that the original Debian system is not connected .... 囧
First, the network settings check for the virtual machine.
Open the VirtualBox, click on the Debian virtual machine, then turn on the settings and set the network part as the bridge adapter.
This step is for the virtual machine to surf the internet, and on the network and host is peer, with a separate intranet IP.
This step is fine, so open the virtual machine and check the Debian network settings.
Debian section:
Set up a static IP:
Open/etc/network/interfaces,
1 # This file describes the network interfaces available on your system2# and how to activate them. For more information, see Interfaces (5).3 4 # The Loopback network interface5 Auto Lo6 iface Lo inet loopback7 8 # The Primary network interface9allow-hotplug eth0Ten Auto Eth0 One iface eth0 inet static AAddress 192.168.1.199 -Netmask 255.255.255.0 -Gatway 192.168.1.1 the~ -~
The settings for lines 5th and 10th indicate that the LO interface and the Eth0 interface will be configured automatically when the system starts.
Line 11th indicates setting the network to static IP if you want to set to get dynamic IP automatically, you can set this
Iface eth0 inet DHCP
If set to dynamic fetch, the parameters of the 12~14 row are not set, and if you want to set a fixed IP, you must set up parameters such as IP, subnet mask, gateway, and so on.
If you need to set up a gateway, you can open the/etc/resolv.conf file to change the settings:
1 nameserver 192.168.1.12 nameserver 0.0.0.03 ~
The settings behind nameserver are the gateways of your own network.
After you save your edits, use the command:
/etc/init.d/networking restart
For the settings to take effect.
If the problem is still not resolved.
You can enter the following command:
default GW 192.168.1.1
Where 192.168.1.1 is the gateway to this network, then, the problem is solved.
The purpose of the above command is to create a static route that specifies a host or a network through a network interface, such as eth0.
The default is the network interface, where eth0 is represented.
This setting will expire after a reboot and can be added to the/etc/network/interfaces file if long-term validity is required.
If it's set or not, there's another way:
First in the/etc/network/interfaces file is set to the dynamic acquisition of IP, and then restart the network card, to be able to ping networks, and then reset to static IP, so that generally no problem.
"Debian" cannot be connected after illegal shutdown connect:network is unreachable