Public IP for my PC through XFINITY gateway router/modem

8,628

You could put your "web server" PC on a static private IP address and then configure the NA[P]T gateway feature inside your router to make that IP address be the "DMZ" (a.k.a. "default host", "bastion host", "default server", etc.). Or, since you maybe only care about web development, you could just make a small handful of port forwarding rules (port mappings), for TCP ports 80 and 443, and maybe also 8000, 8080, or whatever, if you have multiple websites you're developing in parallel.

You could then point a DNS hostname at your cable gateway's public IP address. In my experience, Comcast doesn't change my public IP address very often, so since I'm only "hosting" experiments and not real public websites that need serious uptime, that's good enough for me. I haven't looked into paying for a static public IP address. If Comcast changes your public IP address a lot, you could use a Dynamic DNS solution like Dyn.com (dyndns.org) to keep your public domain name pointed at your public IP address even when your public IP address changes.

Please note that for this to work well for you, your NAT gateway needs to support "NAT Loopback" (a.k.a NAT Hairpinning), which not all NAT gateways do. NAT Loopback is for when you're running, say, a web browser on one of your machines on your home LAN, and you go to the public domain name or public IP address of your website. Your NAT gateway has to do "outgoing NAT" on that packet, and then realize that the packet needs to turn right around and go through "incoming NAT" to get to your server on the private side of the gateway.

The reason people using port forwarding or DMZ features for this is because it's more likely to be supported in home gateways. The ability to do NA[P]T for some addresses, but bridge or route other addresses, is less common. The networking layer of Linux is almost infinitely configurable, so if you can put an aftermarket Linux firmware distro on your gateway, you might be able to configure it to do "NAT for some addresses, bridging for other addresses" like your were initially envisioning, but I've never set that up myself so I can't quite vouch for it.

Share:
8,628

Related videos on Youtube

AHare
Author by

AHare

Updated on September 18, 2022

Comments

  • AHare
    AHare over 1 year

    Question: It is possible have public IP for my PC hooked up to XFINITY gateway (the router/modem combo) through wifi? My home network has several PCs connected to the XFINITY gateway through wifi. Each one has it's own private/local IP address of course. My PC has a web server running on it with web apps I'm developing (unlike my spouse's and kids PCs). So I'd like to be able to access my PC through a public IP to test my devel web apps without having to pay to third party for this service since I'm already paying Comcast for our Internet service at home. I've been developing for awhile, but new to networking as most of my development was done on workstation at work which already has public IP. Any help and suggestions will be greatly appreciated.

    • Admin
      Admin over 6 years
      If Comcast only assigns NAT ip address then you are out of luck unless you pay them for a public ip address. You have not given enough information to determine if they assigned only NAT ip addresses. Furthermore it is against the Terms of Service to host a website on your home connection. Additionally if you are assigned a NAT ip address it won't be possible to forward your domain to your ip address for obvious reasons. But you don't need to forward ports, or have a "public ip address", to do web development work. You just use localhost instead.
    • Admin
      Admin over 6 years
      @Ramhound Comcast doesn't use carrier grade NAT. Comcast XFINITY customers always get a public IPv4 address.
    • Admin
      Admin over 6 years
      The author wasn't very clear. The author most likely only has one ip address anyways.
  • AHare
    AHare over 6 years
    Thank you. I'll try this approach. That is a lot of information to take in and explore since I'm new to networking.
  • AHare
    AHare over 6 years
    Thank you for the thorough explanation. That's a lot of valuable explanation. The XFINITY modem/router i have already assigns the local IPs in the 10.0.0.x format. From the Test Things In The Right Order - the numbers 1, 2 and 3 all checked out already. I do know my public IP and can access the web server through it when on the local network (connected to my wifi). However, the number 4 doesn't. That is I cannot access my web server/gateway while on non-local network. Is it possibly because of the firewall settings or something else? Any suggestions?
  • Anaksunaman
    Anaksunaman over 6 years
    Glad to help. I hope you get everything working to your satisfaction.
  • Anaksunaman
    Anaksunaman over 6 years
    It could be the gateway settings. I would double-check any firewall settings on the gateway as well as any port forwarding settings.
  • Anaksunaman
    Anaksunaman over 6 years
    Just to be clear, on the port forwarding, you need something like "HTTP TCP 80 80 10.0.0.10" and make sure the blue "Active" button is checkmarked. 10.0.0.10 is an example of course and should correspond to the webserver's local IP.
  • Anaksunaman
    Anaksunaman over 6 years
    Welcome and please do.