Page 1 of 1

NAT and internal network don't co-exist

Posted: 23. Jan 2013, 23:06
by jfemep
Have two guests on WinXP SP3 host.
Successfully tried (1) and (2) below, and each option works individually, but not jointly.

1) Set up an internal network between the guests, and it works alright in the sense that they could ping each other in both directions after I gave them 10.0.2.x addresses (ifconfig eth0).
2) Set up NAT -> can access internet alright

But for each of these options to work, I have to disable the other one (do a "clean" re-start). As soon as I activate a second network adapter (doesn't matter if it's (1) on top of (2) or the other way around, the guest in question becomes unable to ping either the other guest or an internet host. ("bad address" error)

What gives?

Re: NAT and internal network don't co-exist

Posted: 23. Jan 2013, 23:49
by Perryg
Amazing! You choose the only address range that you should have avoided. What are the odds?

Switch the internal to use 10.0.0.* or 10.0.1.*. The VBox NAT uses 10.0.2.*

Re: NAT and internal network don't co-exist

Posted: 24. Jan 2013, 00:05
by jfemep
Ok. Just re-installed and re-started one of the guests (they're tiny, so it doesn't take too long). Didn't launch the other one at all. Two adapters, one for an internal network as before, the other one NAT. ifconfig showed eth0 w/o an address. Assigned 10.0.0.9. Can't ping internet hosts despite the NAT being there.

Re: NAT and internal network don't co-exist

Posted: 24. Jan 2013, 00:08
by jfemep
Also, how do I change the IP address for one (say, internal), but not the other (NAT)? I mean, I'm changing the address for eth0, but in VBox, there's virtual adapters.

Re: NAT and internal network don't co-exist

Posted: 24. Jan 2013, 00:22
by Perryg
You set the first adapter in both guests to use NAT. The second to use Internal and make sure that are both using the same intnet name.

Start the guests and see which one is using NAT (the 10.0.2.*) address and leave it set to DHCP.
Select the other Nic and set it to manual and add the ip and subnet. leave off gateway and dns as it is not used and will cause a lot of issues if you try to set them.

Another thing to remember is you have been trying this a lot the rules file may be so messed up it is causing the issue.
You can either edit the /etc/udev/rules.d/70-persistent-net.rules or you can delete the rules and Linux will configure it on the next boot

Re: NAT and internal network don't co-exist

Posted: 24. Jan 2013, 00:33
by jfemep
Thank you; will try that.
Btw, do I have to use two NATs? My original idea was to use one of the guests as a firewall and to make sure, the other one doesn't have any independent network access.

Re: NAT and internal network don't co-exist

Posted: 24. Jan 2013, 00:38
by Perryg
You can use it that way if you know how.