OpenVZ Forum


Home » General » Support » Re: Can't resolve host address within container [SOLVED]
icon9.gif  Re: Can't resolve host address within container [SOLVED] [message #42863] Sat, 11 June 2011 13:22 Go to next message
plotinus is currently offline  plotinus
Messages: 11
Registered: June 2011
Junior Member
Hi all,
First of all, I apologyze for my poor english Embarassed
I am a total newbie and I am desperated.
I've installed openVZ in a centOS 5.6, I can work with containers but i can't resolve any internet address within containers.
I just can ping, but when I make a wget, I always receive a wget: unable to resolve host address "google.com" message.
I've read lots of forums and messages, but I've found no solution. I'm not an expert in linux, nor networks.
I create the containers as follows:

  • vzctl create 101 --ostemplate fedora-14-x86_64
  • vzctl set 101 --ipadd 192.168.1.101
  • vzctl set 101 --nameserver 62.14.4.64 --nameserver 62.14.4.65



My /etc/sysctl.conf file:
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

net.ipv4.conf.default.forwarding = 1

net.ipv4.conf.all.forwarding = 1

net.ipv4.conf.default.proxy_arp = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

net.ipv4.conf.default.send_redirects = 1

net.ipv4.conf.all.send_redirects = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 1

# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536

# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296


My /etc/resolv.conf file:
nameserver 62.14.4.64
nameserver 62.14.4.65


Result of ifconfig:
eth0      Link encap:Ethernet  HWaddr 00:1E:90:E5:B8:22  
          inet addr:192.168.1.12  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21e:90ff:fee5:b822/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:449 errors:0 dropped:0 overruns:0 frame:0
          TX packets:311 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:45496 (44.4 KiB)  TX bytes:65981 (64.4 KiB)
          Interrupt:233 Base address:0xc000 

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:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:560 (560.0 b)  TX bytes:560 (560.0 b)

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet6 addr: fe80::1/128 Scope:Link
          UP BROADCAST POINTOPOINT RUNNING NOARP  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:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

virbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:6913 (6.7 KiB)

Please can anyone help me? I don't know what can I do, I'm testing and changing without direction.
Thanks for your interest!

Added:
I tested:
ifconfig venet0 192.168.1.102 netmask 255.255.255.0 broadcast 192.168.1.255
and container 102 wgot web pages!
Only for the first time... never more!

[Updated on: Thu, 16 June 2011 21:43]

Report message to a moderator

Re: Can't resolve host address within container [message #42866 is a reply to message #42863] Mon, 13 June 2011 05:40 Go to previous messageGo to next message
Kristian0911 is currently offline  Kristian0911
Messages: 9
Registered: April 2011
Junior Member
Hi,

Try to set resolvers for the container as :

nameserver 8.8.8.8
nameserver 208.67.222.222
nameserver 208.68.222.222

Then try to wget...... It should work for you Smile
Re: Can't resolve host address within container [message #42868 is a reply to message #42866] Mon, 13 June 2011 07:40 Go to previous messageGo to next message
plotinus is currently offline  plotinus
Messages: 11
Registered: June 2011
Junior Member
Thank you for your answer!
But it doesn't work, "unable to resolve host address" again.
Aaagghhh!!!

[Updated on: Mon, 13 June 2011 07:40]

Report message to a moderator

Re: Can't resolve host address within container [message #42870 is a reply to message #42863] Mon, 13 June 2011 11:56 Go to previous messageGo to next message
curx
Messages: 739
Registered: February 2006
Location: N├╝rnberg, Germany
Senior Member

Hi,

Your container has a "private" IPv4 Address and should reach a official IPv4,
see OpenVZ Wiki http://wiki.openvz.org/Using_NAT_for_container_with_private_ IPs#How_to_provide_access_for_container_to_Internet

Bye,
Thorsten
Re: Can't resolve host address within container [message #42871 is a reply to message #42870] Mon, 13 June 2011 12:17 Go to previous messageGo to next message
plotinus is currently offline  plotinus
Messages: 11
Registered: June 2011
Junior Member
Thank you, Thorsten,
I will study it and test it. I'll say you if it goes or not (I hope yes).

[Updated on: Mon, 13 June 2011 12:19]

Report message to a moderator

Re: Can't resolve host address within container [message #42888 is a reply to message #42870] Tue, 14 June 2011 15:43 Go to previous messageGo to next message
plotinus is currently offline  plotinus
Messages: 11
Registered: June 2011
Junior Member
iptables crashed, but I'm thinking...
I want to virtualize some web sites and to reach the containers (my web sites) thru the internet: I want to see my website using the browser, say writing h_t_t_p://mydomain.com.

Do I need to have internal IP addresses like 192.168.1.x?
Now I create a container with an external IP, not an internal one:
vzctl create 101 (I use a config file)
vzctl set 101 --ipadd 85.43.xx.xx (the IP of mydomain.com)

For the moment, let's forget iptables.
If I create my containers using an external IP, do I have access to the internet? (for the moment it doesn't happen, maybe for the crash of iptables. I think I must reinstall centOS!).

icon14.gif  Re: Can't resolve host address within container [SOLVED] [message #42919 is a reply to message #42870] Thu, 16 June 2011 21:42 Go to previous messageGo to next message
plotinus is currently offline  plotinus
Messages: 11
Registered: June 2011
Junior Member
Finally I did it!
Your post was the solution, thank you!! It was the information I needed.
Yes, the containers (in my case) must have a private IP, not a public one (I was wrong) and then your link applies.
The problem is iptables, but if I stop iptables, I get access to/from the internet.
But this is another story....
Thank you again Very Happy
Re: Can't resolve host address within container [SOLVED] [message #50761 is a reply to message #42863] Mon, 28 October 2013 05:02 Go to previous message
sarh877 is currently offline  sarh877
Messages: 5
Registered: October 2013
Junior Member
Hi,

I got the same problem like you. and when I show ifconfig on my container,

it shows:

(the container does not have eth0)

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:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:560 (560.0 b) TX bytes:560 (560.0 b)

venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet6 addr: fe80::1/128 Scope:Link
UP BROADCAST POINTOPOINT RUNNING NOARP 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:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:6913 (6.7 KiB)



please help me to find out the problem.thanks so much!

[Updated on: Mon, 28 October 2013 05:03]

Report message to a moderator

Previous Topic: container can't not access to the Internet
Next Topic: Ploop mount/umount issue
Goto Forum:
  


Current Time: Sun Feb 05 05:31:05 GMT 2023

Total time taken to generate the page: 0.01194 seconds