Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Current situation:

I have a host running 3 virtual machines. One IP for eth0 ( and one additional for eth0:1 (yyy.yyy.yyy.35). This works fine for me...

Host (eth0) ( | 
                              | <- (virbr0) -> |-- VM1 (
                                               |-- VM2 (
                                               |-- VM3 (

...but what I want is to access my third virtual machine addtional by an external IP (yyy.yyy.yyy.35) on one interface and by the second ( interface for internal purposes:

Host (eth0) ( | 
                              | <- (virbr0) -> |-- VM1 (
                                               |-- VM2 (
                                               |-- VM3 (

Host (?!?) (?!?)              |
                              |-- VM3 (yyy.yyy.yyy.35)

How to realize this and which iptable rules do I need?

Thanks in advance.

share|improve this question

You would be best off by first making eth0 part of a bridge, lets say phybr0. Then assigning an additional NIC to your VM which is bridged to phybr0. And finally letting the VM have the yyy.yyy.yyy.35 address assigned to it from within itself, natively. Also, your host machine will then run its IP Address on phybr0, and not eth0. This could be a starting point: .

Otherwise, for a solution involving NAT, look at iptables DNAT. That is fairly simple to implement and examples from the iptables' man page should suffice. I, however, would make myself aware of the limitations of NAT first.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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