difference between eth0 and venet0 configuration on CentOS 6.3 - linux

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

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.

Related

Are my centos venet0 settings causing url not to work on server?

I'm attempting to use node.js on centOS6 VPS to host a website. I have a basic app running and everything works when I go to the ip 198.11.54.18, however when I go to the domain name sluap.com I get page not found. I'm thinking something is wrong with my venet0 or venet0:0 configs, but I'm not sure what to look for. I can ping sluap.com, and the whois stuff all looks correct, so I figure it has to be a setting or step in centOS that I'm doing wrong. Maybe the problem is completely unrelated, any help would be appreciated, I've been trying to fix this for a long time.
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:65536 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:127.0.0.1 P-t-P:127.0.0.1 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:635 errors:0 dropped:0 overruns:0 frame:0
TX packets:1446 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:90742 (88.6 KiB) TX bytes:163205 (159.3 KiB)
venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:198.100.45.18 P-t-P:198.100.45.18 Bcast:198.100.45.18 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
venet0 settings:
DEVICE=venet0
BOOTPROTO=static
ONBOOT=yes
ARPCHECK="no"
IPADDR=127.0.0.1
NETMASK=255.255.255.255
BROADCAST=0.0.0.0
ARPCHECK="no"
venet0:0 settings:
DEVICE=venet0:0
ONBOOT=yes
ARPCHECK="no"
IPADDR=198.100.45.18
NETMASK=255.255.255.255
Because I was using a2 hosting I was under the impression that my name server was NS1.A2HOSTING.COM, but for their vps they use dns1.name-services.com instead. Apparently the problem had 0% to do with the loop back config or the venet0 configurations. They were all correct and working fine with a default centOS install...

Cassandra config change to use hostnames after ip's changed

Initial installation of Cassandra was done using IP addresses and it has been working for 6+ months. This past weekend DevOps changed security to not allow IP addresses and also reassigned new IP addresses. I modified the required files (cassandra.yaml, cassandra-rackdc.properties, etc) to contain hostnames. The issue is nodetool status gives the error, Failed to connect to '127.0.0.1:7199, and I do have JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=blah" in cassandra-env.sh. Any ideas how to proceed to the environment back up? Should I go through the same files and replace hostnames with the new IP addresses? Thanks.
There are two options to provide listen address in Cassandra.yaml.
listen_address
listen_interface
To be completely agnostic of the IP address or hostname, use the option of listen_interface and comment the listen_address. Here is the Cassandra.yaml change required
# Address or interface to bind to and tell other Cassandra nodes to connect to.
#
#listen_address: xx.xxx.xx.xxx
# Set listen_address OR listen_interface, not both. Interfaces must correspond
# to a single address, IP aliasing is not supported.
listen_interface: eth0
To figure out the actual listen_interface, issue the command
ifconfig -a
Pick the interface that shows, "UP BROADCAST RUNNING". (eth0 in mycase)
The output should look like
root#ip-xx-xxx-x-xxx:~# ifconfig -a
docker0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:xxx.xx.x.x Bcast:0.0.0.0 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:2 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:152 (152.0 B) TX bytes:0 (0.0 B)
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:xx.xxx.xx.xx Bcast:xx.xxx.xx.xx Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1
RX packets:169552382 errors:0 dropped:0 overruns:0 frame:0
TX packets:185182015 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:88406501352 (88.4 GB) TX bytes:126516101404 (126.5 GB)
lo Link encap:Local Loopback
inet addr:xx.xxx.xx.xx Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:38490371 errors:0 dropped:0 overruns:0 frame:0
TX packets:38490371 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:41155731774 (41.1 GB) TX bytes:41155731774 (41.1 GB)
Restart Cassandra and you should be good to go. Another advantage is that Cassandra.yaml no longer has to be different across your nodes (assuming all have the same network interface).

avahi : How to associate hostname with address of eth0:avahi generated by avahi-autoipd?

