0

When I create an instance in the default VPC, and check ifconfig, it says netmask is /32, as shown below:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1460
        inet 10.138.0.2  netmask 255.255.255.255  broadcast 10.138.0.2
        inet6 fe80::4001:aff:fe8a:2  prefixlen 64  scopeid 0x20<link>
        ether 42:01:0a:8a:00:02  txqueuelen 1000  (Ethernet)
        RX packets 4728  bytes 39926123 (38.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3900  bytes 442039 (431.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

The issue is the application I try to install does not allow /32 subnet. I tried creating a test VPC network, but I cannot ssh to the instances anymore if I use that. If tried adding secondary ranges to default subnet without success. I have tried to expand the netmask with sudo ifconfig eth0 10.138.0.2 netmask 255.255.255.0 only to have the ssh connection freeze (using web browser to ssh). And after that I cannot ssh to instance. What would be other approaches for this?

I see question here, but does not look like it has been answered: Google Cloud Compute set /20 subnet mask to internal interface

Thomas
  • 4,225
  • 5
  • 23
  • 28
alexfvolk
  • 164
  • 2
  • 10

2 Answers2

0

Unfortunately this parameters are set that way to have a better integration with Google Cloud Platform.

Regarding why you can not SSH when you create a new VPC, you must create new firewall rules, as they only apply to one VPC, so the old firewall rules do not apply to the new VPC.

I strongly recommend to open an issue with the support of the application in order to have integration with Google Cloud Platform.

Pol Arroyo
  • 157
  • 5
0

For anyone getting here from a Google search, here's what I found in GCE documentation. Verbatim quote:

To configure interfaces with a netmask other than /32, you should create an image using the flag --guest-os-features MULTI_IP_SUBNET and use it to create your instance. For example, if you are using a debian-9 based image, you can create an image using following command:

gcloud compute images create debian-9-multi-ip-subnet \
     --source-disk debian-9-disk \
     --source-disk-zone us-west1-a \
     --guest-os-features MULTI_IP_SUBNET
kamihack
  • 312
  • 1
  • 6