OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • General Discussion »
  • How to open specific ports?
« previous next »
  • Print
Pages: [1] 2 3 ... 5

Author Topic: How to open specific ports?  (Read 41844 times)

Dzioobasek

  • Newbie
  • *
  • Posts: 39
  • Karma: 3
    • View Profile
How to open specific ports?
« on: January 15, 2018, 10:30:43 am »
Hi
Im about end configuring newest opnsense and its great. Configuring antivirus is so easy atm :)
I cant handle opening ports for lan or wan. I have 2 java based apps and i need to open 8443 and 8447 ports.
Can you guys help me with that?
Logged

elektroinside

  • Hero Member
  • *****
  • Posts: 574
  • Karma: 51
    • View Profile
Re: How to open specific ports?
« Reply #1 on: January 15, 2018, 11:04:20 am »
First, if you need this to be permanent, allocate static IPs for those machines on the LAN side from Services:DHCP Server. Restart the network interface(s) on those machines to make sure the IPs are allocated (verify on local machine).

Then, go to Firewall:NAT:Port Forward and according to your network setup, create a port forwarding rule for your machines.

Also, do not forget to edit your local firewall rules on your machines (eg. Windows Firewall) to allow inbound connections to those ports.
« Last Edit: January 15, 2018, 01:00:51 pm by elektroinside »
Logged
OPNsense v18 | HW: Gigabyte Z370N-WIFI, i3-8100, 8GB RAM, 60GB SSD, | Controllers: 82575GB-quad, 82574, I221, I219-V | PPPoE: RDS Romania | Down: 980Mbit/s | Up: 500Mbit/s

Team Rebellion Member

Dzioobasek

  • Newbie
  • *
  • Posts: 39
  • Karma: 3
    • View Profile
Re: How to open specific ports?
« Reply #2 on: January 15, 2018, 11:06:18 am »
i have 35 PCs in lan, cant i just open ports for entire lan?
Logged

elektroinside

  • Hero Member
  • *****
  • Posts: 574
  • Karma: 51
    • View Profile
Re: How to open specific ports?
« Reply #3 on: January 15, 2018, 11:09:29 am »
You have to allocate IPs and create rules for each machine in your lan. If you need to forward the same destination port, choose different ones for each machines as source ports.
Logged
OPNsense v18 | HW: Gigabyte Z370N-WIFI, i3-8100, 8GB RAM, 60GB SSD, | Controllers: 82575GB-quad, 82574, I221, I219-V | PPPoE: RDS Romania | Down: 980Mbit/s | Up: 500Mbit/s

Team Rebellion Member

Dzioobasek

  • Newbie
  • *
  • Posts: 39
  • Karma: 3
    • View Profile
Re: How to open specific ports?
« Reply #4 on: January 15, 2018, 11:20:17 am »
is is possible to do use aliases? eg CompanyLan and place there all IPs? All PCs have static addresses.
Logged

elektroinside

  • Hero Member
  • *****
  • Posts: 574
  • Karma: 51
    • View Profile
Re: How to open specific ports?
« Reply #5 on: January 15, 2018, 11:33:27 am »
You can't create one port forward rule for 35 pcs. You have to tell OPNsense (or any other firewall for that matter) which source IP/port to forward to which destination IP/port. You can't do that by a collection of IPs in one alias as destination, as there will be [source] IP(s)/port(s) to [destination] 35IPs/port(s). You need [source] IPs/port(s) to [destination] 1IP/port(s).

In other words, you can only have 1 IP as your destination IP for the forward to work correctly.

I can't imagine one (and the same) TCP/UDP stream to be forwarded to 35PCs at once at the same time.
Logged
OPNsense v18 | HW: Gigabyte Z370N-WIFI, i3-8100, 8GB RAM, 60GB SSD, | Controllers: 82575GB-quad, 82574, I221, I219-V | PPPoE: RDS Romania | Down: 980Mbit/s | Up: 500Mbit/s

Team Rebellion Member

Dzioobasek

  • Newbie
  • *
  • Posts: 39
  • Karma: 3
    • View Profile
Re: How to open specific ports?
« Reply #6 on: January 15, 2018, 12:28:48 pm »
1. I dont know why but its not working. Can i use aliases for ports or its also wrong?
2. On other side, when i was setting proxy in control panel > internet connection Ive checked Dont use proxy for LAN. Shouldnt land apps work then without restrictions?

Anywas can you please show me example setup so i could check what im doing wrong?
Logged

phoenix

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 58
    • View Profile
Re: How to open specific ports?
« Reply #7 on: January 15, 2018, 12:32:20 pm »
Perhaps it would be useful if you gave a description of what you're actually trying to achieve, and why, with your "port forward" configuration and your 35 pc LAN.
Logged
Regards


Bill

elektroinside

  • Hero Member
  • *****
  • Posts: 574
  • Karma: 51
    • View Profile
Re: How to open specific ports?
« Reply #8 on: January 15, 2018, 01:00:03 pm »
As phoenix said, it would be helpful for us to know what are you trying to do.
Nevertheless, for any port forward, you should follow this guideline (take it step by step, and verify each one if possible):

