Server Accessible Locally, Not from the Internet

You can learn something everyday it seems.

Yesterday, I had some issues that I hadn’t planned on ever occurring with my local development server. Basically, the issue was discovered when my server suddenly did not have ANY access from the internet. Now, it DID have access to the internet, oddly enough, and I could reach it via hostname through my local network. The first issue I figured it would have been was a router problem. Namely port forwarding was getting messed up. My server is set statically on my network, so the port forwarding should be fine, and Remote Desktop to my XP machine works fine from the outside world. So the router is NOT the issue. Next step was DNS. Maybe my dns is messed up? I checked out my /etc/resolv.conf

> vi /etc/resolv.conf

nameserver 192.168.1.149
nameserver ###.###.###.###
I blocked out the ### because this is uneeded information about my ISP. Normally you want your name servers to be a nameserver, or your access to a name server. The first shows my router, from the inner network, which is what can be here. This explains why my hostname works via my network. But it is not the solution to my issue. So I dugg a bit deeper. What was that I said earlier? Ah yes, my server has a STATIC ip. Which means I should have a static route.
> ip route
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.129
default via 192.168.1.1 dev eth0 metric 100
OK! There is my issue! My static route is pointing by default to 192.168.1.1 which is NOT my router (192.168.1.149). So a quick update to that and that should fix it!
> vi /etc/network/interfaces

This file describes the network interfaces available on your system

and how to activate them. For more information, see interfaces(5).

The loopback network interface

auto lo
iface lo inet loopback

The primary network interface

auto eth0
iface eth0 inet static
address 192.168.1.129
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.149
I edited the line in bold. This was 192.168.1.1 and now it is 192.168.1.149
> /etc/init.d/networking restart
Now the networking is reset!
> ip route
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.129
default via 192.168.1.149 dev eth0 metric 100
default via 192.168.1.1 dev eth0 metric 100
And Wa-Laa! All done. Now I can access my server via the internet from anywhere as it should be always.

Lesson learned I guess. Hope this helps some others stump issues they are having with static networking on linux.