On Tue, Aug 28, 2012 at 5:16 PM, James Allsopp <jamesaalls...@googlemail.com> wrote: > On 28/08/2012, Bob Proulx <b...@proulx.com> wrote: >> James Allsopp wrote: >>> >>> I'm trying to learn more about networking and set up BIND, LDAP and >>> Nagios on a KVM virtual machine. The VM works great and I can ssh into >>> it from the host, and view the nagios pages from the host. However the >>> VM gets the address 192.168.1.x and the host is 192.168.1.2. >> >> What number is 'x' above? Hopefully some number other than .1 or .2. >> >>> auto br0 >>> iface br0 inet static >>> address 192.168.1.2 >>> network 192.168.1.0 >>> netmask 255.255.255.0 >>> broadcast 192.168.0.255 >>> gateway 192.168.1.1 >>> bridge_ports eth0 >>> bridge_fd 0 >>> bridge_hello 2 >>> bridge_maxage 12 >>> bridge_stp off >> >> Remove 'network' line. Remove 'broadcast' line. Let the tool >> calculate it from 'netmask'. That will prevent errors such as in the >> above where the broadcast setting is incorrect. :-) [It should have >> been 192.168.1.255 not 192.168.0.255.] > > Just restarted everything and the address of the virtual machine is > 192.168.122.216 so on a different subnet. > > Looking at the output of ps aux | grep network, I found this: > > ja@Hawaiian:~$ ps aux | grep network > nobody 6157 0.0 0.0 22760 956 ? S 22:04 0:00 > dnsmasq --strict-order --bind-interfaces > --pid-file=/var/run/libvirt/network/default.pid --conf-file= > --listen-address 192.168.122.1 --except-interface lo --dhcp-range > 192.168.122.2,192.168.122.254 --dhcp-lease-max=253 > > ja@Hawaiian:~$ /sbin/ifconfig > br0 Link encap:Ethernet HWaddr 00:1d:7d:0d:2a:9f > inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0 > inet6 addr: fe80::21d:7dff:fe0d:2a9f/64 Scope:Link > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 > RX packets:5244 errors:0 dropped:0 overruns:0 frame:0 > TX packets:5619 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:0 > RX bytes:2243410 (2.1 MiB) TX bytes:726685 (709.6 KiB) > > eth0 Link encap:Ethernet HWaddr 00:1d:7d:0d:2a:9f > inet6 addr: fe80::21d:7dff:fe0d:2a9f/64 Scope:Link > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 > RX packets:12364 errors:0 dropped:0 overruns:0 frame:0 > TX packets:13297 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:1000 > RX bytes:7409297 (7.0 MiB) TX bytes:2040280 (1.9 MiB) > Interrupt:31 Base address:0xc000 > > lo Link encap:Local Loopback > inet addr:127.0.0.1 Mask:255.0.0.0 > inet6 addr: ::1/128 Scope:Host > UP LOOPBACK RUNNING MTU:16436 Metric:1 > RX packets:3377 errors:0 dropped:0 overruns:0 frame:0 > TX packets:3377 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:0 > RX bytes:8275766 (7.8 MiB) TX bytes:8275766 (7.8 MiB) > > virbr0 Link encap:Ethernet HWaddr fe:54:00:87:97:a6 > inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0 > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 > RX packets:95 errors:0 dropped:0 overruns:0 frame:0 > TX packets:69 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:0 > RX bytes:22584 (22.0 KiB) TX bytes:16266 (15.8 KiB) > > vnet0 Link encap:Ethernet HWaddr fe:54:00:87:97:a6 > inet6 addr: fe80::fc54:ff:fe87:97a6/64 Scope:Link > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 > RX packets:95 errors:0 dropped:0 overruns:0 frame:0 > TX packets:149 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:500 > RX bytes:23914 (23.3 KiB) TX bytes:21043 (20.5 KiB) > > so the question is how did virbr0 get here, and how do I alter it to > make my VM look like a normal network machine.
The default KVM networking setup is NAT with masquerading of a private network of 192.168.122.0/24 and with VMs assigned addresses in the 192.168.122.1-192.168.122.254 range via dhcp. In addition to ifconfig/ip, you can see the full host networking setup with "brctl show; ip route show; iptables -t nat -nL; virsh net-list --all; virsh net-dumpxml default" (for the latter, it's most probably "default" but "...net-list..." will have listed the name(s); furthermore, virsh won't exist if you don't have libvirt installed). vnet0 is a tap device that's created on the fly when you start a VM with NAT and virbr0 in order to allow network access. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/CAOdo=sy1gw_yyusjrsao+-werujmwcxkw8jno1azrblr0uj...@mail.gmail.com