2

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.

2 Answers 2

1

It did restart the network, and dropped your connection as a result (assuming the IP changed). You should be able to reconnect the ssh connection but this is a inherently dangerous way to do a network restart (assuming the IP info changed) and you should probably be doing it over virt-manager instead.

Typically in data center deployments we use dual NIC cards and one network is for administration while the other is for normal use. The NIC cards are on isolated network segments and he whole 9 yards.

If you must you can also do the above in a screen session which will insulate the network restart in the case where your connection drops out. You can just ssh back in afterwards and resume from where you left off.

Steps

$ screen
(scren shell starts)

$ service network restart
(SSH session disconnects, but the network restart continues in the screen session)

(Wait a few seconds)

(SSH back into the host once the restart finishes)

$ screen -r
(Reconnect to screen and check for errors)

References

0

Try to check /var/log/messages what are the logs when you try to run service network restart

I am managing 8 Machines KVM on CentOS 6.4 using ssh and it works fine for me.

In case its buggy and already has a patched released, You can try to update your software by running yum update

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .