difference between eth0 and venet0 configuration on CentOS 6.3

TonyGW picture TonyGW · Nov 23, 2013 · Viewed 13.6k times · Source

I followed this tutorial to set up a nameser using BIND on my VPS built in CentOS 6.3 64-bit. I have two VPS servers, one is virtualized by Xen, and the other is by OpenVZ. I noticed that the two servers differ in their network interface: Xen server has eth0 (configured /etc/sysconfig/network-scripts/ifcfg-eth0), while OpenVZ has venet0 (/etc/sysconfig/network-scripts/ifcfg-venet0).

When I follow that tutorial, the nameserver on my Xen server is working well, but the nameserver on OpenVZ server does not work at all. This made me think why and what difference made them work differently for the nameserver?

The following is the result I got from "ifconfig" command:

[root@server1 data]# 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:112 errors:0 dropped:0 overruns:0 frame:0
          TX packets:112 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:10819 (10.5 KiB)  TX bytes:10819 (10.5 KiB)

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:50.31.115.236  P-t-P:50.31.115.236   Bcast:0.0.0.0  Mask:255.255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
          RX packets:539325 errors:0 dropped:0 overruns:0 frame:0
          TX packets:368277 errors:0 dropped:80 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:41142712 (39.2 MiB)  TX bytes:37293025 (35.5 MiB)

As you can see that venet0 has its inet addr:127.0.0.1. Could someone help me with understanding the differences? Thanks

Answer

coloncolonone picture coloncolonone · Nov 23, 2013

According to the information you included in your question venet0 has the IP 50.31.115.236. The 127.0.0.1 you see is for the special network interface lo.

Usually the first network interface is named eth0. Virtualizing with Xen doesn't change that as it is pretending to be just a normal hardware. OpenVZ is working a bit different and as I understand it the name of the ethernet device venet0 got set by the system administrator of the physical machine.

I can't take a look at the linked tutorial as I only get a blank page so can only give a general advice: Wherever it is showing eth0 use venet0 instead for the second system.