1. Start the process on a PC that you would like to connect to (with the port forward) and verify it's config, make sure you got the port right
2. Create a local firewall rule (e.g. in Windows Firewall / Inbound rule) for that port (allow it) and pay attention to the selected profile (domain, private, public)
3. Verify that you can connect from another PC in the same subnet to that machine and port (easiest is with telnet, install it if not already installed)
4. If it works, move forward, if not, check that the process you are trying to connect to is up and running (not suspended or something) and that it uses the port you configured in the local firewall
5. Go to OPNsense and allocate a static IP for the machine you are trying to connect to (if you would like to make this port forward permanent, you cannot skip this step, you have to make sure that the exact same IP is always allocated to that same machine even when leases expire).
6. Next, make sure the IP you configured is allocated to the machine; if not, go to network settings on your machine and renew your ip (you can do that easily by disabling/enabling the network interface). Re-verify!
7. Next, go to OPNsense Firewall:NAT:Port Forward and set as source IP the WAN address, source port: any, destination IP: your machine IP, destination PORT: the port you are trying top connect to. Apply.
8. Verify, from the internet, that you can connect from the internet to your WAN IP : PORT you configured in your port forward
9. You should harden your firewall rules by various techniques in order to secure your exposed IP:PORT
« Last Edit: January 15, 2018, 01:01:42 pm by elektroinside »
Logged
OPNsense v18 | HW: Gigabyte Z370N-WIFI, i3-8100, 8GB RAM, 60GB SSD, | Controllers: 82575GB-quad, 82574, I221, I219-V | PPPoE: RDS Romania | Down: 980Mbit/s | Up: 500Mbit/s

Team Rebellion Member

Dzioobasek

  • Newbie
  • *
  • Posts: 39
  • Karma: 3
    • View Profile
Re: How to open specific ports?
« Reply #9 on: January 15, 2018, 01:09:05 pm »
Ofcourse sorry. I have application, database is on server 192.168.0.199. Ports needed for this app 8443, 8447, 3050, 8080, 60000-65535. Now i want clients to connect to server with those ports. Ive made alias with those ports.
I dont use dhcp, all pcs have static ip, its LAN with domain
Logged

elektroinside

  • Hero Member
  • *****
  • Posts: 574
  • Karma: 51
    • View Profile
Re: How to open specific ports?
« Reply #10 on: January 15, 2018, 01:14:38 pm »
1. The clients are all on the same local subnet?
2. Or, would you like to connect from the internet to that database?

Are you absolutely positive, 100% sure that you would like to open ~5500+ ports and expose those ports to the internet (if this is the case)?
Logged
OPNsense v18 | HW: Gigabyte Z370N-WIFI, i3-8100, 8GB RAM, 60GB SSD, | Controllers: 82575GB-quad, 82574, I221, I219-V | PPPoE: RDS Romania | Down: 980Mbit/s | Up: 500Mbit/s

Team Rebellion Member

Dzioobasek

  • Newbie
  • *
  • Posts: 39
  • Karma: 3
    • View Profile
Re: How to open specific ports?
« Reply #11 on: January 15, 2018, 01:18:01 pm »
same subnet, i want ports opened in lan only. Everything is working when i connect without opnsense so im sure im doing sth wrong with setup

Quote from: Dzioobasek on January 15, 2018, 12:28:48 pm
2. On other side, when i was setting proxy in control panel > internet connection Ive checked Dont use proxy for LAN. Shouldnt lan apps work then without restrictions?
« Last Edit: January 15, 2018, 01:20:41 pm by Dzioobasek »
Logged

elektroinside

  • Hero Member
  • *****
  • Posts: 574
  • Karma: 51
    • View Profile
Re: How to open specific ports?
« Reply #12 on: January 15, 2018, 01:23:54 pm »
Ah, ok.

But if the clients are all on the lan side, you don't have to create port forwards in OPNsense to connect to the other clients.
I think the problem lies elsewhere.
You should verify that you do not block the local subnet / bogon networks on the LAN interface in OPNsense.
You should verify your firewall rules as well.

You are blocking something on the LAN side with OPNsense. By default, you should be able to connect from the LAN to the LAN without any other setting.
Logged
OPNsense v18 | HW: Gigabyte Z370N-WIFI, i3-8100, 8GB RAM, 60GB SSD, | Controllers: 82575GB-quad, 82574, I221, I219-V | PPPoE: RDS Romania | Down: 980Mbit/s | Up: 500Mbit/s

Team Rebellion Member

elektroinside

  • Hero Member
  • *****
  • Posts: 574
  • Karma: 51
    • View Profile
Re: How to open specific ports?
« Reply #13 on: January 15, 2018, 01:32:52 pm »
I don't think proxy has anything to do with the issue. That proxy you are referring to - by default - only works for port 80/443 (and maybe ftp and socks) and it is for browsing only, nothing to do with your db ports.

Actually, this is how it should work, i'm not entirely sure with OPNsense though as I don't use proxy, but i highly doubt it's set up to proxy any other ports.
Logged
OPNsense v18 | HW: Gigabyte Z370N-WIFI, i3-8100, 8GB RAM, 60GB SSD, | Controllers: 82575GB-quad, 82574, I221, I219-V | PPPoE: RDS Romania | Down: 980Mbit/s | Up: 500Mbit/s

Team Rebellion Member

Dzioobasek

  • Newbie
  • *
  • Posts: 39
  • Karma: 3
    • View Profile
Re: How to open specific ports?
« Reply #14 on: January 15, 2018, 01:33:48 pm »
Block bogon networks is only checked on WAN interface. Only firewall rules are those from AV config to block proxy bypass
Logged

  • Print
Pages: [1] 2 3 ... 5
« previous next »
  • OPNsense Forum »
  • English Forums »
  • General Discussion »
  • How to open specific ports?
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2