Jump to content

Networking on linux?

I have a ubuntu desktop connected to a router(not a modem with a UI or whatever) this is at school so what i want to do is open the port 80 so that i can "publish" my website. I know i have to open the port / allow the port in firewall which i have but the problem is more portforwarding i dont know how to open the port for the public so that they can access the website. Is there anyway i can make a virtual machine with linux and make it a router so that i can portforward through that "router"?

Link to comment
Share on other sites

Link to post
Share on other sites

There's almost zero chance your school are going to allow you to forward any ports on their network but especially not port 80.

 

Also no, you cannot bypass the schools firewall and I may be wrong but I'm pretty sure asking that here is against the forum CoC.

Main Rig:-

Ryzen 7 3800X | Asus ROG Strix X570-F Gaming | 16GB Team Group Dark Pro 3600Mhz | Corsair MP600 1TB PCIe Gen 4 | Sapphire 5700 XT Pulse | Corsair H115i Platinum | WD Black 1TB | WD Green 4TB | EVGA SuperNOVA G3 650W | Asus TUF GT501 | Samsung C27HG70 1440p 144hz HDR FreeSync 2 | Ubuntu 20.04.2 LTS |

 

Server:-

Intel NUC running Server 2019 + Synology DSM218+ with 2 x 4TB Toshiba NAS Ready HDDs (RAID0)

Link to comment
Share on other sites

Link to post
Share on other sites

@RandomGuy13 because it's at school we use our own server i dont have "access" to the server because we don't really have a "IT guy" so that's why im wondering if there are other ways to portforward

P.S i know simple portforwarding with routers 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, LiamOlsson said:

It's more about how im supposed to do it

 

LIke how to maek a router in linux? Set up some virtual network bridges, make one your lan, one your wan. Connect the router to both.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, LiamOlsson said:

@Master Disaster i can promise you that wont be a problem

 

I can promise you it will. The port needs forwarding on the schools main router so unless you have administrator access to that you cannot do it.

Main Rig:-

Ryzen 7 3800X | Asus ROG Strix X570-F Gaming | 16GB Team Group Dark Pro 3600Mhz | Corsair MP600 1TB PCIe Gen 4 | Sapphire 5700 XT Pulse | Corsair H115i Platinum | WD Black 1TB | WD Green 4TB | EVGA SuperNOVA G3 650W | Asus TUF GT501 | Samsung C27HG70 1440p 144hz HDR FreeSync 2 | Ubuntu 20.04.2 LTS |

 

Server:-

Intel NUC running Server 2019 + Synology DSM218+ with 2 x 4TB Toshiba NAS Ready HDDs (RAID0)

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, LiamOlsson said:

@RandomGuy13 because it's at school we use our own server i dont have "access" to the server because we don't really have a "IT guy" so that's why im wondering if there are other ways to portforward

P.S i know simple portforwarding with routers 

Port forwarding happens on the part of your network where the internet enters the building and is routed. It's in the school's firewall. I can nearly guarantee you that they are not gonna let you just go pokin' around their firewall to port-forward port 80. Or any port for that matter. Do it at home or get your own ISP.

"Although there's a problem on the horizon; there's no horizon." - K-2SO

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, LiamOlsson said:

It's more about how im supposed to do it

 

You need access to your school's router, you can't emulate it for the simple reason that your traffic still needs to go through the real one. Once you have that, there should be a section called "port forwarding" or something similar; from there, you can set the internal address (your pc's ip address and port, in your case 80) and the corresponding external port, which can be 80 or whatever else you prefer.

 

Since your router is separate from the modem, you also need to do the same in the modem, but for the modem you'll have to use the router's ip address relative to the modem itself.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

This is more a networking question than a linux question.

 

First, lets do a mini network map to understand what you're doing

 

INTERNET -> ROUTER -> COMPUTER (web server)

 

You want people from the internet, to be able to see a webpage running on your computer.

 

I assume you know how to build a webserver and that you have one running succesfuly on port 80 of your computer. if not. than stop this thread  now as you're not even ready for the networking portion.

 

So the next step once above is working is to tell the router that you need connections that come in from the internet, on port 80, to go to your computer on the network.

 

this depends on what software the router is running. Now this might be where the confusion lies, but typical high grade routers aren't just running your run of the mill linux. So it gets things even more confusing and difficult.

 

the rest of this assumes that you are logged into the linux shell on the router.

 

if it is linux however, then you're going to have to modify the iptables to instruct the networking to forward those ports. iptables can be quite a confusing thing as it has multiple uses, purposes and ways of reading it, and screwing up a rule here could bring down the entire internet for your school.

 

the command would look similar to this, but again, if you just copy and paste this yo'll likely just break your network. you need to UNDERSTAND WHAT IPTABLES ARE BEFORE MESSING WITH THEM! I highly recommend doing a massive read on iptables before proceeding

 

the command would look similar to this

iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 80  NEW -j ACCEPT

 

what this basically means:

iptables = the linux exec

"-A" add rule

"FORWARD" is the rule type

"-i eth0" input interface. this is your WAN interface, that has connection to the internet

"-o eth1" output interface, this is your LAN interface that connects to the internal network your computer resides on

"-p tcp" which protocol to forward. this case is TCP

"--dport 80" this is the port to forward

"-j ACCEPT" default ruleset is to accept connection on this port. 

 

I maybe missing a specific flag in this command... it's been a long time since i screwed around with port forwarding directly in linux and worrying about setting my own IPTables. Typically, most modern routers have a nicer web UI to do this on.

 

and of course, as previously mentioned yet again, if the router isn't actually running linux, than the above will just break everything, if it even lets you run it.

 

 

Quote

"Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so." - Douglas Adams

System: R9-5950x, ASUS X570-Pro, Nvidia Geforce RTX 2070s. 32GB DDR4 @ 3200mhz.

Link to comment
Share on other sites

Link to post
Share on other sites

If your school has public addresses, and no NAT's (not very probable) and it is not protected, the port 80 can be accessed from remote 

You can access it from the inside in any case, but not from the outside in case of NAT unless you got access to the school router which is connected to the Internet 
Do you have the permissions to do that? Why they would let you mess with their routers if you don't know those things? 

In Linux server distros without any software firewall installed, you can just set up a server and it will be connected to the outside so no setup required in there
 

Edited by Guest
Link to comment
Share on other sites

Link to post
Share on other sites

On 1/22/2019 at 1:31 PM, LiamOlsson said:

that's why im wondering if there are other ways to portforward 

The only way to set the router up for port forwarding is to have access to the router. Since you seem to be trying really hard not to ask how to subvert not having access to the router the only *real* advice I can give is don't use port 80. Search around for an open port and use that.

There's no technical reason why you can't use another port on a webserver other than that it's commonly accepted that HTTP will be on port 80, and so when you type a URI into the search bar, you don't have to type HTTP://<myURI>.<myDomain>:<myPort>.

For example, this website is actually https://linustechtips.com:80. But that's pretty ugly, so your browser does two things: Assume that you're using HTTP, so you don't have to type that, and then assumes that because you're using HTTP, you're using port 80, so you don't have to type that.

But there's no reason why you can't run it on some other port that your network admins may have left open, except for now everyone who wants to visit your site will have to manually type the port number.

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×