Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
NAT Networking with VMware Workstation
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Sun Sep 16, 2007 4:46 pm    Post subject: NAT Networking with VMware Workstation Reply with quote

Hi
I'm using Windows Vista as host and Gentoo as guest with VMware Workstation 6 and I have a few problems with NAT networking.

I normally use 2 networks to connect to the internet, the one at my home which is ADSL and I use a router, the other one is my university's WiFi network.

University's WiFi:
I have dhcpcd installed and auto-starting at default or boot level can't really remember. The file /etc/conf.d/net is configured with just one line, that is: config_eth0=("dhcp"). When I have NAT selected in VMware, I can surf the web in the Gentoo guest using the university's WiFi connection without any problems.

Home ADSL:
The same NAT configuration as described above, doesn't work and I want to know why and if there's any way to fix it. When at home, I need to use bridged networking in VMware, then change /etc/conf.d/net to fit my router's settings and also, change manually the name servers in /etc/resolv.conf.

As you see, for both connections to work, I need to change the configuration files accordingly. At weekends, I'm at home, during the week, I'm at the university and it's a pain in the ass to keep changing the files so I can use each configuration.

How can I have NAT networking for both?
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Thu Sep 20, 2007 12:56 pm    Post subject: Reply with quote

Anyone?
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Sun Sep 23, 2007 12:27 pm    Post subject: Reply with quote

C'mon people, someone must know something about this...
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Sun Sep 23, 2007 12:48 pm    Post subject: Reply with quote

use tcpdump, and see what goes out and what goes in your computer.

could you describe a bit more your settings (host and guests) at home?
_________________
The End of the Internet!
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Sun Sep 23, 2007 1:40 pm    Post subject: Reply with quote

Like I said before, I have ADSL connection at home and I'm using a router with DHCP disabled and in the host, this is my network configuration:
[IMG]http://www.hdd.com.pt/thumbs/162083host.jpg[/IMG]

And the following is the guest settings:
[IMG]http://www.hdd.com.pt/thumbs/600623guest.jpg[/IMG]

And of course, for the guest network to work, I have to use bridged network using the settings above...
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Sun Sep 23, 2007 2:01 pm    Post subject: Reply with quote

truc wrote:
use tcpdump, and see what goes out and what goes in your computer.


when you're using the same configuration as in the Uni, then come back with real information, may be we can help
_________________
The End of the Internet!
Back to top
View user's profile Send private message
sternklang
Veteran
Veteran


Joined: 10 Sep 2005
Posts: 1641
Location: Somewhere in time and space

PostPosted: Sun Sep 23, 2007 2:22 pm    Post subject: Reply with quote

I suspect the home router is not configured to provide DNS info via DHCP. If you enable DHCP on the home router (with config_eth0=("dhcp") on the VM) and boot your VM, what do you end up with on the Gentoo system - no IP address at all? correct IP address with no change to DNS info in resolv.conf? Are you able to ping the router from home in this configuration?
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Sun Sep 23, 2007 2:24 pm    Post subject: Reply with quote

truc wrote:
could you describe a bit more your settings (host and guests) at home?

You also asked for the information I posted just above...

About tcpdump, I don't know what's that nor how do I use it...

sternklang wrote:
I suspect the home router is not configured to provide DNS info via DHCP. If you enable DHCP on the home router (with config_eth0=("dhcp") on the VM) and boot your VM, what do you end up with on the Gentoo system - no IP address at all? correct IP address with no change to DNS info in resolv.conf? Are you able to ping the router from home in this configuration?


Sorry, but I can't enable DHCP on the home router, it must be disabled.
Back to top
View user's profile Send private message
sternklang
Veteran
Veteran


Joined: 10 Sep 2005
Posts: 1641
Location: Somewhere in time and space

PostPosted: Sun Sep 23, 2007 3:38 pm    Post subject: Reply with quote

Okay, something like this might work:
Code:

config_eth0="dhcp"
fallback_eth0="192.168.0.87/24"
routes_eth0=" 'default via 192.168.0.1' "
dns_servers_eth0="194.65.100.117' '194.65.5.20"

If I'm not mistaken, the last two lines will only be used if the dhcp configuration doesn't work. However, I've not tried this myself so I make no guarantees it will work. :wink:
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Sun Sep 23, 2007 3:45 pm    Post subject: Reply with quote

I'll try it out in a while (doing some emergin stuff that you suggested on the other help topic :P) and if it works at home. And I will also know today if it works with the univ wifi network cause I'm going away to the univ later at night.

