Click to See Complete Forum and Search --> : [SOLVED] How to set up a Static IP?


raid517
04-15-2005, 12:01 PM
Hi I am trying to figure out my networking issues. At the moment I can use dhcp - but this is useless for most peer to peer applications - such as amule and bittorrent.

I connect to the internet with a combo router/modem.

My router is set up so that I can contact it by typing 192.168.1.1 into a web browser. I have a dhcp server set up so that all addresses up to 192.168.1.110 are static and all addesses from 192.168.1.111 to 192.168.1.254 are automatically assigned by dhcp. Which means I have 110 static IP's.

I set my IP address to 192.168.1.110
I set my netmask to 255.255.255.0
I set my broadcast address to 192.168.1..255 (the 255 part was added automatically).
I set my gateway to 192.168.1.1

This always worked in the past.

I have no idea why it isn't working now.

I noticed in kcontrol that there was also another tab for 'domain name system' and 'static hosts' - but I have no idea what these are, how to configure them or even if they are configured correctly.

I'm not sure I trust that KDE is configuring my network correctly though.

Can anyone advise on the best way to set a static IP address from the details I have given and have my network automatically started on boot? Or does anyone know of any easy graphical networking tools I could try?

I would very much appreciate any advice anyone can offer.

Best regards,

GJ

vontez
04-15-2005, 01:43 PM
Can you ping your router? (192.168.1.1)

$ping -c 3 192.168.1.1

If you can, but the internet isn't working it is more than likely a problem with your DNS setup.

serz
04-15-2005, 01:53 PM
Have you added your ISP's DNS to /etc/resolv.conf?

nameserver ip
nameserver ip

That's what you have to add, remplacing both "ip" for your ISP's DNS ips.

raid517
04-15-2005, 02:49 PM
Hi thanks for the replies. No I have not added these entries to resolv.conf - because I connect with a router - and this is set up for auto discovery of my ISP's DNS servers. This works fine - and worked without difficulty until I reinstalled my OS (kubuntu) a few days ago. Having a static IP on the internet isn't really the same as having an internal static ip - which is what I am trying to set up.

Here is the output of some tests I did,

PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=255 time=1.16 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=255 time=1.06 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=255 time=1.07 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=255 time=1.07 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=255 time=1.07 ms
64 bytes from 192.168.1.1: icmp_seq=6 ttl=255 time=1.12 ms
64 bytes from 192.168.1.1: icmp_seq=7 ttl=255 time=1.04 ms

--- 192.168.1.1 ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6005ms
rtt min/avg/max/mdev = 1.048/1.087/1.163/0.051 ms
raid517@linux1:~$ ping www.google.com
connect: Network is unreachable
raid517@linux1:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:11:09:C7:24:91
inet addr:192.168.1.110 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::211:9ff:fec7:2491/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25 errors:0 dropped:0 overruns:0 frame:0
TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2862 (2.7 KiB) TX bytes:2123 (2.0 KiB)
Interrupt:16 Base address:0xe000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:100 (100.0 b) TX bytes:100 (100.0 b)

raid517@linux1:~$

Also I can browse my routers settings page from my Linux machine - but regardless of this I still cannot browse the internet with a static IP address set.

Oddly though I have found that when I set a default gateway address in KDE control, it will not stick. If I shut down KDE contol and start it up again the line for the default gateway is empty. Is there a text file I can edit somewhere to explicitly specify what my network settings are and over ride the settings in Kcontrol? If so which file and how should I edit it?

I'm using debian BTW.

GJ

serz
04-15-2005, 05:02 PM
Try this:

route add default gw 192.168.1.1

raid517
04-15-2005, 05:17 PM
Dude that worked a treat. Thank's very much! :) Your a star!

I was beginning to think I would never get this fixed.

But I'm curious, what did I just do? I mean I know I defined the route, but what did I edit or change? These commands are all great, but I would like to understand how and why things work too.

Best regards,

GJ

serz
04-15-2005, 05:50 PM
That's the way of setting up your gateway manually. Tell us what distro are you on and we will tell you how to set it up permanently.

vontez
04-15-2005, 05:52 PM
Type in:

$man route

and find out for yourself! :D

raid517
04-15-2005, 06:02 PM
Originally posted by serz
That's the way of setting up your gateway manually. Tell us what distro are you on and we will tell you how to set it up permanently.

Oh so that won't survive a reboot? OK I'm on Kabuntu/Debian.

If you could tell me how to make it permenant - and maybe how not to rely on KDE and other GUI tools to set up my networking in future too, I would very much appreciate it.

Best regards,

GJ

serz
04-15-2005, 06:17 PM
Ok, edit /etc/network/interfaces and be sure to have these lines:

iface eth0 inet static
address 192.168.1.110
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1

And that's it. Now once you power up your computer you should have all set up :)

raid517
04-15-2005, 06:30 PM
Dude you rock! Thanks very much. That worked fantastically. I will never depend on GUI tools to configure my network again!

Thanks for everything. :)

Best regards,

GJ

serz
04-15-2005, 06:38 PM
Originally posted by raid517
Dude you rock! Thanks very much. That worked fantastically. I will never depend on GUI tools to configure my network again!

Thanks for everything. :)

Best regards,

GJ
You're welcome! :)