LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Static IP help (https://www.linuxquestions.org/questions/linux-networking-3/static-ip-help-408196/)

mengsk 01-26-2006 09:14 AM

Static IP help
 
I dont know if my computer already has a static ip or what; im a big noob.
Anyways i know my local ip (maybe thats not what its called) is 192.168.0.105
but i thikn thats assigned by my dlink router.
I want to be able to contact my computer from outside of my lan and therefore need to know what its ip is. I connect through a dlink router and then through a pretty secure cable connection (shaw if anyone lives in canada.)
So if someone could please quickly help me to figure out my ip so i can connect to my comptuer remotely that woudl be great.

baldy3105 01-26-2006 09:56 AM

The only way you can access your Lan from the internet is via the Public ip address that is assigned to the internet interface of your dlink router. 192.168.x.x addresses don't exist as far as the internet is concerned.

Once you know your public ip you will need to configure your router to forward connections to the ports you want to access to an internal host address.

mengsk 01-26-2006 01:15 PM

so basically my router gets assigned an ip which is like 72.139.x.x and then all my computers on my lan communicate thorugh that ip adress and the router is just a gateway for information..?

Sir_Limpalot 01-26-2006 03:09 PM

Correct, the only ip visible on the outside is the outside-ip of the router.
So if you want to connect from the outside in you'll have to set up your router to forward the specified port (22 for ssh for example) to the ip of the inside-machine you want to connect too...

Jelle 01-26-2006 03:34 PM

And indeed you will probably need a static IP on the lan for that. Probably your computer gets it's ip with dhcp, how you can change that depends on your distro. It looks like your router already assigns ip's above 192.168.0.100. Make sure the address you pick below that (like 192.168.0.3) is not used before you assign it with your distributions intended tool. Als make sure that your /etc/resolv.conf is not empty, but usually after switching to static it will not be wiped. Otherwise put two nameserver ip's in there like nameserver 192.168.0.1 \n nameserver 11.22.33.44

mengsk 01-26-2006 10:47 PM

whoa im a noob can we take two steps backward
whats a name server?
what is the purpose of /etc/resolve.conf?
how do i assign an ip to my server (slackware) right now it seems to be keeping 192.168.0.105 everytime i start up however i do remember configuring my network to use a dhcp host (my router)
thanks a lot for help

baldy3105 01-27-2006 09:52 AM

Ok lets reitterate -

Your router has two networks attached to it. One is the network connecting you to your ISP and has a public ip address. i.e. one that is recognised by any host on the internet.
The other connects to your LAN which is using the network 192.168.0.x. This is a network in the reserved range of 192.168.0.0 to 192.168.255.255. Any networks in this range do nt exist as far as the internet is concerned. This allows you to use these addresses in your private network and still connect out to internet hosts without fear of address conflicts.

Now obviously for outgoing connections from your PC to the internet, the internet must perceive them as coming from your public address not your private one, or return packets will never get to you. Remember 192.168.0.x doesn't exist on the internet.

This function of pretending that your outgoing connection is comming from your public address is called Network Address Translation or NAT and is performed on on the router. All outgoing packets are edited to show the public address as source. All incomming packets are edited to show the private address as destination.

To make configuring your LAN easier your router is acting as a DHCP server. This allows your PC's to dynamically configure themselves with address info from the server when they boot up. The router will probably be handing out addresses in the range .100 to .254 or something like that. If you want to fix your PC's IP address you need to disable DHCP on the PC and manually configure an address into it. If you pick something in the .50 to .99 range you won't risk any conflict with a DHCP configured device

Another peice of info that your dhcp server will be handing out is a DNS server or nameserver. DNS is the system by which your PC converts names into IP addresses for you, allowing you to type www.google.com and actually connecting to 219.132.6.45 or whatever.

If you switch DHCP off then your PC's will no longer learn the nameservers to use at bootup from the DHCP server. So like the IP address this needs to be manually configured on the PC and resolv.conf is where this information is kept.

How exactly you configure IP addresses and nameservers is dependant on your distribution. If it has configuration tools, like Suse's YaST then use them. If not you will need to edit config files with vi or something.

mengsk 01-27-2006 11:15 AM

thanks a lot for the explanation it all makes sense now
So I need to add lines to resolv.conf that will tell my computer its ip and what nameservers to use. Ok I'll look into that when I get home.
Is there any other file i need to modify to tell my computer not to use DHCP or is it all in resolv.conf?
Also what nameservers do I need to configure my computer to use and how would these lines look in resolv.conf.
I really appreciate all the help. Thanks.

Jelle 01-27-2006 11:24 AM

No, resolv.conf is for resolving domain names into ip numbers. Where you can set your network settings depends on your distibution(fedora, SUSE, Debian, etc...). Use the tools of your distro to do that. As I don't know what distro you have, I cannot tell you how to proceed, but if your distro is Debian or Debian-based, you can find and edit your network settings in /etc/networking/interfaces.
So: post your distro and maybe some kind soul will tell you how to change your network settings.

Plauderer 01-27-2006 11:51 AM

You started the thread by asking how to determine your external IP. In that case you might find this link usefull www . whatismyip . com It will tell you your IP. :)

Plauderer

P.S.: Stupid board won't let me post URLs for i haven't posted more than 5 posts yet. :( :)


All times are GMT -5. The time now is 11:34 AM.