Port Forwarding With Shorewall

I have Shorewall setup on my router, but even though I've read on how to set up port forwarding it doesn't seem to work.
Here's my /etc/shorewall/rules.conf
# Shorewall version 4.0 - Sample Rules File for two-interface configuration.
# Copyright (C) 2006,2007 by the Shorewall Team
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# See the file README.txt for further details.
# For information about entries in this file, type "man shorewall-rules"
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
# PORT PORT(S) DEST LIMIT GROUP
#SECTION ALL
#SECTION ESTABLISHED
#SECTION RELATED
#SECTION INVALID
#SECTION UNTRACKED
SECTION NEW
# Don't allow connection pickup from the net
Invalid(DROP) net all tcp
# Accept DNS connections from the firewall to the network
DNS(ACCEPT) $FW net
# Accept SSH connections from the local network for administration
SSH(ACCEPT) loc $FW
SSH(ACCEPT) net $FW TCP 3000
# Allow Ping from the local network
Ping(ACCEPT) loc $FW
# Drop Ping from the "bad" net zone.. and prevent your log from being flooded..
Ping(DROP) net $FW
ACCEPT $FW loc icmp
ACCEPT $FW net icmp
# Accept DNS connections from the local network to the firewall
DNS(ACCEPT) loc $FW
# Allow Webmin access from local net
ACCEPT loc $FW tcp 80
# Allow Transmission Traffic
DNAT net loc:192.168.1.100:51413 tcp 51413
DNAT net loc:192.168.1.100:32000 tcp 32000
DNAT net loc:192.168.1.114:6881 tcp 6881
DNAT net loc:192.168.1.114:8881 udp 8881
DNAT net loc:192.168.1.1:80 tcp 1017
Here's my /etc/shorewall/policy in case it's needed
# Shorewall version 4.0 - Sample Policy File for two-interface configuration.
# Copyright (C) 2006 by the Shorewall Team
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# See the file README.txt for further details.
# For information about entries in this file, type "man shorewall-policy"
#SOURCE DEST POLICY LOG LEVEL LIMIT:BURST
$FW net ACCEPT info
loc net ACCEPT info
net all REJECT info
# THE FOLLOWING POLICY MUST BE LAST
all all REJECT info
SSH works internally, but not externally, and ping works both inside and outside of the network, web browsing also works fine. I just can't seem to get to anything inside the network from outside of the network. What am I doing wrong?
Last edited by brando56894 (2014-04-02 04:04:34)

Even if the forum policy is more to give people the possibility to help themself, I'd like to post a (hopfully) working configuration for the case above, so everyone trying to use shorewall get an idea how it works.
If someone finds errors please let me know, so I can correct this post. Thanks.
/etc/shorewall/interfaces
# change interface to your external iface
net eth0 dhcp,tcpflags,nosmurfs,routefilter,logmartians,sourceroute=0
# change interface to your internal iface
# if running a dhcp server on your internal interface add ",dhcp" to the following line
# if the interface is a bridge add ",bridge" to the following line
loc eth1 nets=(192.168.1.0/24),tcpflags,nosmurfs,routefilter,logmartians
/etc/shorewall/zones
fw firewall
net ipv4
loc ipv4
/etc/shorewall/masq
# change interface to your internal iface
eth1 192.168.1.0/24
/etc/shorewall/policy
$FW all ACCEPT # FW may talk to everyone
loc net ACCEPT # LAN may talk to the internet
net all DROP info # Drop everything not in rules file
# THE FOLLOWING POLICY MUST BE LAST
all all REJECT info
/etc/shorewall/rules
SECTION NEW
### FIREWALL INCOMING ###
# MISC
Invalid(DROP) net all tcp # prevent connection pickup
Ping(DROP) net $FW # no ping from outside allowed
# ALL -> FW
ACCEPT all $FW tcp 3031 # SSH from internet and LAN
# LOC -> FW
Ping(ACCEPT) loc $FW # Ping from LAN to FW
DNS(ACCEPT) loc $FW # DNS from LAN to FW
HTTP(ACCEPT) loc $FW # Webmin access from LAN to FW
### FIREWALL OUTGOING ###
# not needed, because everything allowed in policy file
### DNAT RULES ###
# leaved out rules not found in network diagram
# add them using the same scheme
DNAT net loc:192.168.1.100:32400 tcp 32400
DNAT net loc:192.168.1.100:8081 tcp 8081
# the following may not work, as it redirects to the FW itself
DNAT net loc:192.168.1.1:80 tcp 1017
Last edited by Tarqi (2014-04-01 23:40:46)

