Sie sind auf Seite 1von 5

3/9/2011 QEMU network configuration in QNX

10 Марта, 2011, 05:21:35

Добро пож аловать, Гость. Пож алуйста, войдите или зарегистрируйтесь.


Навсегд а Войти
Войти

R ussian Поиск

С А Й Т С ВД ВС Н А ЧА ЛО П О М О ЩЬ ПО ИС К ВО Й ТИ Р Е ГИ С ТР А ЦИ Я

Официальный форум СВД Встраиваемые Системы > International Forum > English Discussion (Мод ератор: Олег
Большаков) > QEMU network configuration in QNX

« предыдущая тема следующая тема »


Страниц : [1] Вниз П Е ЧА ТЬ

Автор Тема: QEMU network configuration in QNX (Прочитано 1327 раз)

Александр QEMU network configuration in QNX


Молодцов « : 18 Мая, 2010, 16:44:42 »
С отрудник С ВД ВС
Пользовате ль

С ообщ е ний: 39
QEMU network configuration in QNX
(русск ая ве рсия)

QEMU hardware emulator provides broad range of networking capabilities. Large set of
emulated network controllers makes it possible (NE2000, Intel 82551, Intel 82557B, Intel
82559ER, Realtek RTL8139, Intel E1000 etc.), and allows networking in majority of guest
systems. It hard to find advanced OS, which doesn't support NE2000 or RTL8139. Flexible
network configurations and interactions between guest and host systems also play big
role. In this article we will discuss various network configurations for QEMU in QNX host.
Additional information you can also find in the Internet, and keep in mind that QNX6
networking subsystem is very similar to NetBSD.

Note 1. In all examples Archlinux installation CD (archlinux-2009.08-netinstall-i686.iso) is


used as a guest system. But you can configure network the same way in other guest OS,
for example Windows, QNX 4.25 or NetBSD, considering its specifics. QNX Neutrino 6.4.1
is used as a host system, but you can use QNX 6.4.0 or QNX 6.5.0.

Note 2. Following notation conventions are used in examples:

- [QNX] -- command is executed on the QNX host system;


- [ARCH] -- command is executed on the guest system, in our case Archlinux.

Network user mode


The easiest way to connect to host system is the user mode. In this mode QEMU
provides:

- virtual network (10.0.2.0)


- firewall which doesn't allow any external connections
- DHCP server (10.0.2.2)
- gateway (10.0.2.2)

DHCP server automatically assigns 10.0.2.15 to your interface when a DHCP request is
received from guest system. When the host system (QNX) is connected to the Internet,
the guest will be automatically be able to access the Internet too. No additional steps are
required.

forum.kpda.ru/index.php/topic,411.0.html 1/5
3/9/2011 QEMU network configuration in QNX
1. [QNX] Start virtual machine:

Код:
# qemu -net user -net nic -cdrom /home/qemu/img/archlinux-2009.08-netinstall-i686.iso

Спойлер: screenshot (щёлкните чтобы показать/скрыть)

2. [ARCH] Configure network interface:

Код:
# dhcpcd eth0
# ifconfig

Спойлер: screenshots (щёлкните чтобы показать/скрыть)

Спойлер: note (щёлкните чтобы показать/скрыть)

3. [ARCH] Test network:

Код:
# ping -c2 10.0.2.2
# telnet 10.0.2.2

Спойлер: screenshot (щёлкните чтобы показать/скрыть)

Connecting virtual networks


You need to execute first QEMU process, which would wait for incoming connections on a
specific port. Second QEMU process would connect to that port. Each time new packet
appears in first QEMU virtual network, it is transfered into second network and vice versa.

Realize following configuration:

- Guest system 1 waits for incoming connection on 8010 port;


- Guest system 2 connects to guest system 1 through localhost:8010.

1. [QNX] Start guest system 1:

Код:
# qemu -net nic,macaddr=52:54:00:12:34:57 -net socket,listen=:8010 -cdrom /home/qemu/img/archlinux-2009.08-netinst

2. [QNX] Start guest system 2:

Код:
# qemu -net nic,vlan=2,macaddr=52:54:00:12:34:56 -net socket,vlan=2,connect=127.0.0.1:8010 -cdrom /home/qemu/img/a

3. [ARCH1] Configure network on the guest system 1:

Код:
# ifconfig eth0 10.0.2.101 netmask 255.255.255.0 up

Спойлер: screenshot (щёлкните чтобы показать/скрыть)

4. [ARCH2] Configure network on the guest system 2:

Код:
# ifconfig eth0 10.0.2.102 netmask 255.255.255.0 up
forum.kpda.ru/index.php/topic,411.0.html 2/5
3/9/2011 QEMU network configuration in QNX
# ifconfig eth0 10.0.2.102 netmask 255.255.255.0 up

Спойлер: screenshot (щёлкните чтобы показать/скрыть)

5. [ARCH] Test network on both guest systems:

Код:
# ping -c 3 10.0.2.102

