Inet address changes all the time, super annoying. Need Help

nextcloud 11 after upgrade
Strict HTTPS
redis cache
ubuntu 16.04 server
virtualbox currently set to bridged network
Windows 10 Host



Hello once again.

I have an annoying issue going on.

I am running nextcloud on my desktop (wifi Connected) in virtual box. In order for it to connect to the internet I have to open ports on the router to let the virualbox running nextcloud.

The issue is that out of nowhere the int address will change and I will have to go in and open ports on the router again. I would kinda expect this after reboot or something but its not even rebooting … that I know of.

I would LOVE to set this somehow so that does not happen.

I believe I have set the IP address on the router to be static so the external IP doesnt change … its just the internal IP I am having issues with.

this is pretty much what I have when I run ifconfig:


enp0s3 Link encap:Ethernet HWaddr 08:00:27:41:29:e5 inet addr:192.168.1.11 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe41:29e5/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:39783 errors:0 dropped:0 overruns:0 frame:0 TX packets:9530 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:5879762 (5.8 MB) TX bytes:10572721 (10.5 MB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:222 errors:0 dropped:0 overruns:0 frame:0
TX packets:222 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:17914 (17.9 KB) TX bytes:17914 (17.9 KB)




and then this is the networkinterfaces:




This file describes the network interfaces available on your system
and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

The loopback network interface
auto lo
iface lo inet loopback

The primary network interface
auto enp0s3
iface enp0s3 inet dhcp




Yes I have read some guides on this … I tried a couple but each time I ended up killing the internet for the virtual machine.

I tried to do the network host with NAT and that didnt work. I tried to alter the ipv4 in the windows network manager and that killed the internet as well.

I am at a loss with this and I m hoping that someone knows how to get this set to where the internal IP will not change so I can stop messing with opening ports almost every other day.

Lets say for example I want to stick with what it is set to right now 192.168.1.11 … what would I need to do?

Thank you much!


EDIT:
so I just again tried

I went into /etc/network/interfaces

I changed the contents to and from this:

his file describes the network interfaces available on your system and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

The loopback network interface
auto lo
iface lo inet loopback

The primary network interface
auto enp0s3
iface enp0s3 inet dhcp





To:

This file describes the network interfaces available on your system and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

The loopback network interface
auto lo
iface lo inet loopback

The primary network interface
auto enp0s3
iface enp0s3 inet static
address 192.168.1.11
netmask 255.255.255.0
gateway 192.168.1.255

this again killed the internet. ugh I am at a loss again with this. Yes I know I am leaving out the # . but thats just on here so the <code tag doesnt bold the hell out of the text that starts with the #. Also I dont know why the code isnt coding the whole thing … hope its not making it too confusing.

This also depends on your router if it allows to use static ips (should perhaps be out of the range of the dynamic ips). Most routers also support that you can give a the same ip via dhcp based on the MAC address.

Thanks for the reply in my router (netgear) I do have the section “internet setup” and then I have set the “internet address”

The sections that I have filled out are:
IP Adress … which I have set as my external IP
IP subnet mask which is 255.255.252.0
gateway IP address which is 24.137.xxx.x

under "Domain Name Server (DNS) Address"
I have set to manually use DNS as open DNS address


now I just noticed in the router settings there is something called “static Routes”

which gives me options for:

Route Name:

Private
or
Active

Destination IP Address:

IP Subnet Mask:

Gateway IP Address:

Metric:



is this something that I would need to edit to try to get the inet address to not change and be static? would these settings matter even if the nextcloud is in a virtualbox set up?

also again if I wanted to use the internal IP of 192.168.1.11 would that be the ip subnet mask? Im guessing the destination IP Address is the external IP

now if I set this in the router would I also need to alter the network interfaces file in the server as well?

Thanks

No, normally you shouldn’t touch your external IP and its settings. It would be rather the DHCP settings, where you can attribute static local IPs to a network interface identified by its MAC address.