OpenVZ Forum


Home » General » Support » Newbie Question about network..
Newbie Question about network.. [message #38818] Thu, 04 February 2010 08:02 Go to next message
Lord Daedra is currently offline  Lord Daedra
Messages: 5
Registered: February 2010
Location: Kolchugino
Junior Member
Hello!

Host OS: Centos 5.4, VPS OS: Ubuntu 9.10.

I can't ping google.com on my VPS.

I used default Ubuntu template from this site, google nameserver 8.8.8.8 for VPS and ip 174.142.167.217.

vzctl create 217 --ostemplate ubuntu-9.10-x86 --ipadd 174.142.167.217 --hostname database.entropia.us --name database

vzctl set 217 --onboot yes --nameserver 8.8.8.8 --save

I need install public VEs (with their own IP addresses) so I'm look at http://wiki.openvz.org/Common_Networking_HOWTOs and use this command:
[host-node]# echo 1 > /proc/sys/net/ipv4/ip_forward

ifconfig on my host system:

Quote:
[root@cl-t127-072cl ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:30:48:B0:BA:D8
inet addr:67.205.67.10 Bcast:67.205.67.31 Mask:255.255.255.224
inet6 addr: fe80::230:48ff:feb0:bad8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:339100 errors:0 dropped:0 overruns:0 frame:0
TX packets:178932 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:492718192 (469.8 MiB) TX bytes:12945821 (12.3 MiB)
Memory:d0100000-d0120000

eth0:1 Link encap:Ethernet HWaddr 00:30:48:B0:BA:D8
inet addr:174.142.167.217 Bcast:174.142.167.223 Mask:255.255.255.248
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Memory:d0100000-d0120000

eth0:2 Link encap:Ethernet HWaddr 00:30:48:B0:BA:D8
inet addr:174.142.167.218 Bcast:174.142.167.223 Mask:255.255.255.248
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Memory:d0100000-d0120000

eth0:3 Link encap:Ethernet HWaddr 00:30:48:B0:BA:D8
inet addr:174.142.167.219 Bcast:174.142.167.223 Mask:255.255.255.248
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Memory:d0100000-d0120000

eth0:4 Link encap:Ethernet HWaddr 00:30:48:B0:BA:D8
inet addr:174.142.167.220 Bcast:174.142.167.223 Mask:255.255.255.248
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Memory:d0100000-d0120000

eth0:5 Link encap:Ethernet HWaddr 00:30:48:B0:BA:D8
inet addr:174.142.167.221 Bcast:174.142.167.223 Mask:255.255.255.248
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Memory:d0100000-d0120000

eth0:6 Link encap:Ethernet HWaddr 00:30:48:B0:BA:D8
inet addr:174.142.167.222 Bcast:174.142.167.223 Mask:255.255.255.248
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Memory:d0100000-d0120000

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:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:504 (504.0 b) TX bytes:504 (504.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)



next i start and enter to my VPS and see ifconfig command blank result..

Info from datacenter:

Primary IP address : 67.205.67.10
Primary IP mask : 255.255.255.224
Gateway : 67.205.67.1

Usable secondary addresses: 174.142.167.217-222
Mask : 255.255.255.248

So also I replaced all 255.255.255.255 in /etc/vz/dists/scripts/debian-add_ip.sh to 255.255.255.248 in debian add ip script...

P.S.
[root@cl-t127-072cl ~]# ip rule list
0: from all lookup 255
32766: from all lookup main
32767: from all lookup default

[root@cl-t127-072cl ~]# iptables -t nat -L && iptables -t filter -L && iptables -t mangle -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain PREROUTING (policy ACCEPT)
target prot opt source destination

Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination

Please help me, where is my error?
Re: Newbie Question about network.. [message #38820 is a reply to message #38818] Thu, 04 February 2010 09:33 Go to previous messageGo to next message
Paparaciz
Messages: 302
Registered: August 2009
Senior Member
I think you should also define gw for yours 174.142.167.xxx range

as I understand you configured to use veth, so for each VE you have to add gw
Re: Newbie Question about network.. [message #38822 is a reply to message #38820] Thu, 04 February 2010 13:33 Go to previous messageGo to next message
Lord Daedra is currently offline  Lord Daedra
Messages: 5
Registered: February 2010
Location: Kolchugino
Junior Member
I dont know what is better veth or venet.. what is more easy to install? Smile

Ok, venet..

1. I need run

a) [host-node]# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

or

b) [host-node]# iptables -t nat -A POSTROUTING -o eth0:1 -j MASQUERADE
[host-node]# iptables -t nat -A POSTROUTING -o eth0:2 -j MASQUERADE
[host-node]# iptables -t nat -A POSTROUTING -o eth0:3 -j MASQUERADE
[host-node]# iptables -t nat -A POSTROUTING -o eth0:4 -j MASQUERADE
[host-node]# iptables -t nat -A POSTROUTING -o eth0:5 -j MASQUERADE
[host-node]# iptables -t nat -A POSTROUTING -o eth0:6 -j MASQUERADE
(for every IP)
?

I tried a) and reboot after - but it doesnt help for me

(Its from guide http://wiki.openvz.org/Common_Networking_HOWTOs )

2. Here http://forum.openvz.org/index.php?t=msg&&th=7188& ;amp ;amp ;goto=34847#msg_34847 I find this
route add default gw 192.168.1.1 dev eth0

I tried run this command in VPS but get error

root@database:/# route add default gw 67.205.67.1 dev eth0
SIOCADDRT: No such device
root@database:/# ifconfig
root@database:/#

Yes, I see what no devices but why they did not installed when I used "set 217 --ipadd 174.142.167.217 --save" and how to install them?
ifconfig return blank result but I dont know how to fix this..

root@database:/# cat /etc/network/interfaces
# This configuration file is auto-generated.
# WARNING: Do not edit this file, otherwise your changes will be lost.
# Please edit template /etc/network/interfaces.template instead.


auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0
broadcast 127.255.255.255
up ip route replace 127.0.0.0/8 dev lo


# Auto generated interfaces
auto lo
iface lo inet loopback

auto venet0
iface venet0 inet static
address 127.0.0.1
netmask 255.255.255.248
broadcast 67.205.67.1
up route add -net 192.0.2.1 netmask 255.255.255.248 dev venet0
up route add default gw 192.0.2.1
auto venet0:0
iface venet0:0 inet static
address 174.142.167.217
netmask 255.255.255.248
broadcast 67.205.67.1

May be I need change smth in /etc/network/interfaces.template ?

Please tell me any easy way how to setup Internet connecton for my VPSes

P.S. On node:
[root@cl-t127-072cl ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
174.142.167.219 0.0.0.0 255.255.255.255 UH 0 0 0 venet0
174.142.167.218 0.0.0.0 255.255.255.255 UH 0 0 0 venet0
174.142.167.217 0.0.0.0 255.255.255.255 UH 0 0 0 venet0
174.142.167.216 0.0.0.0 255.255.255.248 U 0 0 0 eth0
67.205.67.0 0.0.0.0 255.255.255.224 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 67.205.67.1 0.0.0.0 UG 0 0 0 eth0

(3 VPSes)


[Updated on: Thu, 04 February 2010 13:38]

Report message to a moderator

Re: Newbie Question about network.. [message #38823 is a reply to message #38822] Thu, 04 February 2010 14:04 Go to previous messageGo to next message
Paparaciz
Messages: 302
Registered: August 2009
Senior Member
you wroted that:
Usable secondary addresses: 174.142.167.217-222
Mask : 255.255.255.248

who gave you this ip addresses?
they are not public, they are private ip addresses
http://en.wikipedia.org/wiki/Private_network#Private_IPv4_ad dress_spaces

as i see you have only one public ip address

so if you want to have internet inside VE do following config:
remove all the eth aliases (eth0:0 - eth0:x), leave only eth0

add private ip address to VE (for example 174.142.167.217)
then do

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

that's all
if you want to have VE with public ip addresses ask them from your provider and assign them to VE.

if you want assign services for your VE and you have only one public ip just forward port to you VE in HN.

further reading:
http://wiki.openvz.org/Using_NAT_for_container_with_private_ IPs
http://wiki.openvz.org/Common_Networking_HOWTOs
http://wiki.openvz.org/Containers/Networking

and of course read the
http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf

Re: Newbie Question about network.. [message #38824 is a reply to message #38818] Thu, 04 February 2010 15:35 Go to previous messageGo to next message
Lord Daedra is currently offline  Lord Daedra
Messages: 5
Registered: February 2010
Location: Kolchugino
Junior Member
I got them in my datacenter (iWeb)

They are all public..
http://ws.arin.net/whois/?queryinput=174.142.167.217

[Updated on: Thu, 04 February 2010 15:35]

Report message to a moderator

Re: Newbie Question about network.. [message #38825 is a reply to message #38818] Thu, 04 February 2010 17:30 Go to previous messageGo to next message
Paparaciz
Messages: 302
Registered: August 2009
Senior Member
yes, sorry.
but that doesn't change much...
as I see you should follow this guide
http://wiki.openvz.org/VEs_and_HNs_in_different_subnets

but maybe you can try another way
do as i said in previuos message and add to your /etc/sysctl.conf
net.ipv4.conf.eth0.proxy_arp = 1
and then
sysctl -p
to apply changes
then you should get to the internet from VE
Re: Newbie Question about network.. [message #38828 is a reply to message #38818] Fri, 05 February 2010 07:18 Go to previous messageGo to next message
Lord Daedra is currently offline  Lord Daedra
Messages: 5
Registered: February 2010
Location: Kolchugino
Junior Member
> remove all the eth aliases (eth0:0 - eth0:x), leave only eth0

Thanks, its solve my problem. (I used commands from this page http://www.cyberciti.biz/faq/linux-command-to-remove-virtual -interfaces-or-network-aliases/ )

Yesterday I tested on ubuntu cache tpl from this site, its bugged.. So network will not work and with correct settings. Smile

I recommend use this tpl for ubuntu
http://blog.bodhizazen.net/linux/download-ubuntu-9-10-openvz -templates/comment-page-1/

P.S.
I used iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE command but I think , I need not it. How to cancel the effect of this command? (Do I need it?)
Re: Newbie Question about network.. [message #39465 is a reply to message #38818] Wed, 28 April 2010 12:30 Go to previous message
teekien is currently offline  teekien
Messages: 11
Registered: April 2010
Junior Member
This is exactly what I had in mind too!
Previous Topic: NIS Server in Open-vz
Next Topic: Access Internet from private IP CT
Goto Forum:
  


Current Time: Sat Aug 17 15:17:37 GMT 2024

Total time taken to generate the page: 0.02688 seconds