jan.fri
Posts: 1
Joined: Tue Jul 21, 2020 7:57 pm

Raspberry Pi 4 as server - How to connect to public static IP?

Tue Jul 21, 2020 8:10 pm

Hello,

I am planning to use Raspberry Pi as a small server for my Django app. Everything is ready except that my server should be visibile to the world. From ISP I got one additional static IP, that looks something like that:

Static IP address: A.B.C.D
Mask: 255.255.0.0
Default gateway: A.B.0.1

Now I am interested how to setup Raspberry Pi 4 to use that IP. I tried by configuring file

Code: Select all

/etc/dhcpcd.conf
:

as following:

Code: Select all

interface wlan0
static ip_address=A.B.C.D/16
static routers=A.B.0.1
static domain_name_servers=A.B.0.1 8.8.8.8 8.8.4.4 1.1.1.1 1.0.0.1

But following configuration does not work. Note that I am connected over wifi to ISP device that act as modem and router. On that device I don't have any options to connect specific MAC to specific IP.

Thank for answers in advance

User avatar
neilgl
Posts: 2377
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Raspberry Pi 4 as server - How to connect to public static IP?

Tue Jul 21, 2020 8:28 pm

Usually you will use port forwarding in the router to forward ports (e.g. port 80) not MAC, to your pi and have a domain name (Paid or free) that links to the ip of your router via DNS. The rest of the world uses the domain name (e.g. www.example.com).

kartable
Posts: 30
Joined: Tue Jun 02, 2020 8:17 am

Re: Raspberry Pi 4 as server - How to connect to public static IP?

Wed Jul 22, 2020 4:34 pm

As a beginner I can't halp you very much, but do you know https://github.com/billz/raspap-webgui ? I hope it can help.

drgeoff
Posts: 10945
Joined: Wed Jan 25, 2012 6:39 pm

Re: Raspberry Pi 4 as server - How to connect to public static IP?

Wed Jul 22, 2020 8:15 pm

jan.fri wrote:
Tue Jul 21, 2020 8:10 pm
Hello,

I am planning to use Raspberry Pi as a small server for my Django app. Everything is ready except that my server should be visibile to the world. From ISP I got one additional static IP, that looks something like that:

Static IP address: A.B.C.D
Mask: 255.255.0.0
Default gateway: A.B.0.1

Now I am interested how to setup Raspberry Pi 4 to use that IP. I tried by configuring file

Code: Select all

/etc/dhcpcd.conf
:

as following:

Code: Select all

interface wlan0
static ip_address=A.B.C.D/16
static routers=A.B.0.1
static domain_name_servers=A.B.0.1 8.8.8.8 8.8.4.4 1.1.1.1 1.0.0.1

But following configuration does not work. Note that I am connected over wifi to ISP device that act as modem and router. On that device I don't have any options to connect specific MAC to specific IP.

Thank for answers in advance
If the ISP device is a modem router then you cannot give the RPi the public address. You set the IP parameters of the RPi appropriately for the private side of the router and add a port forwarding rule to the router.
Quis custodiet ipsos custodes?

Return to “Beginners”