OpenVZ Forum


Home » General » Support » Networking? (NAT)
Networking? (NAT) [message #23280] Thu, 15 November 2007 08:22 Go to next message
RobinVossen is currently offline  RobinVossen
Messages: 36
Registered: November 2007
Member
Well, I tryed everything.
But I cant get networking of the OpenVZ nodes up.
They have a IP.
I think I did it correct with the networking.
I did do this:
iptables -t nat -A POSTROUTING -s 192.168.#NodeNumber#.0 -o eth0 -j SNAT --to 192.168.42.112

192.168.42.112 is the IP I got within this network.
So, what do I do wrong?
Cheers,
Robin

oh and the Nodes IP is:
192.168.#Node Group Number#.#Node Number in Group#

[Updated on: Thu, 15 November 2007 08:26]

Report message to a moderator

Re: Networking? (NAT) [message #23303 is a reply to message #23280] Thu, 15 November 2007 11:48 Go to previous messageGo to next message
vaverin is currently offline  vaverin
Messages: 708
Registered: September 2005
Senior Member
192.168.42.112 should be IP of your hardware node.
Otherwise reply packets will not reach your hardware node and cannot be deliverd back to VEs.
Re: Networking? (NAT) [message #23306 is a reply to message #23303] Thu, 15 November 2007 12:56 Go to previous messageGo to next message
RobinVossen is currently offline  RobinVossen
Messages: 36
Registered: November 2007
Member
So I should do:
iptables -t nat -A POSTROUTING -s 192.168.42.112 -o eth0 -j SNAT --to #OpenVEs PreDefined IP#
Re: Networking? (NAT) [message #23309 is a reply to message #23306] Thu, 15 November 2007 13:18 Go to previous messageGo to next message
vaverin is currently offline  vaverin
Messages: 708
Registered: September 2005
Senior Member
vice versa

http://wiki.openvz.org/Using_NAT_for_VE_with_private_IPs#How _to_provide_access_for_VE_to_Internet
# iptables -t nat -A POSTROUTING -s src_net -o eth0 -j SNAT --to ip_address

where src_net is a range of IP addresses of VEs to be translated by SNAT, and ip_address is the external IP address of your Hardware Node. Multiple rules are allowed, for example, in case you wish to specify several ranges of IP addresses. If you are using a number of physical network interfaces on the Node, you may need to specify a different interface for outgoing connections, e.g. -o eth2.
Re: Networking? (NAT) [message #23331 is a reply to message #23309] Thu, 15 November 2007 14:48 Go to previous messageGo to next message
RobinVossen is currently offline  RobinVossen
Messages: 36
Registered: November 2007
Member
THanks for your support. But I think I am thick or something...
I did run the following commands:
vzctl start 1
iptables -t nat -A POSTROUTING -s 192.168.1.1 -o eth0 -j SNAT --to 192.168.42.112
After that I did run vzlist output:
VPSID 1 NPROC 1 STATUS running IP_ADDR 192.168.1.1 HOSTNAME 1
Then I did vzctl enter 1
Now ping google.com (Error, unknown host google.com)
Exit (to get to my main system) ping google.com (Success)
ifconfig afterwards to check if I really aws 192.168.42.112.
Output:
eth0 inet addr:192.168.42.112

Bad Luck..

Were do I go wrong? Sad
Re: Networking? (NAT) [message #23333 is a reply to message #23331] Thu, 15 November 2007 15:06 Go to previous messageGo to next message
khorenko is currently offline  khorenko
Messages: 533
Registered: January 2006
Location: Moscow, Russia
Senior Member
Most probably you just haven't set up a dns server inside a VE.
Try to ping google.com via IP (i.e. ping 64.233.167.99) from inside VE. i think it should work.

if it works, just edit /etc/resolve.conf inside a VE (you can take settings from HN).


If your problem is solved - please, report it!
It's even more important than reporting the problem itself...
Re: Networking? (NAT) [message #23334 is a reply to message #23333] Thu, 15 November 2007 15:08 Go to previous messageGo to next message
khorenko is currently offline  khorenko
Messages: 533
Registered: January 2006
Location: Moscow, Russia
Senior Member
Btw, what is the gefault gateway on your Hardware Node? i suspect that it's also 192.168.1.1 (you can check with 'ip r l' command).

In this case it's better to use another IP for the VE.


If your problem is solved - please, report it!
It's even more important than reporting the problem itself...
Re: Networking? (NAT) [message #23335 is a reply to message #23334] Thu, 15 November 2007 15:14 Go to previous messageGo to next message
RobinVossen is currently offline  RobinVossen
Messages: 36
Registered: November 2007
Member
The Default Gateway on the Hardware Node is 192.168.42.0/24
And yea indeed I dont have DNS -.-' (I feel stupid I have this problem always with linux)

Ok, ill fix resolv.conf and hope it works then. thx already Smile
Re: Networking? (NAT) [message #23337 is a reply to message #23335] Thu, 15 November 2007 15:18 Go to previous messageGo to next message
RobinVossen is currently offline  RobinVossen
Messages: 36
Registered: November 2007
Member
It works!
Thanks Smile
I lost my second box btw.
Whats the deal with Private and root?

Thanks already Very Happy
Re: Networking? (NAT) [message #23382 is a reply to message #23337] Fri, 16 November 2007 09:56 Go to previous message
khorenko is currently offline  khorenko
Messages: 533
Registered: January 2006
Location: Moscow, Russia
Senior Member
RobinVossen wrote on Thu, 15 November 2007 18:18

Whats the deal with Private and root?

If i understood you right, you asked about the difference between /vz/private/* and /vz/root/* directories. Right?
If yes, please, take a look at message http://forum.openvz.org/index.php?t=msg&goto=20502&& amp; amp;srch=private+root#msg_20492

Vasily described them there.


If your problem is solved - please, report it!
It's even more important than reporting the problem itself...

[Updated on: Fri, 16 November 2007 10:07]

Report message to a moderator

Previous Topic: compiling kernel 2.6.8.1, net/ipv6/route.c: Error: request for member `lock' in something
Next Topic: Help with port to ARM architecture
Goto Forum:
  


Current Time: Wed Feb 28 06:32:52 GMT 2024

Total time taken to generate the page: 0.02452 seconds