Vmware set guest static ip address with host conne

2019-07-29 12:01发布

问题:

I have windows 7 host and guest debian 7 on vmware. I am connected to internet by 3G modem and this is the ip config of host

PPP adapter [provider name]:
   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 10.47.235.94
   Subnet Mask . . . . . . . . . . . : 255.255.255.255
   Default Gateway . . . . . . . . . : 0.0.0.0

what I am trying to achieve is to

1) set static ip for guest
2) connect from host to guest by ftp and remote mysql
3) access internet in guest

In the past I had cable internet connection and the ipconfig of host was this

IPv4 Address. . . . . . . . . . . : 192.168.0.100
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1

that time I just changed the network type in vmware as bridged and had this

nameserver 192.168.0.1

in etc/resolv.conf and also these lines in etc/network/interfaces and all things were just fine.

iface eth0 inet static
address 192.168.0.107
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.0.1

I tried to do a similar thing

address 10.47.235.95  # just putting some ip other than the host's ip
netmask 255.255.255.255 # same as for host
network 192.168.1.0     # did not know what to put, so just left the same
gateway 0.0.0.0 # host's gateway

but does not work, neither I can connect to guest, nor I have internet in guest.

thanks

回答1:

You are saying that your subnet mask is 255.255.255.255. With this subnet mask you can't add even a single guest to your network (theoretically if S.N mask is 255.255.255.255, there is no network). It should be at least 255.255.255.252. When you give the IP 10.47.235.95 to your guest, it won't be connected with your network because this IP belongs to another network. If you select Bridged network type, your guest is directly connected with your network card and will try to use an IP. But since your S.N mask is 255.255.255.255 there is no IP available for your guest. Try to use NAT mode instead of bridged one. If this don't work than you have to change your modem S.N mask. When you had the S.N mask 255.255.255.0 it was OK because this network allows 253 guests to be connected with the modem.