dreadpiraterobinhood
Posts: 5
Joined: Sun May 12, 2019 4:55 pm

IP address for different network

Sun May 12, 2019 8:18 pm

Hello,
I'm currently building a Nextcloud server for a friend who has no experience with setting up a raspberry pi, therefore I'm trying leave as little amount of work for them to do as possible. Though I've run into a problem. How do I go about setting up an IP address for the server so that my friend doesn't have to worry about it changing. Would the server work on his network if I gave it a static IP address or use DDNS?
Thanks for any help!

Andyroo
Posts: 2977
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: IP address for different network

Sun May 12, 2019 8:58 pm

You can use a static address on the PI but its better to put them in both the router and PI to stop clashes. You would need to access the router configuration as every one seems to be different :shock:

Setting the Pi up is not too difficult. You have to edit /etc/dhcpcd.conf using

Code: Select all

sudo nano /etc/dhcpcd.conf
and change the contents to something along these lines (do not copy this - it is an example only):

Code: Select all

interface eth0
       static ip_address=10.1.1.30/24
       static routers=10.1.1.1
       static domain_name_servers=10.1.1.1

       interface wlan0
       static ip_address=10.1.1.31/24
       static routers=10.1.1.1
       static domain_name_servers=10.1.1.1
If access from outside the home is required then you will need to:

1) Make sure the server is well hardened from attack - start here https://www.raspberrypi.org/documentati ... ecurity.md and check with Nextcloud for their needs.
2) Forward the needed ports on the router - see Nextcloud for their needs.
3) Set up a DDNS service - some are free and some are supported by the router.

Document everything (esp passwords) so when you mate rings you at three in the morning with 'something has gone wrong' you can remember what you have done :lol:

Let us know where you want to start...
Need Pi spray - these things are breeding in my house...

dreadpiraterobinhood
Posts: 5
Joined: Sun May 12, 2019 4:55 pm

Re: IP address for different network

Tue May 14, 2019 2:10 am

I'm going to go with a static IP, but first I have a question. Would he be able to access the Nextcloud server through it's hostname? If so, would he be able to access it outside of the network, like on the Nextcloud app while away from home?
Thanks!

User avatar
default_user8
Posts: 644
Joined: Mon Nov 18, 2013 3:11 am

Re: IP address for different network

Tue May 14, 2019 2:41 am

dreadpiraterobinhood wrote:
Tue May 14, 2019 2:10 am
I'm going to go with a static IP, but first I have a question. Would he be able to access the Nextcloud server through it's hostname? If so, would he be able to access it outside of the network, like on the Nextcloud app while away from home?
Thanks!
No he won't be able to accsss the server through it's hostname, and he can access it from outside his network, but he will need to port forward and he will need a ddns service to redirect to his public ip address, unless he has a static public ip address which i doubt he does.
Two heads are better than one, unless one's a goat head.

Andyroo
Posts: 2977
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: IP address for different network

Tue May 14, 2019 2:47 am

The host name would only be valid in the local LAN.

You would have to use a domain name hosted by an ISP and point that to the external IP address of the line into the house. If this changes (as a lot of home broadband does) you are looking at supporting dynamic DNS possibly by the router or a small client on the server.

You do have to be careful how you handle the naming for internal and external access:

Internally this could have the address of 192.168.1.20
Externally it could have an address of 32.31.30.29 (the external address of the router) with a port forward to 192.168.1.20

You access a file externally so your laptop knows the address as 32.31.30.29. When you join the home network it will have cached the external address and your router will not let you loop out and back in so you cannot get to the server by name.
Need Pi spray - these things are breeding in my house...

byroncar
Posts: 7
Joined: Tue Apr 30, 2019 6:33 pm
Location: Norway
Contact: ICQ AOL Skype

IP address for different network

Sun May 19, 2019 4:30 am

I had a major slowdown and address conflict errors on my network. I reserved 2 IP addresses in my router setup. Do I need to set the address as well in Windows adapter settings or leave it set to automatically obtain?

User avatar
default_user8
Posts: 644
Joined: Mon Nov 18, 2013 3:11 am

Re: IP address for different network

Sun May 19, 2019 11:03 am

If you reserved 2 addresses in your router leave it set to auto, your router knows to look for the mac address associated with that ip address.
Two heads are better than one, unless one's a goat head.

Return to “Networking and servers”