Sign in to follow this  
Followers 0
Brian

How to create a Private Internal Network

11 posts in this topic

This guide shows you how to setup a Private Internal Network on a KVM node.

 

 

This guide presumes that you already have bridge-utils installed. To check, run the following:

rpm -q bridge-utils

 

 

You should get an output similar to the following:

bridge-utils-1.2-9.el6.x86_64

 

 

If you did not get any output like this, then it needs to be installed. Run the following:

yum install bridge-utils -y

 

 

Before setting up your Private Network, you will need to know the bridge name that you will use and the IP address range. In this guide, we will be using the bridge name of intbr0 and the IP range of 192.168.0.0/24

 

 

Create a new bridge file:

nano /etc/sysconfig/network-scripts/ifcfg-intbr0

 

 

Add the following to the file:

DEVICE=intbr0
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=static
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
IPADDR=192.168.0.1
NETMASK=255.255.255.0

 

 

Save and exit.

 

 

Restart the network service:

service network restart

 

 

Once the restart has completed, run the following to see the new bridge:

ifconfig

 

 

This next step is very important. If it is not done, any VPS that has a Private IP Address assigned to it, during creation, will not reach the internet. This is due to the standard that only one default gateway can be used at any given time. This change has to be made on the server that you are creating the private network on.

 

 

Rename config.ini.example to config.ini:

mv /usr/local/solusvm/data/config.ini.example /usr/local/solusvm/data/config.ini

 

 

Edit config.ini:

nano /usr/local/solusvm/data/config.ini

 

 

Change the following section:

;; When writing the internal network configuration within the virtual server
;; don't add the gateway variable
;domain_simple_internal_network = false

 

 

To look like this:

;; When writing the internal network configuration within the virtual server
;; don't add the gateway variable
domain_simple_internal_network = true

 

 

Save and exit.

 

 

In SolusVM Master, goto Nodes > List Nodes. Click the name of the node that you setup the bridge for. Click on Internal IP Addresses. Fill the boxes using the information you used in your bridge.

 

 

Default Gateway = 192.168.0.1 (this is the IP address of the bridge)

Netmask = 255.255.255.0

Bridge = initbr0 (replace with the bridge name you used)

 

 

Click on Save.

 

 

Now you can add a single IP or a range of IP addresses. Do not add 192.168.0.1 as this is your default gateway.

 

 

To assign an IP to a virtual, this has to be done from the properties of that virtual. Once you are there, click on Internal IP. The new IP will not be assigned to the virtual until it has been rebooted. Once it is rebooted, the guest OS will not be able to use the new IP. You will need to log in as root to add the IP Address. The steps to do this for CentOS are below.

 

 

Create a new device. Replace eth1 to match the device you are creating:

nano /etc/sysconfig/network-scripts/ifcfg-eth1

 

 

In this file, add the following:

DEVICE=eth1
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.0.10
NETMASK=255.255.255.0

 

 

Save and exit.

 

 

Restart the network service:

service network restart

 

 

Check to see if the new device is listed by running the following. You should now see eth0, eth1, and lo:

ifconfig

 

 

Ping the bridge IP Address on the Host Node:

ping 192.168.0.1

 

 

If you followed this guide to the letter, you should see your pings being returned as delievered. If you see anything other then that, please check over your settings.

 

 

If the Internal IP is assigned to the virtual before you re-install the OS, there is no need to create the new device. SolusVM does this for you. It does not hurt to still log in and double check to make sure it was created correctly.

Edited by Brian
Correct Typos
eitmoyerelia likes this

Share this post


Link to post
Share on other sites

Hi there,

Thank you so much for all information that you have provided, I have a problem. after I created the bridge and saved the file, when trying to restart the network interfaces it says

[root@kvm2 network-scripts]# service network restart

Shutting down interface br0: [ OK ]

Shutting down interface eth0: [ OK ]

Shutting down loopback interface: [ OK ]

Bringing up loopback interface: [ OK ]

Bringing up interface eth0: [ OK ]

Bringing up interface intbr0: Device intbr0 does not seem to be present, delaying initialization.

[FAILED]

Bringing up interface br0: [ OK ]

 

What is the problem here?

 

the interface file is:

DEVICE=intbr0

ONBOOT=yes

TYPE=bridge

BOOTPROTO=static

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

IPADDR=10.0.0.1

NETMASK=255.255.255.0

 

thanks

eitmoyerelia likes this

Share this post


Link to post
Share on other sites
Have you attached intbr0 to any physical devices? The only device that should be attached to any bridge is eth0. What is the output of brctl show.

 

How can I attach it to eth0? eth0 already attached to br0.

 

anyway I used "brctl addbr intbr0" and it seems it's not giving the error anymore:

[root@kvm2 network-scripts]# service network restart

Shutting down interface br0: [ OK ]

Shutting down interface eth0: [ OK ]

Shutting down interface intbr0: [ OK ]

Shutting down loopback interface: [ OK ]

Bringing up loopback interface: [ OK ]

Bringing up interface eth0: [ OK ]

