Page 1 of 1

Host Interface Networking

Posted: 8. May 2008, 23:51
by Brendan
Can someone please please please tell me how to fix this so Host Networking works on Mandriva 2008.1

I have the following file...

tunctl -t tap0 -u user
chmod 666 /dev/net/tun
brctl addbr br0
ifconfig eth0 0.0.0.0 promisc
brctl addif br0 eth0
dhclient br0
brctl addif br0 tap0
ifconfig tap0 192.168.2.50 up
echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp
route add -host 192.168.2.4 dev tap0
arp -Ds 192.168.2.4 eth0 pub

For the life of me I cant get it to work. I even added a ifcfg-br0 file as well as adding BRIDGE=br0 to ifcfg-eth0.

I about ready to switch back to VMWare Server... Anyone please help.

Thanks,
Brendan

Posted: 8. May 2008, 23:54
by Sasquatch
Really, learn more about bridging. You never set an IP address to an interface that is part of a bridge. Always set an IP to the bridge itself. As you already use DHCP to obtain an IP for your bridge, adding the tap0 interface should be enough. Then you can start your VM and enjoy it being part of your network.

Posted: 9. May 2008, 01:22
by Brendan
Thanks for the info...

Please tell me what I'm doing wrong in the script. What to I need to keep and remove would be very helpful. I am a newbie at this so your help would be great.

Thanks,
Brendan

Posted: 9. May 2008, 03:32
by sacul
Brendan,

I use these command on Mandriva 2008.1

I run them as two seperate scripts as root.

There are 2 scripts because the dhclient command has to search and be allocated an ip address which may be used to alter the ip address in the second script.
Script 1. contains
/usr/bin/tunctl -t tap0 -u your_user_id
chmod 666 /dev/net/tun
brctl addbr br0
ifconfig eth1 0.0.0.0 promisc
brctl addif br0 eth1 (or eth0 or...)

Script 2 contains
brctl addif br0 tap0
ifconfig tap0 192.168.1.192 up ---- where 192.168.1.192 is any ip not
-----allocated on your local subnet

echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp
route add -host 192.168.1.89 dev tap0 ---- here 192.168.1.89 is the ip
arp -Ds 192.168.1.89 eth1 pub ---- allocated by the dhclient


In virtual box specify Host as the network interface and tap0 as the network interface name.


Trust that this works ok for you.

You should probably start by pasting each line separately as listed above and note the feedback from the terminal if any - most command complete silently.

regards

saCUL

Posted: 9. May 2008, 03:35
by sacul
Also -- this currently only works with version upto 1.5.6

I installed 1.6 and could not get things working - even installing a different virtual intel network card and installing the drivers under the running guest did not work...


saCUL

Host Interface Woes

Posted: 9. May 2008, 14:17
by RayHaque
I have done well by not using the vbox adapter at all. I am using same tricks you all are with the tap adapters.

I'm running Ubuntu 8.04 LTS, and this is the script I am using. One Virtual Machine uses tap0 and another uses tap1. Works flawlessly ...

Code: Select all

# Don't need these, so they die
ifconfig vbox0 down
ifconfig eth1 down
# Throw up a bridge
brctl addbr br0
# Add my main card to the bridge
brctl addif br0 eth0
ifconfig eth0 0.0.0.0 promisc
# Bridge goes up
ifconfig br0 up
# Bridge obtains an IP address
dhclient br0
# Give me a virtual adapter
modprobe tun
tunctl -t tap0 -u rayhaque
tunctl -t tap1 -u rayhaque
# Add the adapter to the bridge
brctl addif br0 tap0
brctl addif br0 tap1
chmod 0666 /dev/net/tun
ifconfig tap0 up
ifconfig tap1 up
Note - Running this on Ubuntu requires that you install both bridge-utils and uml-utilities.

static ip?

Posted: 14. May 2008, 12:29
by thomasjohansen
@RayHaque

Could you make an example of your script where both VM's gets a static ip?

where the ip range of cource is like the host.


I tried this but dont know much about network on ubuntu:

auto br0
iface br0 inet static
address 10.192.68.45
netmask 255.255.255.0
gateway 10.192.68.1
bridge_ports eth0


Then i used the adapter to link vbox0 to br0 by

sudo VBoxAddIF vbox0 thomas br0



thx in advange
Thomas

extra question

Posted: 14. May 2008, 17:01
by thomasjohansen
I dont know if i understood all this correctly.

Do i have to have 3 network cards in the host pc to have one ubuntu host server and two guest systems in the same ip address area??

or will the host pc network card act as if it had 3 ip's?


Sorry for this "beginner" question but just need to make sure.

I know another solution could be port forwarding, but not interested in that solution.

Thomas

Posted: 15. May 2008, 12:01
by thomasjohansen
tried entering your script directly in the console because I dont know how to make scripts and execute them(manually or automatic)

i managed to run every line without any error messages. (after a couple of tries)



sudo ifconfig vbox0 down
sudo brctl addbr br0
sudo brctl addif br0 eth0
sudo ifconfig eth0 0.0.0.0 promisc
sudo ifconfig br0 up
sudo dhclient br0
sudo modprobe tun
sudo tunctl -t tap5 -u thomas
sudo brctl addif br0 tap5
sudo chmod 0666 /dev/net/tun
sudo ifconfig tap5 up

added tap5 in VBOX

My guest (winXP) booted fine but could'nt get a ip from dhcp. :(
its strange because when setting my guest to use NAT it works fine with internet access, but in HIF it just wont.


still would like to see how you setup the script for static ip.



my question about the need of multiple Nic's has been answered elseware (result = No dont need multible NIC)



Thomas

Posted: 16. May 2008, 13:26
by thomasjohansen
When running the listed beneath it says it uses mask 255.255.255.255 when my entire lan is on 255.255.255.0. could this be the reason why it doesnt work and any suggestions on how to correct it?



thomas@ubuntu-server:~$ sudo ifconfig vbox0 down
thomas@ubuntu-server:~$ sudo brctl addbr br0
thomas@ubuntu-server:~$ sudo brctl addif br0 eth0
thomas@ubuntu-server:~$ sudo ifconfig eth0 0.0.0.0 promisc
thomas@ubuntu-server:~$ sudo ifconfig br0 up
thomas@ubuntu-server:~$ sudo dhclient br0
Internet Systems Consortium DHCP Client V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/br0/00:1f:29:d1:3f:c8
Sending on LPF/br0/00:1f:29:d1:3f:c8
Sending on Socket/fallback
DHCPREQUEST of 10.192.67.149 on br0 to 255.255.255.255 port 67
DHCPACK of 10.192.67.149 from 10.192.67.1
bound to 10.192.67.149 -- renewal in 112344 seconds.
thomas@ubuntu-server:~$ sudo modprobe tun
thomas@ubuntu-server:~$ sudo tunctl -t tap0 -u thomas
Set 'tap0' persistent and owned by uid 1000
thomas@ubuntu-server:~$ sudo brctl addif br0 tap0
thomas@ubuntu-server:~$ sudo chmod 0666 /dev/net/tun
thomas@ubuntu-server:~$ sudo ifconfig tap0 up
thomas@ubuntu-server:~$