I am using avahi on a freescale imx6 board with a custom linux system (build by buildroot).
So I use avahi for address allocation (eth0:avahi) and hostname resolution.
My freescale imx6 board also uses an other interface with a "static" network address used in an other subnet mask (eth0).
I have also created an other interface eth0:0 with an other address (this third ethernet address is only created in order to understand my problem)
ifconfig of my freescale imx6 board :
eth0 Link encap:Ethernet HWaddr 1E:ED:19:27:1A:B3
inet addr:192.168.1.212 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3037485 errors:0 dropped:0 overruns:0 frame:0
TX packets:12312042 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:213265042 (203.3 MiB) TX bytes:1150418317 (1.0 GiB)
eth0:0 Link encap:Ethernet HWaddr 1E:ED:19:27:1A:B3
inet addr:134.124.45.23 Bcast:134.124.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth0:avahi Link encap:Ethernet HWaddr 1E:ED:19:27:1A:B3
inet addr:169.254.6.124 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:484 errors:0 dropped:0 overruns:0 frame:0
TX packets:484 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:32284 (31.5 KiB) TX bytes:32284 (31.5 KiB)
For my test, i use a pc connected with my freescale imx6 board. I launch command "avahi-browse -a -c -r -v " from this pc.
When I launch avahi-browes from my pc, I can see the hostname (name.local) of the freescale imx6 board but it is associated with the address of interface eth0:0 and not eth0:avahi. When i remove the interface eth0:0, the hostname of the freescale imx6 board is associated with eth0.
From my pc, I can ping freescale imx6 board using eth0, eth0:avahi address and eth0:0 (when it's activated)
My problem : I want, when i launch command "avahi-browse -a -c -r -v", my freescale imx6 board to return the address associated with eth0:avahi because, currently, my freescale imx6 board returns the last interface configurated (in my exemple, eth0:0)
Do you know how to do that ?
Thank you for your answers,

Cannot access Puppet Learning VM

I have set up puppet learning VM on VirtualBox. I can ssh into it with:
ssh root#127.0.0.1 -p 2222
However, the guide says to do facter ipaddress, and ssh into the ipaddress that outputs. I get 10.0.2.15.
If I try that ipaddress, it does not work. I want to get it to work.
Also, I am supposed to be able to access the Puppet gui from https://10.0.2.15 and am not able to do that. I think the two problems are related.
I have 3 adapters set up. 1. NAT, 2. host only adapter, 3. bridged network.
For #1, I have port forwarding set up (am not able to ssh without it).
eth0 Link encap:Ethernet HWaddr 08:00:27:44:00:48
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe44:48/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15892 errors:0 dropped:0 overruns:0 frame:0
TX packets:24276 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1232127 (1.1 MiB) TX bytes:2062554 (1.9 MiB)
eth1 Link encap:Ethernet HWaddr 08:00:27:72:B7:0E
BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
eth2 Link encap:Ethernet HWaddr 08:00:27:14:93:EE
BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
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:322880 errors:0 dropped:0 overruns:0 frame:0
TX packets:322880 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:233893154 (223.0 MiB) TX bytes:233893154 (223.0 MiB)
NICs
I don't see any IP assigned to your NICs except eth0. I assume this learning VM is based on centos, please configure your network adapters correctly first.
check:
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth1
/etc/sysconfig/network-scripts/ifcfg-eth2
/etc/udev/rules.d/70-persistent-net.rules
This is no puppet or virtualbox issue.
port forwarding
Accessing https://10.0.2.15 will not work, this is an internal NAT network IP. Please create an entry for your VMs NAT Adapter under Port-Forwarding, just map Host Port 10443 to guest port 443. If you try to access https://localhost:10443 in your browser you should reach the service running on this VM and listening on port 443.(Check if the service is running and the firewall/iptables is open on all needed ports).
Patrick is right. The configuration within the CentOS box is strange.
It's working for me under windows but on my Ubuntu system I had big trouble setting up the Training VM.
My Tip: just add 22 and 80 port forwordings in your virtualbox.
Change -> Network -> Adapter 1 -> Port-Forwarding -> add
Protokol: TCP | Host-Port: 2222 | Guest-IP: 10.0.2.15 | Guest-Port: 22
-> you may connect now by:
ssh localhost -p 2222 -l root
also:
Protokol: TCP | Host-Port: 8081 | Guest-IP: 10.0.2.15 | Guest-Port: 80
-> you may access the questguide via:
http://localhost:8081

How to configure 2 lan cards on ubuntu

I want to configure 2 lan cards on 1 pc such that it seems that both are connected on different networks.
Also i want the gateway of one lan card be the ip address of the other so that the traffic of one passes through the second. I am applying mitmproxy on my pc to monitor my own traffic.
I am new to ubuntu as well as networking. So if anything i have said is wrong, please do correct me.
ifconfig -a
eth0
Link encap:Ethernet HWaddr 00:1c:c0:0d:85:38
inet addr:10.0.0.55 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::21c:c0ff:fe0d:8538/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8094 errors:0 dropped:0 overruns:0 frame:0
TX packets:7628 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6890690 (6.8 MB) TX bytes:1094128 (1.0 MB)
eth1
Link encap:Ethernet HWaddr 10:fe:ed:01:ce:34
inet addr:10.0.0.95 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::12fe:edff:fe01:ce34/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2338 errors:0 dropped:0 overruns:0 frame:0
TX packets:2322 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1303961 (1.3 MB) TX bytes:256352 (256.3 KB)
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:65536 Metric:1
RX packets:3849 errors:0 dropped:0 overruns:0 frame:0
TX packets:3849 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1008514 (1.0 MB) TX bytes:1008514 (1.0 MB)
Thanks
You can try iptables to redirect traffic from 1 interface to other.
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j REDIRECT --to-ports 8080
will redirect all traffic coming on interface ppp0 on port 80 to port 8080 , where you can run an mitm proxy. Your mitm proxy can use eth0 to forward traffic out.
You might get a better response on serverfault or superuser.
In order to put two different network cards on two different networks you need to assign their IP's properly.
Based on the fact that you are using Net Mask of 255.255.255.0 setting one network card to have IP 10.0.0.1 and second to 10.0.1.1 would put them on two seperate networks. Netmask of 255.255.255.0 defines that your network can contain all IP's which have same first three numbers and fourth from 0 to 255. So if you change one of the first three numbers you put your network card on another network.
As for gateway it must be on the same network that your lan card is. So setting two network card to be on two seperate networks and then setting one lans card gateway to be the other network card won't work. Athleast not until you bridge the two networks together, but that won't prevent computers from one network to access computers on another which I belive is what you wanna do.

Resources