www.centos.org Forum Index CentOS 6 - Networking Support Network routing!
|
Bottom Previous Topic Next Topic |
| |
|
|
|---|
| Poster | Thread |
|---|
|
Network routing! | #1 |
|
|---|---|---|---|
|
Newbie
![]()
Joined: 2012/3/26
From Tehran - i.r.iran
Posts: 2
|
Hello everyone...
I setup our virtualization based on KVM and official RHEL 6 documentation but in networking i set every thing i made a bridged but when i add BRIDGE to my eth0 interface my server access goes away... after research found that in hetzner datacenter that my server located packet routed based on MAC address so bridge are useless after more research i found a webpage that solve the problem but the instruction is based on debian/gentoo distrubation and i don't know how to do it in our centos 6.2 i paste the guide here ....I'm really thankful everyone that can help me.... Hetzner EQ Server + KVM and subnet Quote: Hetzner EQ Server + KVM and subnet Posted by mark on 2011-01-25, 02:01 under technology related Last week I have rented an EQ series server from Hetzner’s with four IPs and an additional subnet. After having installed Gentoo on that host I have wanted to assign all these IP addresses to XEN/KVM virtual servers (henceforth called “guests”). Unfortunately most tutorials on the net suggest to dedicate one as bridge gateway address. Yet I even want to not spare a single one, and came up with this: You can set up a bridge by the means of net-misc/bridge-utils without adding an interface to it. Connect your guests to that bridge. On the host, enable IP forwarding and have requests to any guest IP forwarded to that bridge. On the guests, set the host’s IP as gateway address. Without (4) no packets from the LAN, constituted by the bridge, can find their way to the Internet and by (3) vice versa. Provided following IPs (which you should change to yours): main and thus host’s IP 188.40.1.17 three additional IPs 188.40.1.43 188.40.1.44 188.40.1.51 additional subnet 178.40.1.40/27 You will have to do: On the host, install packages: view sourceprint? 1.emerge -n net-misc/bridge-utils sys-apps/iproute2 On the host, edit /etc/conf.d/net so it reads: view sourceprint? 01.modules=( "iproute2") 02. 03.# IP with mask, and gateway - as assigned by Hetzner's DHCP 04.config_eth0=( "188.40.1.17/26") 05.routes_eth0=( "default via 188.40.1.1") 06. 07.# Hetzner nameserver; could be your DNS resolver 08.dns_servers_eth0=( 09."213.133.98.98" 10."213.133.99.99" 11."213.133.100.100" 12.) 13. 14.brctl_br0=( "setfd 0" "sethello 2" "stp off") 15.config_br0=("188.40.1.17/32") 16.depend_br0() { 17.need net.eth0 18.} 19. 20.postup() { 21.if [ "${IFACE}" = "br0" ]; then 22.# repeat that line for every IP but host's IP 23.route add 188.40.1.43 br0 24.fi 25.} On the host, enable IP forwarding: view sourceprint? 1.# add "net.ipv4.ip_forward = 1" to /etc/sysctl.conf 2.sysctl -w net.ipv4.ip_forward=1 You will have to restrict forwarding to your own IPs by iptables. (See Sven Lauritzen’s blogpost for an example.) On the host, have the bridge started automatically: view sourceprint? 1.cd /etc/init.d 2.ln -s net.lo net.br0 3.rc-update add net.br0 default You could start br0 right away if you want. On every guest /etc/conf.d/net should look like: view sourceprint? 1.modules=( "iproute2" ) 2.config_eth0=( "188.40.1.43/32 peer 188.40.1.17") 3.routes_eth0=( "default via 188.40.1.17") 4.dns_servers_eth0=( 5."213.133.98.98" 6."213.133.99.99" 7."213.133.100.100" 8.) … where the first in eth0 is the guest’s IP and the other as well as the in routes_eth0 host’s. With the “peer” thing the host is reachable by that guest without having to be in the same subnet. By that you won’t waste a single IP address. |
||
Posted on: 2012/3/26 22:02
|
|||
|
Re: Network routing! | #2 |
|
|---|---|---|---|
|
Moderator
![]()
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
|
Welcome to the CentOS fora. Please see the recommended reading for new users linked in my signature, particularly the part about formatting your posts, and not using broken code and quote widgets. Also, there is no need to post what you have already linked.
Please provide more information about your system by running "./getinfo.sh network" and showing us the output file. |
||
|
_________________
Phil Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions |
|||
Posted on: 2012/3/26 23:28
|
|||
|
Re: Network routing! | #4 |
|
|---|---|---|---|
|
Moderator
![]()
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
|
Quote:
Somewhat OT: Thats a very old CentOS-6.0 series kernel. Apparently you either have not updated everything, or are still running an obsolete kernel. A "yum update" and reboot are recommended. Quote:
I am admittedly out of my depth here as I don't use KVM or bridges, but I believe that the IP address should be assigned to br0 and not to eth0. Hopefully someone with more knowledge in this domain can comment. Some of the upstream docs and information may be helpful. Quote:
OT: If that's in reference to the CentOS web site - there are lots of things that fall short of best practices and modern infrastructure. Hopefully one day we'll get get Website Ver2 AKA "Website 2.0", but we've been waiting for years already. |
||
|
_________________
Phil Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions |
|||
Posted on: 2012/3/28 18:32
|
|||
|
Re: Network routing! | #5 |
|
|---|---|---|---|
|
Professional Board Member
![]()
Joined: 2007/12/11
From Finland
Posts: 1329
|
Quote:
pschaff wrote: That is correct. eth0 is a member of the br0 and does not need any address. Let br0 and only br0 have that public address. There actually isn't "bridged network". The eth0-br0 is an interface just to outside. The virbr0 is more like a virtual LAN that presumably connect the guest and host. Name "virbr0" looks like it is the "default" network created by libvirt. If libvirt is used, the guest configuration can be used to bind the NIC of the guest directly to the br0. Then there would be a bridged network, but then the guest would need a public IP. Title of the thread is routing, so lets route. Remove the br0 entirely and let the eth0 to keep the address. I presume that the guest gets IP in 192.168.122.0/24 from "DHCP", and its gateway is 192.168.122.1. (Have to presume, for only host-side info has been shown so far.) The "DHCP" is actually dnsmasq process spawned by libvirtd. Therefore, the guest should be able to connect to the host (192.168.122.1) and vice versa. dnsmasq will do NAT too. I'm quite sure the libvirt offers the configuration options for this, even in the "virt-manager" tool. I did last week install a guest into a Fedora host, and I didn't activate routing nor tamper iptables myself. The virt-manager & libvirt did. The host routes and SNAT's packets that originate from the 192.168.122.0/24 and go out from eth0. It just works. Summary: 1. Remove the br0. 2. Fire up 'virt-manager' 2a. Set the "default network" to NAT mode (or whatever it is called). 2b. Change type of the NIC of the guest (or remove&add). |
||
Posted on: 2012/3/28 20:41
|
|||
Top Previous Topic Next Topic |
|



Topic options
Print Topic
Threaded
Newest First
rot3r






You cannot start a new topic.
You can view topic.