NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Questions about NetBSD and virtual networks
Dear NetBSD users.
I have some questions about NetBSD and virtual networks. I hope some kind
soul can guide me in the right direction:
I am running NetBSD v5.1. It is configured with IP address 192.168.0.3
and default gateway 192.168.0.1 on the network 192.168.0.0/24.
From what I understand of the (not too detailed) documentation of QEMU
I have found, it should be possible to create virtual networks which are
able to communicate with the host network by use of the tap and bridge
interfaces. So I created a tap and a bridge interface:
root%asus.immnet.dk@localhost:/VM/Linux-1 # ifconfig tap0 create
root%asus.immnet.dk@localhost:/VM/Linux-1 # ifconfig tap0 inet 192.168.1.1/24 up
root%asus.immnet.dk@localhost:/VM/Linux-1 # ifconfig bridge0 create
root%asus.immnet.dk@localhost:/VM/Linux-1 # brconfig bridge0 add re0 add tap0
root%asus.immnet.dk@localhost:/VM/Linux-1 # brconfig bridge0 up
root%asus.immnet.dk@localhost:/VM/Linux-1 # ifconfig -a
re0: flags=8b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST> mtu
1500
capabilities=3f00<IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx>
enabled=0
address: 00:23:54:06:d0:b0
media: Ethernet autoselect (1000baseT full-duplex)
status: active
inet 192.168.0.3 netmask 0xffffff00 broadcast 192.168.0.255
inet6 fe80::223:54ff:fe06:d0b0%re0 prefixlen 64 scopeid 0x1
fwip0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
address: 00:1e:8c:00:01:80:ca:39
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33192
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
address: f2:0b:a4:a0:04:19
media: Ethernet autoselect
inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255
inet6 fe80::f00b:a4ff:fea0:419%tap0 prefixlen 64 scopeid 0xc
bridge0: flags=41<UP,RUNNING> mtu 1500
root%asus.immnet.dk@localhost:/VM/Linux-1 #
root%asus.immnet.dk@localhost:/VM/Linux-1 # brconfig -a
bridge0: flags=41<UP,RUNNING>
Configuration:
priority 32768 hellotime 2 fwddelay 15 maxage 20
ipfilter disabled flags 0x0
Interfaces:
tap0 flags=3<LEARNING,DISCOVER>
port 12 priority 128
re0 flags=3<LEARNING,DISCOVER>
port 1 priority 128
Address cache (max cache: 100, timeout: 1200):
00:24:01:34:14:79 re0 1165 flags=0<>
root%asus.immnet.dk@localhost:/VM/Linux-1 #
root%asus.immnet.dk@localhost:/VM/Linux-1 # netstat -af inet -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Mtu Interface
default 192.168.0.1 UGS 2 1482028 - re0
127/8 127.0.0.1 UGRS 0 0 33192 lo0
127.0.0.1 127.0.0.1 UH 1 1442 33192 lo0
192.168.0/24 link#1 UC 3 0 - re0
192.168.0.1 00:24:01:34:14:79 UHLc 1 6 - re0
192.168.0.3 00:23:54:06:d0:b0 UHLc 1 43762 - lo0
192.168.0.255 link#1 UHLc 1 2 - re0
192.168.1/24 link#12 UC 0 0 - tap0
root%asus.immnet.dk@localhost:/VM/Linux-1 #
From the host (192.168.0.3) I can now ping 192.168.1.1.
If I start a Linux guest using QEMU with
root%asus.immnet.dk@localhost:/VM/Linux-1 # qemu -m 512 \
-cdrom systemrescuecd-x86-2.3.1.iso \
-boot d \
-net tap,vlan=0,fd=4 \
-net nic,vlan=0,macaddr=52:54:00:12:34:59,name=myif \
-daemonize \
4<>/dev/tap0
root%asus.immnet.dk@localhost:/VM/Linux-1 #
and configure it with an IP-address on the 192.168.0.0/24 net, e.g.
root@sysresccd /root # ifconfig eth0 inet 192.168.0.10/24 up
root@sysresccd /root # route add -host 192.168.0.1 eth0
root@sysresccd /root # route add -net default gw 192.168.0.1
root@sysresccd /root #
the guest has access to all servers on the 192.168.0.0/24 network as
well as the internet via the default gateway and from the host I have
access to the guest, i.e.
root%asus.immnet.dk@localhost:/VM/Linux-1 # ssh root@192.168.0.10 (from
192.168.0.3)
works fine.
However, if I configure the guest on the 192.168.1.0/24 network, e.g.
root@sysresccd /root # ifconfig eth0 inet 192.168.1.10/24 up
root@sysresccd /root # route add -host 192.168.0.1 eth0
root@sysresccd /root # route add -net default gw 192.168.0.1
root@sysresccd /root #
the guest can only ping itself (192.168.1.10), the tap interface
(192.168.1.1) and the host system (192.168.0.3). Any ping to an
address not in the 192.168.1.0/24 network results in 100% packet
loss without any complaints about unreachable hosts.
I guess this means the ping is able to travel to the pinged host, but the
ping answer is unable to return to the guest. Still, it is possible
to reach the guest from the host, i.e.
root%asus.immnet.dk@localhost:/VM/Linux-1 # ssh root@192.168.1.10 (from
192.168.0.3)
works fine.
Should it not be possible the reach any address from the guest OS when
it is configured with/on another network than the host OS?
If yes, what am I missing to make it work?
My routing tables now look like:
root%asus.immnet.dk@localhost:/VM/Linux-1 # netstat -af inet -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Mtu Interface
default 192.168.0.1 UGS 3 1482356 - re0
127/8 127.0.0.1 UGRS 0 0 33192 lo0
127.0.0.1 127.0.0.1 UH 1 1442 33192 lo0
192.168.0/24 link#1 UC 4 0 - re0
192.168.0.1 00:24:01:34:14:79 UHLc 1 18 - re0
192.168.0.3 00:23:54:06:d0:b0 UHLc 1 43762 - lo0
192.168.0.10 52:54:00:12:34:59 UHLc 0 2 - re0
192.168.0.255 link#1 UHLc 1 2 - re0
192.168.1/24 link#12 UC 2 0 - tap0
192.168.1.1 f2:0b:a4:a0:04:19 UHLc 0 4 - lo0
192.168.1.10 52:54:00:12:34:59 UHLc 1 33 - tap0
root%asus.immnet.dk@localhost:/VM/Linux-1 #
root@sysresccd /root # netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
root@sysresccd /root #
TIA for any hints
Ib-Michael
--
Email: i.m.martinsen(at)gmail.com
Running NetBSD/i386 v5.1
The ASCII Ribbon Campaign
() No HTML/RTF in email
/\ No Word docs in email
Respect for open standards
Home |
Main Index |
Thread Index |
Old Index