OpenVZ Forum


Home » General » Support » *SOLVED* internet access from VM
*SOLVED* internet access from VM [message #26195] Thu, 17 January 2008 01:43 Go to next message
Thomasd is currently offline  Thomasd
Messages: 39
Registered: December 2007
Member
let's ping yahoo:

(from the hn)

# ping 216.109.112.135
PING 216.109.112.135 (216.109.112.135) 56(84) bytes of data.
64 bytes from 216.109.112.135: icmp_seq=1 ttl=49 time=80.5 ms

--- 216.109.112.135 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 80.597/80.597/80.597/0.000 ms


# vzctl enter 8010
entered into VE 8010

# ping 216.109.112.135
PING 216.109.112.135 (216.109.112.135) 56(84) bytes of data.

--- 216.109.112.135 ping statistics ---
37 packets transmitted, 0 received, 100% packet loss, time 36004ms



]# 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: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:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:3108 (3.0 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:10.0.80.10  P-t-P:10.0.80.10  Bcast:10.0.80.10  Mask:255.255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1


so, the VM can communicate back and forth with the HN, but not to the outside world.
To serve web pages: I use the pound reverse proxy to determine the source domain (a.com, b.com, etc) and connect to the appropriate VM; this works perfectly, but I would also like the VM to be able to initiate connections to the outside world. How do I go about this (while keeping the original structure with the proxy)?

[Updated on: Fri, 18 January 2008 05:30] by Moderator

Report message to a moderator

Re: internet access from VM [message #26222 is a reply to message #26195] Thu, 17 January 2008 17:26 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hi,

1. You can use 'tcpdump' (on HN and inside VE) to determine packets behavior?
2. Are you using private IP for your VE? Please look at this page
http://wiki.openvz.org/Using_NAT_for_VE_with_private_IPs

Thank You!
Re: internet access from VM [message #26233 is a reply to message #26195] Fri, 18 January 2008 00:26 Go to previous messageGo to next message
Thomasd is currently offline  Thomasd
Messages: 39
Registered: December 2007
Member
it works! thanks.
Re: *SOLVED* internet access from VM [message #26895 is a reply to message #26195] Mon, 04 February 2008 23:05 Go to previous messageGo to next message
joker2048 is currently offline  joker2048
Messages: 9
Registered: March 2007
Junior Member
Could you please explain how do you solved this problem?
Re: *SOLVED* internet access from VM [message #26899 is a reply to message #26895] Tue, 05 February 2008 00:39 Go to previous message
Thomasd is currently offline  Thomasd
Messages: 39
Registered: December 2007
Member
I followed the info at:
http://wiki.openvz.org/Using_NAT_for_VE_with_private_IPs

In the end, it ended up being:

iptables -t nat -A POSTROUTING -s <my VM's ip> -o eth0 -j SNAT --to <my outside ip>

then, the VMs are able to initiate connections to the outside.
Previous Topic: Another TUN/TAP topic :-)
Next Topic: default bandwidth limitation for venet?
Goto Forum:
  


Current Time: Tue Aug 27 13:26:34 GMT 2024

Total time taken to generate the page: 0.03667 seconds