1

I just restarted the network services in KVM host and running vm guest's network were not reachable.

I enabled network to vm guest's through Bridge. Only after guest reboot I could access the vm IP's.

Why it causing issue for Network restart and how I will access the guest vm IP's without rebooting.

  • 1
    There is virtually no information to go on here. Could you possibly share what virtualisation software you're using, what operating systems are involved, the relevant network configuration. Also, what does "restarting the network services" involve on the host? – Kusalananda Jan 22 at 10:03
1

I ran into this exact problem once.

Now, whenever I am installing a new VM using virt-install, I always make sure to include the following options --nographics, -x console=ttyS0. The -x console=ttyS0 option creates a virtual console connection through the ttyS0 port. This allows me to login to the VM from the host using virsh console <VMname> and then I can reset the network settings on the VM without having to reboot it entirely. Within the VM itself, this will add the following settings to /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,9600n8" GRUB_CMDLINE_LINUX=""

On one of my VM's I had to add those lines manually after installation and rebuild grub using grub-mkconfig in order to get the settings to survive reboots.

  • One way around it's useful. Would like to enable network without network restarting from guest vm's as I have multiple(4-5) vm's running on it and tedious job to do to go in each of VM's console. Like this I have around 20 KVM hosts and each running 4-5 vm guests. – KKD Jan 23 at 13:42
-1

The lines below are necessary to allow the host to communicate with guests in a KVM enviroment

Let's say that your host interface looks like this

interface: eth0
ip: 192.168.0.10/24
gateway: 192.168.0.1

Edit /etc/rc.local and add the following commands

ip link add link eth0 address 51:51:51:A8:28:A1 macvlan0 type macvlan mode bridge

ip address add 192.168.0.10/24 dev macvlan0

ip link set dev macvlan0 up

ip route flush dev eth0

ip route add default via 192.168.0.1 dev macvlan0 proto static

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.