Similar Messages

  • Port Forwarding with Port Translation RV042, RV016, RV082

    This is a feature request for the Linksys RV series Routers.  Currently, it appears that the Cisco/Linksys RV042, RV082, and RV016 only support port forwarding and 1-to-1 Nat.  One item that I find very helpful with customers is port forwarding with port translation.  I am requesting that this feature be included with a future firmware relase for these RV series routers.
    Here is an example of the request.
    Take an incoming service request on a TCP or UDP destination port and forward it to an internal IP on a different TCP or UDP port.  For example, customer A wants to allow different machines on the internal network to receive Windows RDP connections inbound.  To make PC maintenance identical between the internal machines, the customer does not want to change the listening port for RDP on the individual PC workstations through the Windows Registry.  The customer also does not want to dedicate separate IP's to each machine in a 1-to-1 NAT setup.  The only option is to have remote connections to each of these PC's to use a different destination port.  So, for example, PC one could be reached on TCP port 5151, PC two on TCP port 5152, and PC three on port 5153.  This requres a firewall that is able to translate each of these connection requests to a different internal IP on the default RDP port (TCP 3389).  So, the following setup is required:
    Port Forwarding with Port Translation:
    Router External IP on TCP port 5151 ---> forwarded to PC One's internal IP on TCP 3389
    Router External IP on TCP port 5152 ---> forwarded to PC Two's internal IP on TCP 3389
    Router External IP on TCP port 5153 ---> forwarded to PC Three's internal IP on TCP 3389
    There are several comparable "small business" class router competitors to the RV042, RV082, and RV016 that will perform this port forwarding with port translation process without incident.  Unfortunately, these Cisco/Linksys small business routers will not accomplish this task currently.
    Please implement this feature in a future firmware release.
    Thanks!

    Excellent.  I see this now.  None of our customers actually use the UPNP feature, so we never realized that Port Forwarding with Port Translation features existed on this page along with the ability to enable or disable UPNP.
    Perhaps, in the future, this functionality could be moved to and incorporated into the port forwarding page which seems to be a more logical location.
    In either case I'm very happy to know that this feature is available on the RV's.
    Thanks for your assistance.

  • Port Forwarding with Verizon-Br​anded Action GT704-WG

    I am new to the forums, and I am already overjoyed with the 30 minutes I spent figuring out that the login mechanism does not even work with browsers other than IE7/8.  Lots of fun to start.
    I live in a residential building with the residential High Speed Internet Plan.  I assume this is the case because it is a DSL line and they are not using business grade, or I do not think I would be having these problems.
    I have spent many hours trying to figure out how to port forward with the above-mentioned router/modem/gateway/**bleep** extraordinnaire.  I am in IT professionally, and I am tired of feeling **bleep**.  I called Verizon tech, but they were very unhelpful unless I pay for a premium tech service to figure out port forwarding problems.  And yes, I have read the info on port-forward.com numerous times for this device.
    Essentially, I want to forward an arbitrary port, let's say 6336, to a server running Ubuntu 9.10.  I have put this computer in the DMZ using the web interface.  I have also set up a mapping rule to forward 6336 (all three entries pointed to 6336 in the Security/Applications/Forwarding section, following docs on port-forward.com for this specific model AND Verizon's own documentation).  Occassionally, I can see the service is viewable from the likes of canyouseeme.org.  Nonetheless, I cannot access the port: I get a connection refused error when using ssh on this port.  Yes, I correctly configured ssh on the DMZ server/host to respond to the non-standard 6336 port, and I have tried it with the server's firewall system (ufw/iptables, for the curious) enabled and disabled.  It NEVER works.
    Some posts here have indicated I might need a static IP assignment.  That can be done only client-side (meaning the Ubuntu server in the DMZ), if I understand people saying it is not possible to do static assignments from this **bleep** gateway, so I am not sure if that should matter (I wonder what happens with this **bleep** when two computers try to demand the same static IP; dare I guess that he asks first wins?).  I cannot recall if I have uPnP enabled or disabled as I am at the office right now, but I believe it is off.  Not sure if this matters either.  If I am wrong, I would love if someone could let me know.  I am at a loss and sick of dealing with such a simple problem.  I would really appreciate the help. 
    Solved!
    Go to Solution.

    Ok.
    #1 On your computer setup a Static IP.
    This means following the directions at http://www.cyberciti.biz/tips/howto-ubuntu-linux-c​onvert-dhcp-network-configuration-to-static-ip-con​...
    #2 The Static IP must be outside of that DHCP range of the router. So, this means your IP has be above 1 but below 64.
    #3 In the router forward to the IP Address that you setup on the computer.
    OR if the router can give the computer the same IP Address each time, you could do that.
    If you are the original poster (OP) and your issue is solved, please remember to click the "Solution?" button so that others can more easily find it. If anyone has been helpful to you, please show your appreciation by clicking the "Kudos" button.

  • Port forwarding with natd

    I have set up my Leopard Server with a public ip on Ethernet, 85.165.220.114, and a private ip on the Airport interface, 192.168.207.200.
    This is working well, I can access my server with a registered domain name from the internet, with web, ssh etc.
    Now I want to forward port 12000 to a device on my network with ip 192.168.207.245, and put this into /etc/nat/natd.plist:
    <key>redirect_port</key>
    <array>
    <dict>
    <key>proto</key>
    <string>tcp</string>
    <key>targetIP</key>
    <string>192.168.207.245</string>
    <key>aliasIP</key>
    <string>85.165.220.214</string>
    <key>aliasPortRange</key>
    <string>12000</string>
    <key>targetPortRange</key>
    <string>12000</string>
    </dict>
    </array>
    I have Firewall setup and running, and NAT running on my server.
    Port 12000 is checked in Firewall, and that should be it.
    Port forwarding should now work, but it doesn't.
    Looking at Firewall log, it looks like the Firewall is doing it correctly:
    Aug 10 11:02:46 leopard ipfw[66524]: 12315 Accept TCP 84.212.229.188:57224 192.168.207.245:12000 in via en0
    Aug 10 11:02:46 leopard ipfw[66524]: 12301 Accept TCP 84.212.229.188:57224 192.168.207.245:12000 out via en1
    So I am completely lost why this does not work as it should.
    Ivan

    I got it working at last. I removed the Airport, and made a second Ethernet interface in system preferences - Network. The second interface populated with the private IP address, and gateway with the same private ip (192.168.207.200).

  • Port forwarding with E2000 for a game called Minecraft.

    Okay, I've been wanting to port forward this game called Minecraft for quite awhile now, but never got around to it, but now that I've wanted to let my friends that can't play with hamachi play with me. I wanted to port forward it so that they go into the game without using hamachi, or any other networking program. If anyone knows how to acomplish this with a guide for this then it would be nice, or just simply write out instructions. I've already tried once and whenever I ran my server, I would say "FAILED TO BIND TO PORT" or just ask me this "Is another _____ running on that port?" Thanks for helping guys,

    Yea it looked okay. Go to cmd, then type in ipconfig. Look for your ipv4 address. Now make sure that address is the same as the one that you set up port forwarding for in your router.
    Make sure you have reserved that ip by going to 192.168.1.1--->Basic Setup--->DHCP Reservation---> (your PC). Now restart your PC. The important thing is to make sure that your local ip matches everything (Port forward, server.properties, and the DHCP Reservation Table)
    Now go to the .bat files that you downloaded for the minecraft server. You should see a file called "server.properties". Go into it and make sure that the server ip matches your local ip (192.168.1.4 for example). If not, change it. Here's a reference video: http://www.youtube.com/watch?v=6MJVNxPtmtM
    I don't work for Cisco. I'm just here to help.

  • Port Forwarding with Airport Express 802.11n Utility version 6.1

    Hi all,
    Quick question, hoping it can be solved with a quick answer
    Not sure what I'm doing wrong: I'd like to set up port forwarding for Skype and Transmission, however in the airport utility even when I assign the public/private ports to the ones specified in the respective programs (with the IP address for the machine I am using), if I go into Transmission or onto a port checker website the connections are shown as closed for the ports I have selected (on the public side).
    I've made a DHCP reservation for this machine to tie it to a given IP address, and I've enabled NAT port forwarding protocol in the Network options (no default host so far).
    Also, in case it makes a big difference, right now I'm connecting to the internet via a Cisco DCP3825 cable modem running in bridge mode, with the AEBS in DHCP and NAT router modes.
    Any tips?
    Thanks!

    Sadly I never got it to work. I called up Apple and they claimed that all the ports are open for the Airport Express, but if I run port scanner in Network Utilities none of the ports I specify show up as open unless I select one of the "Default" port categories like "Windows File Sharing". I told this to the person I spoke to on the phone, and they replied several times in a row that they are not allowed to help set up port forwarding, that they can only provide info on how to open the ports, and that even if the ports are subsequently not opened or forwarded they can't provide any assistance. It wasn't a very good conversation. Unfortunately, based on some of the other disucssions I've looked at in this forum, it doesn't seem possible to do conventional custom port forwarding using this version of the Airport Utility. Hopefully someone will correct me though. Sorry I can't be more help.

  • Port forwarding with airport & external router

    Hi,
    I'm happy with port forwarding normally, but I've just made my network entirely wireless and can't figure out the answer to this problem. I have a non wired netgear router as my internet access point, an airport express is connected to this getting its address via DHCP, another airport is joined to this network, and 2 macs are connected to the airports again getting addresses via DHCP. How do I port forward to the macs using this setup? I can't figure it out. Obviously I'll need to configure manually, but if I open the port on my router and open the same port on the AX will they go throught to the mac ok. Do I map the router to forward to the AX manual IP then map the AX to a specific mac IP? Any tips appreciated before I go ahead and break my network
    Emma

    Emma,
    Ok, here are my thoughts. Have you tried assigning static IPs via DHCP, not manual config, based on client MAC addresses? Meaning when the router sees an ethernet MAC address it always assigns the same IP to that machine. This should enable the handing out of IPs while retaining port forwarding to the same machine each time and still preserve the routing that DHCP seems to enable more betterer . I'm not familiar with the netgear setup and I couldn't get my AX performing satisfactorily for my needs either so I have returned it however this is a 'somewhat' common option when setting up DHCP on different routers and I have found it works better when daisy chaining through routers.
    HTH,
    Steve

  • Port Forward with EA4500 Cloud connect firmware

    Installed my new EA4500 and trying to access my PC from internet (remote desktop) in order to do so I need to forward the TCP port 3389.  In the old web admin page this option was easy to find and change.  with the new cloud connect I can't find it.  how do Ienable port forwarding on the EA4500?  thanks

    You can find port forwarding under Security. click on the "Security" icon on the left hand panel then it will open another window and there you will be able to select "APPS and GAMING" and that's where you can find Port Range Forwarding.

  • How to port forward with AirPort Extreme

    I really just cant find an accurate description in the support community. Err, let me rephrase: I'm not tech-savvy enough to really comprehend all aspects of port forwarding within the AirPort utility.
    I am trying to set up a server for a game (Starbound) and I have been trying for hours to open 1 port. I believe it connects through TCP on port 20125.
    I cant seem to figure out which IP address the utility needs. The router's? Which IP address is the router's if so? How do I see that?
    I wish server was freeware so badly, I've watched videos and tried to replicate the results manually but I just absolutely can't get it. Would really appreciate support on this, as I've never encountered this problem configuring port forwarding in a browser-based scenario.
    Thanks all. All I really need is a walkthrough to open that ONE port.

    For reference the following AirPort User Tip will give you the basics for port forwarding.
    I cant seem to figure out which IP address the utility needs.
    What is required is the IP address of the host device that you want reached from the Internet. In this case it would be the server hosting the Starbound game.
    It is highly recommended that you configure your server with a static Private IP address. You can do this using the DHCP Reservation feature of the AirPort Utility. What this does is assign a dedicated address from the pool of addresses that are provided to local network clients. You will then use this address to populate the IP Address field for the port mapping. Note: Port Forwarding and Port Mapping are used interchangeably. Apple uses Port Mapping.
    To assign a DHCP Reservation:
    Start the AirPort Utility, select the AirPort Extreme, and then, select Edit.
    Select the Network tab.
    Click on the "+" button under the DHCP Reservations window.
    For "Description," enter Starbound or whatever you want to describe this port mapping.
    Reserve Address By: MAC Address
    MAC Address: (Note: This will be the hardware MAC address of the server's Ethernet or wireless interface.)
    IPv4 Address: [enter the desired IP Address that you want to assign the server. It should be from the available pool of DHCP addresses. By default this pool is: 10.0.1.2 thru 10.0.1.200. For example, you can use 10.0.1.100
    Select Save
    Using the reference provided earlier, use the AirPort Utility to define the port mapping that you require. (Note: You should still be on the Network tab.) I filled in the values for you. Note, however; that you may need to change the value for the IP Address field to the address that you set earlier in the DHCP Reservation.

  • How to port forward with Modem and Router

    I have a Linksys AM300 Modem and a Linksys WRT610N router. 
    I want to forward ports for Call of Duty Modern Warfare 2 and STEAM.
    How do I port forward when I have 2 devices and how can I test that it is working? 

    I would recommend that you reconfigure your AM300 into bridge mode. In bridge mode it operates like a standard modem would do. Then reconfigure the WRT610N for your internet connection, i.e. most likely PPPoE. Now the WRT has a direct connection into the internet. Now you only need to configure port forwarding on the WRT610N.

  • How do you port forward with linksys routers?

    It's all in the title.Message Edited by NaturalViolence on 10-19-200606:14 PM

    to forward the ports, click this:  Port Forwarding
    Message Edited by Beetlebum on 10-19-2006 06:41 PM
    "a helping hand in a community makes the world a universe"

  • Port forwarding with a BT business hub

    hello
    i'm trying to port forward a game but having followed the instructions I still cannot get a connection.
    the game is minecraft
    and the port number is 25565
    Can any body help
    many thanks connor

    HI
    This link may help http://btbusiness.custhelp.com/app/answers/detail/​a_id/9445/c/426,427,1951http://btbusiness.custhelp​...
    If you want to say thanks for a helpful answer,please click on the Ratings star on the left-hand side If the reply answers your question then please mark as ’Mark as Accepted Solution’

  • Single port forwarding with a E2000.

    I was wanting to port forward a port that was 25565 for a game of mine, but everytime I try it won't work. someone give me a walk through?
    By the way, it's 7AM and I didn't sleep yet so i'll explain more detailed in the morning.
    I'm using a E2000 Router.

    Best thing would be to set a dhcp reservation for your pc/notebook and then set the port at the single port forwarding page to your int. IP.

  • PLEASE HELP i have trouble with WRT54G port forwarding with linksys

    Hello guys, i play a game called populous, and since im on a router i cannot host the game, when i used to have a d-link all i would do is have to set up the port to my ip with the udp. but ever since i have swiched to linksys that doesnt work, the ip on my portforwaring is the same as the one on my computer the port is correct and the udp is set, i also have no fire walls on and it still doesnt make a differance, Someone in the game suggested that there is a local ip i need to get? is that true or is there another setting i need to set up in my router page?
    PLEASE HELP IF YOU CAN <3<3 thanks
    Message Edited by Curtman on 09-07-2007 12:04 PM

    Yes that happens if you write replies to your own posts. Many regulars here only answer their "own" topics (i.e. to which they have answered before) and new ones which don't have replies, yet. If you write a reply to your own topic chances are your are not read unless during some random browsing...
    Regarding your problem it is impossible to say anything unless you give the exact settings you have on your router. Please post the full settings you have for port forwardings, port triggering and DMZ. If you have UPnP forwarding in your router (I don't think you have) post those settings, too.
    Otherwise I suggest this checklist for troubleshooting port forwardings.

  • Port forwarding with 1841

    I just bought a 1841 router with IOS 12.3 and I succesfully configured Internet access using NAT.
    Now I want to redirect some ports (25, 100, 3389, etc.) to my internal mail server.
    I would appreciate some help to do it, using SDM if possible.
    Thank you.

    I can help you with CLI. You need a static IP to do this.
    ip nat inside source static tcp 10.10.10.1 25 x.x.x.x 25
    ip nat inside source static tcp 10.10.10.1 100 x.x.x.x 100
    ip nat inside source static tcp 10.10.10.1 3389 x.x.x.x 3389
    x.x.x.x is public IP and 10.10.10.1 is mail server.

Maybe you are looking for

  • Free of Charge Intercompany Invoice process

    Hello Experts, I would like to know how the TANN, Free of Charge process works for intercompany Sales? When I do the F2 billing document, the system behaves as it should but when I process the IV billing document, system is finding a price maintained

  • Integrating CFMX and Netsuite webservices

    Started a new thread since this has moved on from the original discussion here: http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=7&threadid=1131981&CFID =11118706&CFTOKEN=25dbff123c24b709-419805A4-9295-C039-52E183060903DD0F&jsession

  • What are advantages of EJB

    Well, I have read all class of J2EE books and worked a lot on EJB, so I think, that I do know, what I am speeking about. But I still can't get the spirit. My point of view is the following: EJB is a very (extremely) modular architecture, which is the

  • Synchronous interface udf to remember value between request and response

    Hello, I have two synchronous message interfaces bundled in an operation mapping and a message mapping for the request and one for the response. I need to remember a value obtained during request message mapping so that I can access it in the respons

  • Where's the problem: Safari/Download Speed/ISP?

    My connection speed has been shaped to 64kbps and something funny is now happening to my internet other than being slow. The thing is, I can handle the slow speed; what I can't handle is the download speed dropping to zero and staying there. I have M