Bringing up interface intbr0: [ OK ]

Bringing up interface br0: [ OK ]

 

after that I've rebooted the VPS for few times, but it is not seeing any new network card :(

 

and ifconfig shows:

virbr0 Link encap:Ethernet HWaddr 52:54:00:7C:D7:93

inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0

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:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

eitmoyerelia likes this

Share this post


Link to post
Share on other sites

The use of brctl addbr intbr0 will add the new bridge but the changes will not remain on reboot. For the new bridge changes to remain after reboot, you have to create the bridge file in the /etc/sysconfig/network-scripts. eth0 should only be bound to br0. This is required for KVM to work. The steps for that are found in http://docs.solusvm.com/kvm_bridge_setup.

 

The steps in this guide are different. Following the steps on this forum post will create a new bridge device (switch). This bridge does not pass data outside of the server. As a result of that, it does not need a NIC to be attached to it. When you run brctl show, you should be getting output like this:

 

brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.003048df4382       no              eth0
intbr0          8000.000000000000       no
virbr0          8000.5254007d9f25       yes             virbr0-nic

eitmoyerelia likes this

Share this post


Link to post
Share on other sites

Actually the "Device intbr0 does not seem to be present, delaying initialization." error occurs because of a small typo in /etc/sysconfig/network-scripts/ifcfg-intbr0

 

TYPE=bridge

should be

TYPE=Bridge

 

Bridge needs to be with a capital B :)

Edited by georgetasioulis
eitmoyerelia likes this

Share this post


Link to post
Share on other sites
Bridge needs to be with a capital B :)

 

Thanks for pointing that out to me. That is in fact a typo. I have updated the post as well as put the request in to have http://docs.solusvm.com/kvm_private_internal_network updated.

 

I have updated the OP and added a few others things to it as well. With further testing, I found that with the default gateway setup in SolusVM. It gets passed to the virtual and this action kills all access to the internet. I have added a few steps on how you can make changes to /usr/local/solusvm/data/config.ini so that the private default gateway does not get added to the virtual during creation. I have also updated the contents of the ifcfg-eth1 file as well. The default gateway can not be added to that file or you will lose internet access.

eitmoyerelia likes this

Share this post


Link to post
Share on other sites

Thank you guys for your help

Okay Capital B helped, no more error on interfaces

[root@kvm2 network-scripts]# service network restart

Shutting down interface br0: [ OK ]

Shutting down interface eth0: [ OK ]

Shutting down interface intbr0: [ OK ]

Shutting down loopback interface: [ OK ]

Bringing up loopback interface: [ OK ]

Bringing up interface eth0: [ OK ]

Bringing up interface intbr0: [ OK ]

Bringing up interface br0: [ OK ]

 

it seems everything that mentioned on the guide is implemented in a right way but still not showing any new interface on Windows XP virtual machine after hard reboot. checked for new devices from "Device Manager" but no chance

 

more info:

[root@kvm2 network-scripts]# brctl show

bridge name bridge id STP enabled interfaces

br0 8000.0025906b9e88 no eth0

kvm199.0

kvm214.0

kvm217.0

kvm237.0

kvm247.0

kvm255.0

kvm491.0

kvm492.0

kvm495.0

kvm506.0

kvm517.0

kvm518.0

kvm519.0

kvm520.0

kvm522.0

kvm525.0

kvm527.0

kvm528.0

kvm531.0

kvm539.0

kvm547.0

kvm550.0

kvm551.0

kvm554.0

kvm562.0

kvm564.0

kvm566.0

kvm567.0

kvm568.0

kvm569.0

kvm571.0

kvm576.0

kvm580.0

kvm582.0

kvm583.0

kvm584.0

kvm585.0

kvm588.0

kvm592.0

kvm594.0

kvm596.0

kvm597.0

kvm598.0

kvm599.0

kvm600.0

kvm601.0

kvm602.0

kvm603.0

kvm604.0

kvm605.0

kvm606.0

kvm607.0

kvm609.0

kvm611.0

kvm612.0

kvm646.0

kvm650.0

kvm651.0

kvm652.0

intbr0 8000.000000000000 no

virbr0 8000.5254007cd793 yes virbr0-nic

 

[root@kvm2 network-scripts]# ifconfig intbr0

intbr0 Link encap:Ethernet HWaddr EA:A0:68:F0:01:07

inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0

inet6 addr: fe80::e8a0:68ff:fef0:107/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:12 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0 (0.0 B) TX bytes:720 (720.0 B)

 

 

Any help on this?

eitmoyerelia likes this

Share this post


Link to post
Share on other sites

From the output that you have provided, you do not have a virtual setup to use that bridge. Have you setup the network settings with the correct bridge in SolusVM Master? This can be found by going to Nodes > List Nodes > Click on the node name > Internal IP Addresses. This is where you define the bridge device. If you have these filled out, can you provided the output of the virtual config file that you are trying to assign this bridge too? This file can be found in /etc/libvirt/qemu/. The file will have kvmxxx.xml. xxx is the number of the virtual.

eitmoyerelia likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0