a networking question

Tapas Mishra mightydreams at gmail.com
Sun Jan 9 16:10:47 UTC 2011


On Sat, Jan 8, 2011 at 9:53 PM, stan <stanb at panix.com> wrote:
> On Thu, Jan 06, 2011 at 07:26:26PM +0530, Tapas Mishra wrote:
>> On Thu, Jan 6, 2011 at 6:39 PM, stan <stanb at panix.com> wrote:
>> > I have a workstation in my lab with 10.04 on it. I want to create a
>> > situation where I can atache test devices on various 192.168.x.x subnets to
>> > one of the switches it is already pluged in to. Taht is I want multiple
>> > subnets on the smae physcial "wire" Here is what I have put in
>> > /etc/network/interfaces:
>> >
>> >
>> > But I cannot ping something on 192.168.1.x What am I doing wrong?
>> >
>> You need to enable ip forwarding on the machine where bridge is.
>> Correct entry for a bridge is as follows
>>
>> auto lo
>> iface lo inet loopback
>>
>> # The primary network interface
>> auto eth2
>> iface eth2 inet manual
>>
>> auto br0
>> iface br0 inet static
>>         address 192.168.1.14
>>         netmask 255.255.255.0
>>         network 192.168.1.0
>>         broadcast 192.168.1.255
>>         gateway 192.168.1.10
>>         # dns-* options are implemented by the resolvconf package, if installed
>>         dns-nameservers 192.168.13.2
>>         dns-search myserver.net
>>         bridge_ports eth2
>>         bridge_fd 9
>>         bridge_hello 2
>>         bridge_maxage 12
>>         bridge_stp off
>>
>> You can not have eth0 and br0 simultaneously at the same time.
>> The output of brctl show on my machine shows
>>
>> brctl show
>> bridge name   bridge id               STP enabled     interfaces
>> br0           8000.0026b9824238       no              eth2
>>                                                       vnet0
>>                                                       vnet1
>>                                                       vnet2
>>                                                       vnet3
>> Paste your outputs on paste.ubuntu.com here it becomes cluttered to read.
>
> I am still confused a bit. My setup is that I have  2 physical NIC's one
> goes to the corportae lan. The 2nd goes to an interanl lan. Tis is the lan
> that I also gave a bridge interface, so that I cna use VirtualBox on this
> machine. In addition, I want the 2nd interface to be able to use varos
> 192.168.x.x subnets. eth0 is the corporate LAN, and eth1 is the internal
> LAN.
Things change when you say you want to use a switch and when you say
it is Virtual Box.

Here are excerpts from Virtual Box's networking page

"As the virtual machine is connected to a private network internal to
VirtualBox and invisible to the host, network services on the guest
are not accessible to the host machine or to other computers on the
same network. However, like a physical router, VirtualBox can make
selected services available to the world outside the guest through
port forwarding. This means that VirtualBox listens to certain ports
on the host and resends all packets which arrive there to the guest,
on the same or a different port."

Here is the link
http://www.virtualbox.org/manual/ch06.html
So the Virtual Machines are accessing a network which is taken care by
Virtual box and not you unless you do some NAT etc on the base OS.

So the effort you are doing is not going in correct direction when you
say it was a switch.
Now I would like to ask a question do you have two NICs or is it just
that you are having one NIC and you give it 2 aliases and explain the
problem as above?
If this being the case then you need to re frame your question.

I remember a long time back some one came to me with a similar problem
and the problem was as simple as enabling some option via GUI in
advanced settings tab of Virtual box ( I do not remember the exact
thing)

>From your post it appears you are not clear with how bridge works.(No
pun intended just want to point you to right direction that you should
look for)

When you use a bridge then the NIC will be running in promiscuous
mode.It will receive all the packets (whether they were intended for
it or not) and then when it finds any of the packet intended towards
the VM the bridge will respond.
Since you installed Virtual box so this part is now not handled by
Ubuntu it is your Virtual box or any other hypervisor that comes into
picture to handle it.

So you just need one entry for a bridge and if you actually have 2 NIC
(2 means 2 physically different and both are on a different subnet)

Here is how the /etc/network/interfaces file should look

# The primary network interface

auto lo
iface lo inet loopback

#stan here eth1 is NIC1 and I am assuming it gets corporate IP via
dhcp which is common in corporate setting
#if that is not then add address netmask gateway accordingly

auto eth1
iface eth1 inet dhcp

#stan here eth2 is NIC2 which you want a bridge to work
auto eth2
iface eth2 inet manual
#to understand what manual is
http://manpages.ubuntu.com/manpages/lucid/man5/interfaces.5.html
# you will use this type for bridge on 2nd NIC
auto br0
iface br0 inet static
       address 192.168.1.14
       netmask 255.255.255.0
       network 192.168.1.0
       broadcast 192.168.1.255
       gateway 192.168.1.10
       # dns-* options are implemented by the resolvconf package, if installed
       dns-nameservers 192.168.13.2
       dns-search myserver.net
       bridge_ports eth2
       bridge_fd 9
       bridge_hello 2
       bridge_maxage 12
       bridge_stp off

#Note I have used both eth1 and eth2 in this file /etc/network/interface
Ubuntu will not do much when Virtualbox is running.
So just need a bridge on NIC2 with a configuration of bridge as I said
above and if both NIC1 and NIC2 are not in same subnet then IPTABLE
rules to forward traffice from NIC1 to NIC2 and vice versa.
Configuaration of NIC1 and NIC1 will be in same file
/etc/network/interface with an entry such as

iface eth1 inet static/dhcp

 //then follows settings for nic1
iface eth2 inet (dhcp/static/manual)
//bridge br0 and settings for bridge assuming nic2 is absent you do
not have to make settings for nic2 and bride if you are to use nic2
for the bridge and nic1 does not falls in your bridge.

In case you have not described your situation correctly then it is a
different stuff all together.




More information about the ubuntu-users mailing list