7 Replies Latest reply on Nov 24, 2011 4:35 PM by 828733

    Oracle VM Server NAT network

    828733
      Hi,
      I have a VM server (v2.2.1) host and I want to set up NAT network for my Virtual Machine guests. I have tried setting this up but could not set this up. I could not find any step by step guide specifying the steps to do this.

      Any help is greatly appreciated.


      Regards
      CP
        • 1. Re: Oracle VM Server NAT network
          Sebastian Solbach -Database Community-Oracle
          Hi,

          Standard of OVM Server is to work in Bridged Mode. There is also the possibility to chane this to NAT, but in most cases this is not very favorable.
          I normally remove the XEN default configuration and do anything by hand.

          So remove the following entries from /etc/xen/xend-config.sxp:
          # vi /etc/xen/xend-config.sxp
          
          Uncomment following entries:
          # (network-script network-bridge)
          # (vif-script vif-bridge)
          
          Stop the existing bridges and restart xen:
          # /etc/xen/scripts/network-bridges stop
          # service xend restart
          Then create new bridges with own networks. Xenbr0 is bridges / xenbr1 nated:
          # brctl addbr xenbr0
          # brctl stp xenbr0 off
          # brctl setfd xenbr0 0
          
          # brctl addbr xenbr1
          # brctl stp xenbr1 off
          # brctl setfd xenbr1 0
          
          # ip addr add 192.168.5.1/24 brd + dev xenbr0
          # ip link set up xenbr0
          
          # ip addr add 10.10.5.1/24 brd + dev xenbr1
          # ip link set up xenbr1
          To make this permanent over reboot, you create the following in /etc/sysconfig/network-scripts/ifcfg-xenbr0 and ifcfg-xenbr1.
          # vi /etc/sysconfig/network-scripts/ifcfg-xenbr0
          
          DEVICE=xenbr0
          TYPE=Bridge
          BOOTPROTO=none
          ONBOOT=yes
          IPADDR=192.168.5.1
          NETMASK=255.255.255.0
          BROADCAST=192.168.5.255
          DELAY=0
          STP=off
          
          # vi /etc/sysconfig/network-scripts/ifcfg-xenbr1
          
          DEVICE=xenbr0
          TYPE=Bridge
          BOOTPROTO=none
          ONBOOT=yes
          IPADDR=10.10.5.1
          NETMASK=255.255.255.0
          BROADCAST=10.10.5.255
          DELAY=0
          STP=off
          
          # service network restart
          To enable NAT you need to activate IP forwarding in Dom0 and configure iptable to forward the packages.
          # vi /etc/sysctl.conf
          net.ipv4.ip_forward=1
          
          # sysctl -p              
          
          # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
          Permanentes Speichern der iptables Regeln:
          # service iptables save
          To test, it should look like:
          # route -na
          Kernel IP routing table
          Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
          192.168.5.0     0.0.0.0         255.255.255.0   U     0      0        0 xenbr0
          10.10.5.0       0.0.0.0         255.255.255.0   U     0      0        0 xenbr1
          192.168.2.0     0.0.0.0         255.255.255.0   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         192.168.2.1     0.0.0.0         UG    0      0        0 eth0
          Regards
          Sebastian
          • 2. Re: Oracle VM Server NAT network
            828733
            Hi Sebastian,
            I was losing hope on setting this up :)

            Thanks for your quick reply. I will try it out now and post the results.


            Regards
            CP
            • 3. Re: Oracle VM Server NAT network
              828733
              Hi Sebastian,
              I tried your steps and could set up xenbr1 but it did not work. I do not have connection from inside the Virtual machines :-(.

              Regards
              CP
              • 4. Re: Oracle VM Server NAT network
                Sebastian Solbach -Database Community-Oracle
                Hi,

                can you post form Dom0
                brctl show
                ifconfig -a
                route -n

                Then from DomU:
                ifconfig -a
                route -n

                Thx
                Sebastian
                • 5. Re: Oracle VM Server NAT network
                  828733
                  Hi Sebastian
                  How can I check from Dom0 and DomU?

                  What I understand is Dom0 will be the host and DomU will be the guest? Am I right?

                  Regards
                  CP
                  • 6. Re: Oracle VM Server NAT network
                    Sebastian Solbach -Database Community-Oracle
                    Yes.

                    Dom0 is the server.
                    DomU your guest(s).

                    Regards
                    Sebastian
                    • 7. Re: Oracle VM Server NAT network
                      828733
                      Hi Sebastian,
                      I just got it resolved today by hit and trial. I tried everything that you suggested and then shut down xenbr0 (default one) . And now I can access the internet from inside my VM. Thanks