+ip Flag: Anyone Actually Know How This Works?

XvarionXvarion Join Date: 2002-11-06 Member: 7281Members
<div class="IPBDescription">There's been much conflicting info...</div> I've checked out posts in this forum and also other mod forums, and folks are having trouble with this all over the place.

I'm behind a NAT-enabled router hanging off my cable modem. My cable router has an internet-visible address, and all my LAN machines, including my ns server, are behind it, with 192.168.x.x addresses.

One key bit of information I've gleaned off the Counter-Strike forums is that the +ip flag can only refer to actual, bound ip addresses of the server machine. That is, it can only refer to addresses that are valid for the server box itself (i.e. the address(es) you'd get using an "ipconfig /all" command on Windows or an "ifconfig" command on linux).

If this is true, then a whole lot of info in these forums in incorrect: the +ip flag does NOT tell WON which IP address to post to public lists. Rather, the +ip flag simply tells the hlds process which IP address to bind to on that box, in the event the machine has more than one IP address.

Therein lies the confusion. I believe where this got started is due to the following: if you have a computer that's acting as a firewall, it'll have two ethernet cards in it - one card will have an internet-visible, pubic IP address, and will be connected to something like a cable modem. The other ethernet card will have an internal, LAN-only address, such as a 192.168.x.x address, that can only see traffic on the internal network. When you start up hlds, the +ip flag would be used to make sure that hlds bound itself to the public ip address rather than the internal address. i.e. it would make hlds pay attention to the ethernet card that's connected to the cable modem.

Great. However, this is all valueless in the case of a server that's BEHIND a firewall, because it only has an internal (192.168x.x) address - there's no public address for that box. Thus, the +ip flag is useless in that situation. As many people have pointed out, if you attempt to use the +ip flag with the public address of the router, you get an error indicating that the hlds process can't bind to that address - this is expected, as, again, the +ip flag is telling hlds which ethernet card to pay attention to, and there's no card in the server box with that address (it's on the router).

So, the question remains: How does one get WON to list a server that's behind a Natted firewall? Is this even possible? I've tried, and can't get it to work. I've ensured that port 27015 (UDP) is open for incoming traffic, yet nothing shows up on public boards like www.serverspy.com, which should see my box even if ASE can't as it's also behind my firewall.

Does anyone have any information regarding this?

Thanks,
Eric

Comments

  • chicograndechicogrande Join Date: 2002-11-06 Member: 7412Members
    Great post. I've been playing Counter-Strike for some time, and I'm also a user of a NAT enabled firewall appliance--A SonicWall SOHO2--which has been a source of agony when attempting to host a server from behind the firewall.

    It's a given that you have to setup proper forwarding rules for the TCP and UDP traffic that results from operating a HL server, but what I noticed is that the way in which a NAT firewall communicates to the outside world is not often on the ports you indicated. From what I've seen from packet tracing is that packets will be routed correctly between the WON servers and your host, yet the host machine will not report itself as running on port 27015 (CS default) for example, but some arbitrarily assigned number. It mis-reports the server IP and port, thus it doesn't show up in many lists.

    I have had zero success getting a HL based server to report itself from behind a NAT firewall device.

    cg
  • MerciorMercior Join Date: 2002-11-02 Member: 4019Members, Reinforced - Shadow
    Solution: Don't run a firewall
  • BHayesBHayes Join Date: 2002-11-02 Member: 4602Members
    You need to setup a STATIC PORT MAPPING on your firewall/NAT so that packets sent to 27015 on the Firewall/NAT get redirected to the internal PC on that port. Unfortunately many routers/FWs do not support this kind of behavior, even though they say a port is "open", they still require the internal PC to first send something out to a host on that port before they'll allow packets to come back in. For HL to work, any internet host has to be able to send to that port at anytime and have it redirected back to the PC and when packets come back out from the PC the FW has to send them from that same port.

    The other way would be to put your PC in-front of the FW(defeating the purpose of the FW), or some FW's have a DMZ setting allowing you to basically map the PC as if it was in front of the FW(also defeating the purpose of the FW).

    BHayes -- ROUS Natural Selection Server.
  • saiyrsaiyr Join Date: 2002-11-03 Member: 5653Members
    I gotta stop by and say that not having a firewall is the dumbest thing you can ever do to yourself. More and more little script kiddies are running around every day.
  • StoneToadStoneToad Join Date: 2002-11-02 Member: 4053Members, Constellation
    edited November 2002
    The problem as I see it is how to get HL to report a different IP address then it has bound its listening port to.

    Forgot to mention that the WON servers will filter out any servers with private ip network addresses from the list they give to clients. If you don't nead the server to show up on the serverlist, it should work ok to forward the port.
  • NDGhetto_FractuxNDGhetto_Fractux Join Date: 2002-11-02 Member: 3892Members
    There are several ports you need to open:

    You need the folowing ports to be open

    tcp 7002, 5273
    udp 27015, 27010, 27012

    My serer does work behind my NAT. Thank god for iptables

    EXAMPLE

    iptables -A PREROUTING -t nat -p tcp -d externalIP --dport 7002 -j DNAT --to internalIP:7002
    iptables -A PREROUTING -t nat -p tcp -d externalIP --dport 5273 -j DNAT --to internalIP:5273
    iptables -A PREROUTING -t nat -p udp -d externalIP --dport 27015 -j DNAT --to internalIP:27015
    iptables -A PREROUTING -t nat -p udp -d externalIP --dport 27010 -j DNAT --to internalIP:27010
    iptables -A PREROUTING -t nat -p udp -d externalIP --dport 27012 -j DNAT --to internalIP:27012
    iptables -A PREROUTING -t nat -p udp -d externalIP --dport 27005 -j DNAT --to internalIP:27005
  • BHayesBHayes Join Date: 2002-11-02 Member: 4602Members
    When a Halflife server starts up it sends a 1byte UDP packet to the various Halflife Master servers. The masters then use the ip address on the ip header of this packet, and the port(usually 27015) from the UDP header to determine where to send Game Queries to. If your server can respond to the queries at that address, the HL masters will add you to the list of games and all the users will see your server.

    Binding to a different ip won't help(unless your truly are a multi-homed host with two different internet connections.). The ipaddress in the ip header is determined by the OS and/or your NAT/FW, not Halflife.

    As for the other ports, you can go ahead and open them up just to be safe(or un-safe if your a security guy), but the connections on those ports all originate from the server to the outside. So most FW/NATs will pass them through without much trouble. The only tricky port is 27015, since connections originate from the internet to that port.

    Hope this helps some.

    BHayes -- ROUS Natural Selection Server.
Sign In or Register to comment.