Public IP for my PC through XFINITY gateway router/modem
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.
Solution 1:
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.