Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Port forwarding with ufw ubuntu

  1. Jan 22, 2017 #1

    Maylis

    User Avatar
    Gold Member

    Hello,

    I am new to linux and I have a few ports that I need to forward to allow me to play my game

    TCP Ports 1119 and 3724 are forwarded.
    TCP ports 6881-6999
    TCP port 1120

    So I used ufw and used the default settings to block everything. Then I allowed the aforementioned ports.

    Code (Text):
    ~$ sudo ufw allow 3724/tcp
    Rule updated
    Rule updated (v6)
    And this is my status
    Code (Text):
    sudo ufw status
    Status: active

    To                         Action      From
    --                         ------      ----
    22                         ALLOW       Anywhere                  
    443                        ALLOW       Anywhere                  
    1119/tcp                   ALLOW       Anywhere                  
    3724/tcp                   ALLOW       Anywhere                  
    6881:6999/tcp              ALLOW       Anywhere                  
    1120/tcp                   ALLOW       Anywhere                  
    22 (v6)                    ALLOW       Anywhere (v6)            
    443 (v6)                   ALLOW       Anywhere (v6)            
    1119/tcp (v6)              ALLOW       Anywhere (v6)            
    3724/tcp (v6)              ALLOW       Anywhere (v6)            
    6881:6999/tcp (v6)         ALLOW       Anywhere (v6)            
    1120/tcp (v6)              ALLOW       Anywhere (v6)
     
    My question is, I don't know if this is the same as port forwarding. I denied access to two of the ports which are needed to play the game and I was still able to, which prompts me to believe that this isn't correct. I used ufw instead of iptables because I don't feel comfortable using iptables since it looks more complicated. If these aren't forwarded, then what did I do with these commands? Just allow those ports to go through my firewall?

    Thanks!
     
  2. jcsd
  3. Jan 22, 2017 #2

    rbelli1

    User Avatar
    Gold Member

    Are you directly connected to the internet or are you behind a router? Do you have UPnP set up?

    BoB
     
  4. Jan 23, 2017 #3

    Maylis

    User Avatar
    Gold Member

    Hello BoB

    I am using WiFi. I don't know what UPnP is. Based on Wikipedia's description, I automatically connect to the wifi server when I log on, so I assume that it is on. If I had to manually set that up, then I never did so. How can I tell?
     
  5. Jan 23, 2017 #4

    rbelli1

    User Avatar
    Gold Member

    UPnP is a group of protocols to make networking easier. One feature of that is that port forwarding is configured automatically. To determine if it is on you need to find out if your router supports it and then log in and look at the setting.

    BoB
     
  6. Jan 23, 2017 #5

    Maylis

    User Avatar
    Gold Member

    With ufw, I thought the firewall goes through the computer, not the router. Shouldn't I be able to configure everything on my laptop?
     
  7. Jan 23, 2017 #6

    QuantumQuest

    User Avatar
    Gold Member

    Normally, with
    Code (Text):
    ufw allow
    you can allow ports (use a colon between the first and last port of the range). The
    Code (Text):
    /tcp
    or
    Code (Text):
    /udp
    part is mandatory. It may be the case that game needs also udp besides tcp, so check it. Also, is there any other firewall getting in the way?
     
  8. Jan 23, 2017 #7

    Maylis

    User Avatar
    Gold Member

    I don't believe I have any other firewall. I already did the these you mentioned, the question is whether port forwarding or allowing a port are functionally the same thing. I denied some of the necessary ports in order to test if what I am doing is correct, yet I was still able to play the game. But then I read that perhaps only patching (downloading updates) is why the game needs the ports forwarded. Maybe it doesn't care about those ports when playing, only when downloading an update.

    I then denied ports 443 and 80, to test if I could use the browser. I was still able to, so it seems to me that ufw doesn't actually work? I must be mistaken.
     
  9. Jan 23, 2017 #8

    QuantumQuest

    User Avatar
    Gold Member

    They are not the same thing. Allowing some port means allowing the incoming (and/or) outgoing packets through that port. Port forwarding refers to redirecting a request from a combination of address and port number to another such combination, using NAT (Network Address Translation) protocol through a network gateway (e.g. a router or a firewall) (for details see Wikipedia). For example, you could redirect incoming packets from port 80 to port 8080 (just an example).

    Now, in the context of ufw command ,with ufw you essentially enforce firewall rules. What is allowed and what is not to pass through firewall in some specified port(s). In order for ufw command to do port forwarding, you have to add some lines in the configuration file: /etc/ufw/before.rules - you can google it to find the details. Then restart ufw.
     
  10. Jan 23, 2017 #9

    rbelli1

    User Avatar
    Gold Member

    If you are behind a NAT router you have a default incoming deny all rule to computers behind it regardless of whether the router contains anything that would be considered a firewall. Port forwarding and some of the features of UPnP will add routes to allow incoming traffic. To allow those incoming connections you may have to modify your local firewall as well.

    If there is a firewall included in your router you may have to modify it to allow some of the above features as well.

    What game are you trying to play? We may be better able to help if we knew the specifics.

    BoB

    Edit: IPV6 complicates things because you may have a public IPV6 address and the port forwarding is meaningless.
     
  11. Jan 23, 2017 #10

    Maylis

    User Avatar
    Gold Member

    Unfortunately I am just renting a room in a house, so I can't really go into my landlords' router and start changing settings. I was hoping that I could set a sort of "internal firewall" just through my laptop.

    I'm playing World of Warcraft
    https://help.ubuntu.com/community/WorldofWarcraft

    Router & Firewall

    Just want to make it clear that I am able to play the game, but my goal is to have as much security on my laptop as possible (while still able to play), thats why I want a firewall.
     
  12. Jan 23, 2017 #11

    Maylis

    User Avatar
    Gold Member

    What worries me is that I am using this website right now even though I set to deny all incoming connections. Why am I still able to get onto my web browser?

    Code (Text):
    ~$ sudo ufw status verbose
    Status: active
    Logging: on (low)
    Default: deny (incoming), allow (outgoing), disabled (routed)
    New profiles: skip
     
  13. Jan 24, 2017 #12

    rbelli1

    User Avatar
    Gold Member

    Web browsing only requires outgoing connections.

    If the ports are blocked at the router and no automatic configuration mechanism like UPnP is present, nothing you can do locally to a firewall will will allow access from the outside world. Publicly the connection point is the router. All outgoing connections appear to come from the router. All incoming connections must also go to the router. Internally to that it decides that the connection should be forwarded (or in most cases not) to what computer.

    You could use a VPN service to give you a real public IP. That will increase latency and reduce speed. WoW may not be playable under those restrictions.

    BoB
     
  14. Jan 26, 2017 #13

    Maylis

    User Avatar
    Gold Member

    Thank you, I realized that without access to my landlord's router, I will just remain content with what I have. My game runs, but I was just trying to make my laptop as secure as possible. I guess denying incoming connections is the best I can do for now.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Port forwarding with ufw ubuntu
  1. Port Programming (Replies: 1)

  2. Install Ubuntu (Replies: 2)

Loading...