1

I believe this question has been answered a 100 times before, but I'm almost sure that I'm searching into the wrong direction. My desired setup is the following:

I have a virtual host using KVM and libvirt. I have a simple 192.168.1.0/24 home network, which I would like to extend by a server network. I will use 192.168.12.0/24 for the new network. But since there will be a few servers still running in the normal network, I added a virtual network to libvirt. Basicly I would like to route between br0(which is a bridge to eth0) and virbr0(which is the virtual network interface).I have tried to route the traffic using iptables and I have managed it to gain access to the network using these commands

iptables -I FORWARD -d 192.168.12.0/24 -s 0.0.0.0/0 -j ACCEPT
iptables -I FORWARD -s 192.168.12.0/24 -d 0.0.0.0/0 -j ACCEPT
iptables -I FORWARD -s 192.168.1.0/24 -d 0.0.0.0/0 -j ACCEPT
iptables -I FORWARD -d 192.168.1.0/24 -s 0.0.0.0/0 -j ACCEPT

Could someone show me the right direction?

EDIT 1: Thanks for your answers. I completely forgot about the kernel rules and applied them. I am now able to ping the machine from the 192.168.1.0/24 network and vice versa. But I unfortunately am not able to connect via ssh to this machine neither is it possible to ping anything else then 192.168.1.0/24 (and its origin network of course). The "core" router is properly configured, to route anything to the server network, to the kvm hypervisor.

I also thought about the bridge as routed interface, and I added a new interface (eth0:1) which is now my "outside" interface, but this also doesn't change anything.

  • 1
  • I fail to understand the topology and routing configuration. Can you write an example of what is not working, with IP address of machines involved and their routing table? – pqnet Aug 17 '14 at 17:12
  • Thanks for your answer. Sorry for being unclear. What works: - Pinging from one to the other network What doesnt work: - Connecting using anything over OSI Layer 4. – user3070957 Aug 18 '14 at 13:21
1

iptables is used for defining a traffic policy. Adding forwarding rules does not enable forwarding. You must set the according sysctl keys, i.e.

sysctl net.ipv4.conf.br0.forwarding=1
sysctl net.ipv4.conf.virbr0.forwarding=1

equivalently, you may also issue

echo 1 > /proc/sys/net/ipv4/conf/br0/forwarding
echo 1 > /proc/sys/net/ipv4/conf/virbr0/forwarding

You may also need (depends on your setup) to add appropriate routing table entries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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