During the course of practicing switching my local VM from static IP to DHCP and vice versa via system-config-network
, I decided I didn't like having to access the VM's console through virt-manager and instead decided to just SSH into it (admittedly out of laziness from not wanting to click back and forth in the gui).
I can connect via SSH just fine and use system-config-network to update the settings, but when I try to run service network restart
it just hangs forever with:
[root@host1 ~]# service network restart
Shutting down interface eth0:
While waiting for it to spit some kind of error, I access the VM's console via virt-manager and can see that the command ran successfully, the new IP information is updated, and all seems well from that angle; however, it was my understanding that my SSH connection should survive such a network restart, as per this question: How does SSH connection survive a network restart?
My question is: If this weren't a local VM and I was trying to manage an actual remote host, what would be the best way to handle such a network restart? Is my approach to managing the VM's network 'remotely' misguided?
The VM is set up using KVM and runs Centos 6.3; kernel 2.6.32-279.el6.x86_64; bridged networking. The physical host uses Centos 6.4; kernel 2.6.32-358.18.1.el6.x86_64
Update: upon checking /var/log/messages on the physical host, I came upon the following entry:
not giving name host1 to the DHCP lease of 192.168.122.221 because the name exists in /etc/hosts with address 192.168.122.220
My derp moment: Made me realize that SSH couldn't pick back up because i'm using ssh user@IPADDRESS
because I don't have hostname resolution set up yet. The IP address was changing and therefore couldn't be found. When I tried restarting the network without changing the IP, it picked back up just fine.