Спойлер: screenshot (щёлкните чтобы показать/скрыть)

Код:
# ping -c 3 10.0.2.101

Спойлер: screenshot (щёлкните чтобы показать/скрыть)

Connecting virtual network to TAP device


There is another way to create virtual network: using a virtual Ethernet device -- TAP
driver. Ethernet frames received by such device will be also sent to the guest system's
virtual network. Of course, Ethernet frames sent by guest system's virtual network will be
also received by TAP device.

Using devnp-qtap.so driver for QNX6, applications are allowed to interact with a network
device using a simple file descriptor. Any data sent over the file descriptor will be received
on both sides. This means that applications running on the guest system will be able to
access and connect to applications running on the host system. If port forwarding is
allowed, guest applications can also access the Internet.

With the -net tap option QEMU will try to execute /etc/qemu-ifup script to configure TAP
device and /etc/qemu-ifdown script after closing the device. If /etc/qemu-ifup is not
found, program will be terminated. You can change default script names, or specify not to
run them. For example:

Код:
# qemu -net tap,script=no,downscript=no <...>

To avoid specifying these options every time, you can create empty /etc/qemu-ifup
script. Do not forget to set executable flag for file.

1. [QNX] Create and configure TAP device:

Код:
# mount -T io-pkt /lib/dll/devnp-qtap.so
# ifconfig tap0 10.0.0.1 netmask 255.255.255.0 up

2. [QNX] Start virtual machine:

Код:
# qemu -net nic -net tap,ifname=/dev/tap0 -cdrom /home/qemu/img/archlinux-2009.08-netinstall-i686.iso

3. [ARCH] Configure network interface:

Код:
# ifconfig eth0 10.0.0.2 netmask 255.255.255.0 up
# ifconfig

forum.kpda.ru/index.php/topic,411.0.html 3/5
3/9/2011 QEMU network configuration in QNX

Спойлер: screenshot (щёлкните чтобы показать/скрыть)

4. [ARCH] Test network:

Код:
# ping -c 2 10.0.0.1
# telnet 10.0.0.1

Спойлер: screenshot (щёлкните чтобы показать/скрыть)

5. [QNX] Test network:

Код:
# ping -c 3 10.0.0.2

Спойлер: screenshot (щёлкните чтобы показать/скрыть)

Connecting virtual networks to TAP devices (two guest systems)


In this example we'll have 2 guest systems (two TAP devices). Each guest system is
connected to host system using TAP device. In order to allow connections between guest
systems you have to setup bridge between both TAP devices. Bridge will be central
network node between host and both network systems.

1. [QNX] Create and configure TAP devices:

Код:
# mount -T io-pkt /lib/dll/devnp-qtap.so
# ifconfig tap0 10.0.0.1 netmask 255.255.255.0 up
# mount -T io-pkt /lib/dll/devnp-qtap.so
# ifconfig tap1 10.0.1.1 netmask 255.255.255.0 up

2. [QNX] Start guest system 1:

Код:
# qemu -net tap,ifname=/dev/tap0 -net nic,macaddr=80:00:00:12:34:57 -cdrom /home/qemu/img/archlinux-2009.08-netins

3. [QNX] Start guest system 2:

Код:
# qemu -net tap,ifname=/dev/tap1 -net nic,macaddr=80:00:00:12:34:56 -cdrom /home/qemu/img/archlinux-2009.08-netins

4. [QNX] Create and configure bridge interface:

Код:
# ifconfig bridge0 create
# brconfig bridge0 add tap0 add tap1 up

Спойлер: screenshot (щёлкните чтобы показать/скрыть)

5. [ARCH1] Configure network in guest system 1:

Код:
# ifconfig eth0 10.0.0.2 netmask 255.255.0.0 up

Спойлер: screenshot (щёлкните чтобы показать/скрыть)

forum.kpda.ru/index.php/topic,411.0.html 4/5
3/9/2011 QEMU network configuration in QNX
6. [ARCH2] Configuring network in guest system 2:

Код:
# ifconfig eth0 10.0.1.2 netmask 255.255.0.0 up

Спойлер: screenshot (щёлкните чтобы показать/скрыть)

7. Test network using ping. In all cases you should be able to ping/access any system no
matter what system you operate on.

« Последнее редактирование: 20 Мая, 2010, 12:35:47


от Александр Молодцов » Записан

Страниц : [1] Вверх П Е ЧА ТЬ

« предыдущая тема следующая тема »

Пе ре йти в: => English Discussion да

© 2002-2010 С ВД Встраивае мые С исте мы.


При использовании мате риалов сайта ссылк а на forum .k pda.ru обязате льна.
Powe re d by SMF 1.1.13 | SMF © 2006-2009, Sim ple Machine s LLC | © Aiwan. Kolobok sm ile s | Site m ap

В после дний раз google посе щ ал эту страницу 07 Марта, 2011, 01:23:15

forum.kpda.ru/index.php/topic,411.0.html 5/5

Das könnte Ihnen auch gefallen