# OpenVZ Networking Problem - What am I missing here?

## Master One

Running OpenVZ on a Gentoo x86_64 installation, openvz-kernel 2.6.18-028stab045, hardware node has IP address 192.168.1.10.

I proceeded exactly as mentioned in the OpenVZ wiki, but downloaded a Gentoo stage4 archive to be used as ostemplete as explained in the Gentoo OpenVZ Wiki, because that one contains the new baselayout-2, which is compatible with OpenVZ.

Everything looks good until this point:

```
vhost ~ # vzctl create 101

Creating VE private area (gentoo-amd64-20070905)

Performing postcreate actions

VE private area was created

vhost ~ # vzctl set 101 --onboot yes --save

Saved parameters for VE 101

vhost ~ # vzctl start 101

Starting VE ...

VE is mounted

Setting CPU units: 1000

VE start in progress...

vhost ~ # vzctl set 101 --hostname test101.my.org --save

Set hostname: test101.my.org

Saved parameters for VE 101

vhost ~ # vzctl set 101 --ipadd 192.168.1.11 --save

Adding IP address(es): 192.168.1.11

bash: line 394: /etc/init.d/net.venet0: No such file or directory

Saved parameters for VE 101
```

There seems to be problem with the network-setup-script, no idea, if this has to do with the new baselayout, but ok, fixing this issue manually:

```
vhost ~ # cd /vz/private/101/etc/init.d && ln -s net.lo net.venet0 && cd -

vhost ~ # vzctl set 101 --ipdel 192.168.1.11 --save

Deleting IP address(es): 192.168.1.11

Saved parameters for VE 101

vhost ~ # vzctl set 101 --ipadd 192.168.1.11 --save

Adding IP address(es): 192.168.1.11

 * Bringing up interface venet0

 *   192.168.1.11/32 ... [ ok ]

 * Caching service dependencies ... [ ok ]

Saved parameters for VE 101

vhost ~ # vzctl set 101 --nameserver 192.168.1.1 --save

File resolv.conf was modified

Saved parameters for VE 101

vhost ~ # vzctl enter 101

entered into VE 101

test101 / # ping -c1 ping.inode.at

ping: unknown host ping.inode.at

test101 / # ping -c1 192.168.1.10 

connect: Network is unreachable

test101 / # ifconfig

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:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  

          inet addr:192.168.1.11  P-t-P:192.168.1.11  Bcast:0.0.0.0  Mask:255.255.255.255

          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1

          RX packets:8 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:624 (624.0 b)  TX bytes:0 (0.0 b)

test101 / # cat /etc/conf.d/net

config_venet0=(    "192.168.1.11/32" )

test101 / # cat /etc/resolv.conf 

search home.xnull.de croup.de xnull.de rlp.newthinking.de

nameserver 192.168.1.1

test101 / # route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

loopback        test101.my.org  255.0.0.0       UG    0      0        0 lo
```

So something is completely wrong here, and I have no clue on how to proceed. 

I have read about a net.venet0.0, which is supposed to be created in the VE, but that device is not present in my installation.

I also read about SNAT on the hardware node, but that seems to be irrelevant in my case, because both (hardware node & VE) have private IPs and are in the same subnet.

When playing around with the network setup in the VE, I could get it going by manually setting up /etc/conf.d/net as follows:

```
dns_servers_venet0="192.168.1.1"

config_venet0=( "192.168.1.11/24" )

routes_venet0=( "default via 192.168.1.1" )
```

and restarting the net.venet0 interface, but on one hand, that does not seem to be the correct way for setting up the venet device, on the other hand this setting gets overwritten once the VE is restarted (especially the net for this IP gets changed from /24 to /32, and the routes entry get modified to "-net 192.0.2.0" "default via 192.0.2.1", which is a fake gateway, that I have no clue how this is supposed to work.

I have to admit, that I don't really understand, how the interaction of eth0 & venet0 on the hardware node, and the venet0 & (missing) venet0.0 is supposed to be working.

So what's the deal here?

Are the OpenVZ scripts responsible for network setup in a VE outdated?

Why is it not mentioned, how the network setup is exactly supposed to be working in the OpenVZ wiki (Gentoo Template Creation), the Gentoo OpenVZ Howto, or the general OpenVZ instructions?

----------

## bpaddock

 *Master One wrote:*   

> Running OpenVZ on a Gentoo x86_64 installation, openvz-kernel 2.6.18-028stab045, hardware node has IP address 192.168.1.10.
> 
> I proceeded exactly as mentioned in the OpenVZ wiki, but downloaded a Gentoo stage4 archive to be used as ostemplete as explained in the Gentoo OpenVZ Wiki, because that one contains the new baselayout-2, which is compatible with OpenVZ....

 

Did you ever find a solution, I just ran into the same issues?

I'm using this template: http://www.funtoo.org/linux/openvz/i686/gentoo-openvz-i686-2008.02.25.tar.gz.

I tried the wiki templates and they had similar issues.

----------

## Master One

No, gave up on OpenVZ at that time.

----------

## jon123

I had similar problems but then got it to work with the 2006 template from OpenVZ.

I followed these instructions for setting up my Gentoo Box:

http://www.gentoo-wiki.com/HOWTO_OpenVZ

Then I made my own template following the instructions in (I didn't do a shared portage):

http://wiki.openvz.org/Gentoo_template_creation

This helped a lot to understand how OpenVZ networking works (venet is what I am using):

http://wiki.openvz.org/Differences_between_venet_and_veth

This helped me make my OpenVZ instances available to the Lan (iptables):

http://wiki.openvz.org/Common_Networking_HOWTOs

You do not have to edit the networking config files in your OpenVZ machines.  I know they look wrong, that is how venet works.  I followed the instructions verbatim on a fresh install of 2008 beta 2.

Sorry for not posting something more constructive relating to your exact problem.  I think those pages will help  :Smile: 

----------

## jon123

while using the 2006 gentoo template from OpenVZ I did have to:

```

cd /etc/init.d

ln -s net.lo net.venet0

```

It wasn't there by default.  I didn't have this problem the template I made.

----------

