qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Is anyone able to load a web page from a guest operatin


From: Laszlo Ersek
Subject: Re: [Qemu-devel] Is anyone able to load a web page from a guest operating system?
Date: Wed, 27 Apr 2016 12:05:02 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2

On 04/26/16 22:12, Thomas Huth wrote:
> On 26.04.2016 21:25, Programmingkid wrote:
>> On Apr 26, 2016, at 3:00 PM, Dr. David Alan Gilbert wrote:

>>> Does ping work?
>> I can ping the virtual router at 10.0.2.2. Any other ip address fails. 
> 
> That's normal for user-mode / slirp networking. You can't ping external
> hosts with this mode.

Side note: yes, you can.

I do it whenever I want to check network connectivity from within ad-hoc
OVMF guests, using the PING command of the UEFI shell. ("Ad-hoc guest"
implies user-mode / slirp.)

It can be enabled with the following steps:

(1) Determine the main group ID (or one supplementary group ID) of the
user that will run QEMU with slirp.

(2) In /etc/sysctl.conf (or whatever is appropriate for your host
distro), make sure that the whitespace separated inclusive group ID
range in the "net.ipv4.ping_group_range" sysctl includes the above group ID.

For example,

- you could add a new group called "unpriv_ping":

  groupadd unpriv_ping

- set this group for a number of users as another supplementary group:

  for U in user1 user2 ... usern; do
    usermod --append --groups unpriv_ping $U
  done

  (note, they will have to re-login),

- then set both sides of the inclusive range in the above sysctl to the
  numeric ID of the new group:

  (
    GROUP_ID=$(getent group unpriv_ping | cut -f 3 -d :)
    printf 'net.ipv4.ping_group_range = %u %u\n' $GROUP_ID $GROUP_ID \
      >> /etc/sysctl.conf
  )
  sysctl -p

Thanks
Laszlo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]