Question tough, I normally have something like:
config_eth0=("dhcp")

But you don't have () and there are few ' in the middle, I don't understand that syntax...
Back to top
View user's profile Send private message
sternklang
Veteran
Veteran


Joined: 10 Sep 2005
Posts: 1641
Location: Somewhere in time and space

PostPosted: Sun Sep 23, 2007 4:02 pm    Post subject: Reply with quote

Check out /etc/conf.d/net.example. The syntax has changed, though the old syntax with parentheses is still supported for the time being.
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Sun Sep 23, 2007 7:04 pm    Post subject: Reply with quote

I checked the net.example file but every example was still using the syntax with parentheses so I'll keep using that one for now...

Anyway, I couldn't test this thing at home and now I'm at the university so, only in the next weekend I'll be able to see if NAT is working with this configuration. It works with the univ wifi...
Back to top
View user's profile Send private message
sternklang
Veteran
Veteran


Joined: 10 Sep 2005
Posts: 1641
Location: Somewhere in time and space

PostPosted: Sun Sep 23, 2007 7:32 pm    Post subject: Reply with quote

I am using a package.masked baselayout-2.0 release candidate which introduces a number of changes to initscripts and associated config files, and I believe this new net syntax is one of those changes...
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Sun Sep 23, 2007 11:54 pm    Post subject: Reply with quote

Ok then... As for the topic issue, I'll report back in a week... lol :P
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Fri Sep 28, 2007 8:31 pm    Post subject: Reply with quote

Here I am, finally at home... The fallback configuration worked but there's 2 little issues:

1) I have to swap to bridge when I'm at home and NAT when at the university.
2) When I'm at home, dhcpcd tries to fetch the ips necessary but it fails of course and uses the configuration specified in the fallbacks, however, this process takes a little while. Is there a way to decrease the timeout for this to happen?
Back to top
View user's profile Send private message
sternklang
Veteran
Veteran


Joined: 10 Sep 2005
Posts: 1641
Location: Somewhere in time and space

PostPosted: Fri Sep 28, 2007 11:58 pm    Post subject: Reply with quote

Hmmm, I think I may have got caught up in the details and missed the Big Picture. :wink:

Let's look at this differently - one possibility is that the lease you get from the uni network may still be valid when you attempt to use DHCP at home, and that this keeps you from getting a new lease. So if you include in your /etc/conf.d/net:
Code:
dhcp_eth0=( "release" )
then it should release its DHCP lease when you shut down at university, and renew it at home -- at least if that is the problem.

If that doesn't work, you could work around issue 2 with:
Code:
dhcpcd_eth0=( "-t 10" )
to set the DHCP timeout to 10 seconds, or whatever timeout seems good to you. (The differences in those two statements is not a typo - "release" is generic DHCP, "-t" is an option specific to dhcpcd.)

Another possibility is that you could configure two interfaces, one bridged and one NAT (with the DHCP timeout set as above). One interface would be guaranteed to fail at each location, but one should succeed. Maybe that will work?

I mostly use bridged networking with VMWare, but I have used NAT as well on a Linux guest running on a Windows XP host (a long time ago, when I still used Windows at home...). It just worked, back then. I wonder if this is another of the many bugs in Vista? Have you searched the VMWare knowledgebase or forums to see if VMWare NAT failing in certain circumstances is a known Vista issue?
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Sat Sep 29, 2007 12:33 am    Post subject: Reply with quote

Let me break it down...

sternklang wrote:
Let's look at this differently - one possibility is that the lease you get from the uni network may still be valid when you attempt to use DHCP at home, and that this keeps you from getting a new lease. So if you include in your /etc/conf.d/net:
Code:
dhcp_eth0=( "release" )
then it should release its DHCP lease when you shut down at university, and renew it at home -- at least if that is the problem.

After adding that to the net file, how should I test this? NAT for both? Bridge for both? Then what? A bit confused here...

sternklang wrote:
Another possibility is that you could configure two interfaces, one bridged and one NAT (with the DHCP timeout set as above). One interface would be guaranteed to fail at each location, but one should succeed. Maybe that will work?

Didn't quite understood this part here...

sternklang wrote:
I mostly use bridged networking with VMWare, but I have used NAT as well on a Linux guest running on a Windows XP host (a long time ago, when I still used Windows at home...). It just worked, back then. I wonder if this is another of the many bugs in Vista? Have you searched the VMWare knowledgebase or forums to see if VMWare NAT failing in certain circumstances is a known Vista issue?

