Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Setup a centos 6 server at home and installed openvz kernel and all working fine.

My only issue is routing IPs to the containers (typing the different IPs in from another PC showed my default web server so I know it is working there) - I have assigned 2 IPs to the one NIC in centos but my problem has been routing that to the container on the openvz stack with that IP - could it be simple config I am missing?

any help would be appreciated

  • 192.168.2.49 - actual server running openvz + centos stack
  • 192.168.2.100 - should route to the openvz container on the server but is routing to the same place as main IP

UPDATE

ifconfig output:

eth0      Link encap:Ethernet  HWaddr 00:1C:C0:94:33:28
          inet addr:192.168.2.49  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::21c:c0ff:fe94:3328/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4926 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4822 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:577713 (564.1 KiB)  TX bytes:1767109 (1.6 MiB)
          Interrupt:20 Memory:d0300000-d0320000

eth0:0    Link encap:Ethernet  HWaddr 00:1C:C0:94:33:28
          inet addr:192.168.2.100  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:20 Memory:d0300000-d0320000

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:97 errors:0 dropped:0 overruns:0 frame:0
          TX packets:97 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:5748 (5.6 KiB)  TX bytes:5748 (5.6 KiB)

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:53 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:3478 (3.3 KiB)  TX bytes:0 (0.0 b)

veth101.0 Link encap:Ethernet  HWaddr 00:18:51:10:37:76
          inet6 addr: fe80::218:51ff:fe10:3776/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:4 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

and vzlist -a output

      CTID      NPROC STATUS    IP_ADDR         HOSTNAME
       101         16 running   192.168.2.100   -
share|improve this question

closed as off topic by sysadmin1138 Sep 30 '12 at 2:14

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Have you ever heard of Proxmox? Probably make your life a lot easier. proxmox.com/products/proxmox-ve –  HTTP500 Mar 6 '12 at 16:13
    
yes I have heard of it but wanting to do it manually and learn it myself - thanks for link though will check it out if I loose my hair! :) –  chrishanson Mar 6 '12 at 16:18
add comment

1 Answer 1

up vote 1 down vote accepted

Please ensure that you have the following in the file /etc/sysctl.conf :

net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0

Check also your firewall rules, you need to have this rule :

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Good luck !

share|improve this answer
    
got the first bit - will try the second now! thanks –  chrishanson Mar 6 '12 at 16:04
    
tried that command and did nothing after restarting service - went to file and did not put anything in there so added it by hand it input section - did not work tried it then in forward section and did not work - any ideas? thanks –  chrishanson Mar 6 '12 at 16:09
    
Are you using venet or veth interface on your conainers ? Please also provide us the result of the commands : vzlist -a and ifconfig. –  Blueicefield Mar 6 '12 at 16:26
    
It's look like you have make a mixing between the configuration of a venet and a veth interface. Try to delete the eth0:0 virtual interface and use only a venet interface on the container (if you don't need broadcast). –  Blueicefield Mar 6 '12 at 16:46
    
ye I have tried a few things and not cleaned up as they have not worked - will try your suggestion thanks –  chrishanson Mar 6 '12 at 16:59
show 4 more comments

Not the answer you're looking for? Browse other questions tagged or ask your own question.