From b0778e16cde985bb8a73ef498d6106aae9f4e268 Mon Sep 17 00:00:00 2001 From: ahrenholz Date: Mon, 6 Apr 2009 15:29:22 +0000 Subject: [PATCH] added remaining steps and examples --- wiki/LinuxOpenVZNetworkAccess.wiki | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/wiki/LinuxOpenVZNetworkAccess.wiki b/wiki/LinuxOpenVZNetworkAccess.wiki index ef973403..655cca1d 100644 --- a/wiki/LinuxOpenVZNetworkAccess.wiki +++ b/wiki/LinuxOpenVZNetworkAccess.wiki @@ -17,4 +17,19 @@ Example: # Place a hub or switch node in CORE and link it to the router/PC/host node that you want to connect to the external network. In the example shown here, node n3 is linked to hub n7, and n3 has the IP address 10.0.0.3/24. # Run the emulation. CORE will create a Linux bridge on the host having a name such as 'vzbrn7' if the hub is node 7. - # Assign an IP address to the bridge. This address should belong to the same IP subnet as the node. In this example, 10.0.0.1/24 is used for the bridge vzbrn7 on the host. \ No newline at end of file + # Assign an IP address to the bridge. This address should belong to the same IP subnet as the node. In this example, 10.0.0.1/24 is used for the bridge vzbrn7 on the host. + # Now the container should be able to ping the bridge interface: {{{ vzctl exec 1003 ping 10.0.0.1 }}} + # Determine the interface and IP address of the host on the external network. In this example, the host has eth0 with the public address 123.4.50.6. + # Add a NAT rule: {{{ iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -j SNAT --to 123.4.50.6 }}} + # Set the container's nameservers: {{{ cat /etc/resolv.conf > /vz/private/1003/etc/resolv.conf }}} + # Set the container's default route. You may have to delete any existing default route. {{{ vzctl exec 1003 ip ro del default; vzctl exec 1003 ip ro add default via 10.0.0.1 }}} + # Now the container should have NAT access to the outside world. You may now run commands such as {{{ yum }}} from inside the container. + +{{{ +root@n3# ping www.yahoo.com +PING www.yahoo.com (209.131.36.158) 56(84) bytes of data. +64 bytes from www.yahoo.com (209.131.36.158): icmp_seq=1 ttl=250 time=0.960 ms +64 bytes from www.yahoo.com (209.131.36.158): icmp_seq=2 ttl=250 time=1.09 ms +64 bytes from www.yahoo.com (209.131.36.158): icmp_seq=3 ttl=250 time=1.00 ms +64 bytes from www.yahoo.com (209.131.36.158): icmp_seq=4 ttl=250 time=1.35 ms +}}} \ No newline at end of file