No I haven't, yet, I'll search the knowledge base tomorrow... Kinda sleepy right now.
Back to top
View user's profile Send private message
sternklang
Veteran
Veteran


Joined: 10 Sep 2005
Posts: 1641
Location: Somewhere in time and space

PostPosted: Sat Sep 29, 2007 1:21 am    Post subject: Reply with quote

Nazgulled wrote:
After adding that to the net file, how should I test this? NAT for both? Bridge for both? Then what? A bit confused here...
I was suggesting NAT for both, but now that I think of it, if bridged works at home, why not used bridged at university?

Nazgulled wrote:
sternklang wrote:
Another possibility is that you could configure two interfaces, one bridged and one NAT (with the DHCP timeout set as above). One interface would be guaranteed to fail at each location, but one should succeed. Maybe that will work?

Didn't quite understood this part here...
Here, I was suggesting an alternative - configure two network interfaces for the Gentoo VM, one bridged with static IP for home (call it eth0) and one NAT with DHCP for university (eth1). eth1 would work at university and eth0 would fail there because it had the wrong subnet for university. eth0 would work at home and eth1 would fail at home because of no DHCP server.
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Sat Sep 29, 2007 1:48 am    Post subject: Reply with quote

I never tried bridged at the university, I don't know how could I have this configured for both connections in bridged mode in a way where I don't have to keep changing files/configurations or whatever. Basically, I want to be at home, plug the ethernet cable and surf the web or, be at the university, and just surf the web using the wifi network.

And I don't really like the second solution!
Back to top
View user's profile Send private message
sternklang
Veteran
Veteran


Joined: 10 Sep 2005
Posts: 1641
Location: Somewhere in time and space

PostPosted: Sat Sep 29, 2007 2:18 pm    Post subject: Reply with quote

Ah, you just added a new piece of information - your home router is not wireless, so you use a different interface on the host for each connection. Which means the virtual NAT interface has to connect to a different interface on the host at each location.

Since bridged networking is much simpler, perhaps you could try that at university? Then, after modifying the DHCP timeout as noted above, your current configuration with fallback would work without alteration at both locations. Bridged networking works fine with a host wireless interface (since Workstation 5, if I recall correctly) so unless you have a specific reason to use NAT it should work on your university network.

If you don't like that solution, I think the VMWare forums would be the next place to search for others having the same problem. If you do that, please make your host configuration clear (wireless at uni, wired at home) right away.
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Sat Sep 29, 2007 2:33 pm    Post subject: Reply with quote

The thing is, I opted for NAT at the univeristy because of the description how NAT worked, "just have a working connection at the host, select NAT, and it's working on the guest", it just worked like that... For bridged networking, the desciption says the host must have it's own IP on the network like it was a new computer. Well, for that too work, I would have to connect to the univerity's wifi network with VNC everytime I want to surf the web, and that's extra work when the network is already working on the host and I just need to use that connection, that's why I prefer NAT. So I don't have extra work to connect to the network which is already configured on the host.
Back to top
View user's profile Send private message
sternklang
Veteran
Veteran


Joined: 10 Sep 2005
Posts: 1641
Location: Somewhere in time and space

PostPosted: Sat Sep 29, 2007 3:17 pm    Post subject: Reply with quote

I'm not sure I understand. If you are using NAT on the university network, your Windows host has an IP on that network. NAT is translating between the IP on the Windows host and the private IP on the VM guest. If you use bridged networking, the Windows host gets one IP from the university network and the VM guest gets a different IP on the same network. If you are saying there is a network login required at your university that you do not want to do on the VM guest if you use bridged networking, then I guess you are back to checking the VMWare forums to see if switching between host network interfaces is supported with NAT, or whether there is some advanced configuration option that will allow that to work. I am out of ideas!
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Sat Sep 29, 2007 3:26 pm    Post subject: Reply with quote

I just posted this question on the VMware forums to see if anyone helps me out... Thanks for all your time in helping me out :)
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Sun Sep 30, 2007 12:25 pm    Post subject: Reply with quote

Although, nobody seems to know what to answer cause I haven't got a reply yet...
Back to top
View user's profile Send private message
Nazgulled
Guru
Guru


Joined: 04 Aug 2005
Posts: 485

PostPosted: Mon Oct 01, 2007 7:52 pm    Post subject: Reply with quote

Bridged networking seems to be working in both locations with the fallback configuration :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum