Network gurus - access web server from outside your lan query


jimbo45

Well-known member
Pro User
VIP
Local time
10:31 AM
Posts
3,901
Location
Hafnarfjörður IS
OS
Windows XP,7,10,11 Linux Arch Linux
Hi folks
I'm still messing around with this stuff -- I've got apache Web server running on two different machines on my lan . machine A is local host and machine B is wulf is a different server on the LAN, real machine not a VM.

e.g for A accessing B - with php and phpmyadmin

Screenshot_20220809_111803.png

Screenshot_20220809_112009.png


with machine B as local host B can access A (as refur/test.php) and itself as localhost/test.php etc.

So both machines work both ways across a LAN.So the listening ports are fine - not restricted to local host.

So base networking is fine -- now I need external access from outside the LAN !!. That's the bit where I get stuck.

What I want now -- I know the external IP address assigned by the IP -- but what do I do if I'm on a laptop outside the LAN. I don't have any problem with assigning static IP addresses to Machines A and B but how do I access them. Listening on port 80 or 8080 presumably for HTTP and some type of port forwarding.

Any help on this one please. There's plenty here using / maintaining web servers. The main thing I want to do is to access files from a 20TB disk - I just want to be able to send and receive files -- I don't need any programs to execute them directly from the remote server or stream video from that server. I don't need to logon to the remote machine as a remote desktop, I just want files from it and to send to it and also some mysql queries from a MariaDB (mySQL) type DB on it hence my test with myphpadmin, plus retrieving data into an excel spreadsheet from the DB. Those all work across my LAN, so no problems with that part of this "gig",

A windows laptop will be used for accessing the remote server.

Thanks gurus,

Cheers
jimbo
 
Last edited:

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7
What I want now -- I know the external IP address assigned by the IP -- but what do I do if I'm on a laptop outside the LAN. I don't have any problem with assigning static IP addresses to Machines A and B but how do I access them. Listening on port 80 or 8080 presumably for HTTP and some type of port forwarding.

Any help on this one please. There's plenty here using / maintaining web servers. The main thing I want to do is to access files from a 20TB disk - I just want to be able to send and receive files -- I don't need any programs to execute them directly from the remote server or stream video from that server. I don't need to logon to the remote machine as a remote desktop, I just want files from it and to send to it and also some mysql queries from a MariaDB (mySQL) type DB on it hence my test with myphpadmin, plus retrieving data into an excel spreadsheet from the DB. Those all work across my LAN, so no problems with that part of this "gig",

A windows laptop will be used for accessing the remote server.

Thanks gurus,

Cheers
jimbo
I assume you meant that the external ISP is assigned by the ISP, not the IP. Yeah, to access any device from the Internet, you need to hit a routeable IP address.....this would be the one that you get from your ISP. So, you take that IP address that you have received from your ISP and typically you register a DNS name to it, so people don't have to remember that you are 182.12.51.8, instead they can hit jimbo.example.com.

On your router, you then create port-forwarding rules that says anytime inbound traffic comes to this IP on port 80/443, redirect that traffic instead to my internal IP address of 192.168.1.15 on port 80 (this would be where you have your phpmyadmin running). if you wanted to access a machine over RDP, you would do port forwarding on port 3389 to your internal machine on port 3389, etc. Your ISP may block some of these ports thought, for examle SMTP (on port 25) is commonly blocked as they don't intend for you to run servers.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Beelink SEI8
    CPU
    Intel Core i5-8279u
    Motherboard
    AZW SEI
    Memory
    32GB DDR4 2666Mhz
    Graphics Card(s)
    Intel Iris Plus 655
    Sound Card
    Intel SST
    Monitor(s) Displays
    Asus ProArt PA278QV
    Screen Resolution
    2560x1440
    Hard Drives
    512GB NVMe
    PSU
    NA
    Case
    NA
    Cooling
    NA
    Keyboard
    NA
    Mouse
    NA
    Internet Speed
    500/50
    Browser
    Edge
    Antivirus
    Defender
    Other Info
    Mini PC used for testing Windows 11.
  • Operating System
    Windows 10 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Custom
    CPU
    Ryzen 9 5900x
    Motherboard
    Asus Rog Strix X570-E Gaming
    Memory
    64GB DDR4-3600
    Graphics card(s)
    EVGA GeForce 3080 FT3 Ultra
    Sound Card
    Onboard
    Monitor(s) Displays
    ASUS TUF Gaming VG27AQ. ASUS ProArt Display PA278QV 27” WQHD
    Screen Resolution
    2560x1440
    Hard Drives
    2TB WD SN850 PCI-E Gen 4 NVMe
    2TB Sandisk Ultra 2.5" SATA SSD
    PSU
    Seasonic Focus 850
    Case
    Fractal Meshify S2 in White
    Cooling
    Dark Rock Pro CPU cooler, 3 x 140mm case fans
    Mouse
    Logitech G9 Laser Mouse
    Keyboard
    Corsiar K65 RGB Lux
    Internet Speed
    500/50
    Browser
    Chrome
    Antivirus
    Defender.
I assume you meant that the external ISP is assigned by the ISP, not the IP. Yeah, to access any device from the Internet, you need to hit a routeable IP address.....this would be the one that you get from your ISP. So, you take that IP address that you have received from your ISP and typically you register a DNS name to it, so people don't have to remember that you are 182.12.51.8, instead they can hit jimbo.example.com.

On your router, you then create port-forwarding rules that says anytime inbound traffic comes to this IP on port 80/443, redirect that traffic instead to my internal IP address of 192.168.1.15 on port 80 (this would be where you have your phpmyadmin running). if you wanted to access a machine over RDP, you would do port forwarding on port 3389 to your internal machine on port 3389, etc. Your ISP may block some of these ports thought, for examle SMTP (on port 25) is commonly blocked as they don't intend for you to run servers.
Hi there

Thanks for the info.

Port 8080 for me is also available so using Putty and tunelling might work. Port 3306 also for ODBC / mariadb queries also available. Not sure on how ISP's regard use of Port 80 but no questions on 8080 (at least here). HTTP erver can be set to use 8080. Works OK on my LAN with a bit of messing with the config files.

SMTP port 2525 also allowed too - but I'm not interested in running a mail server. Port 25 isn't allowed. But if you know some smtp native commands you can still send email via command line etc without going through this stuff -- complex though !!.

E,g something like this

#!/bin/bash
# Send email from bash
# hrafn simple script to send simple email with your IP address (external)

read -p "Enter SMTP email server address: " server
read -p "Enter SMTP Port: " port
read -p "Enter Your Email Address: " from
read -p "Enter Recipient's Email Address: " to
# get your public IP address
myip="$(dig +short myip.opendns.com @ReSolver1.opendns.com)"

# create message
function mail_input {
echo "ehlo $(hostname -f)"
echo "MAIL FROM: <$from>"
echo "RCPT TO: <$to>"
echo "DATA"
echo "From: <$from>"
echo "To: <$to>"
echo "Subject: Testing SMTP Mail"
echo " "
echo "Your public internet address is "
echo $myip
echo " "
echo "finished"
echo "."
echo "quit"
}

mail_input | netcat $server $port || err_exit

of course needs to be more sophisticated with security etc but you should get the idea. !!


Don't forget to finish the inline text with the "." line before the SMTP quit command.

Thanks for your info though -- will play around with that -- I did mean ISP rather than IP of course !!!

I'm not madly keen on RDP over the internet -- as I said I don't need to access the server as a workstation - just to access the stuff on its shared 20 TB HDD.

Cheers
jimbo
 
Last edited:

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7

Latest Support Threads

Back
Top Bottom