Everytime I use putty to connect VM,
It's ip will be changed.
This situation is very annoying.
So i decide to set static.IP
There are three networking options for virtual
machines running there: Bridged, NAT, Host-Only.
I use NAT in order to coneect web.
see this BLOG for detail
$ sudo vim /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5) # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 192.168.22.146 netmask 255.255.255.0 broadcast 192.168.22.255 gateway 192.168.22.2 dns-nameservers 192.168.22.2
you need to restart
$ sudo service networking restart
then you will encounter a problem,
lewis@lewis-virtual-machine:~$ sudo service networking restart stop: Job failed while stopping
let's to check log
lewis@lewis-virtual-machine:~$ sudo tail -f /var/log/upstart/networking.log Stopping or restarting the networking job is not supported. Use ifdown & ifup to reconfigure desired interface. //it indicate that not supported
So use this to do
$ sudo ifdown eth0 && ifup eth0 $ sudo /etc/init.d/networking restart
ref:
沒有留言:
張貼留言