LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-29-2005, 02:08 PM   #1
compzoo
Member
 
Registered: Jan 2005
Location: Indiana
Distribution: Suse 9
Posts: 38

Rep: Reputation: 15
my pingwing won't surf the net


How can I change my linux box to come up at the same ip address everytime?

I have dhcp setup in my router and want this box to always appear at 192.168.1.4.

When I rebooted it now its at 192.168.1.5????

thanks

Last edited by compzoo; 01-29-2005 at 05:56 PM.
 
Old 01-29-2005, 03:27 PM   #2
compzoo
Member
 
Registered: Jan 2005
Location: Indiana
Distribution: Suse 9
Posts: 38

Original Poster
Rep: Reputation: 15
hmmmm

I was able to set this through webmin....

but for some reason i can't get out on the internet...I can see my website at http://192.168.1.4, but I get an unknown host error when i try to surf the net..

any ideas?

thanks
 
Old 01-29-2005, 03:32 PM   #3
dijkstra
LQ Newbie
 
Registered: Jan 2005
Location: Madison Heights VA
Distribution: SuSe
Posts: 13

Rep: Reputation: 0
You have your router set up for dynamic IP addressing. I believe one way to solve your problem is to foreward all requests on port 80 to the box's DNS entry (it's name) (It's a router config thing)
 
Old 01-29-2005, 03:38 PM   #4
compzoo
Member
 
Registered: Jan 2005
Location: Indiana
Distribution: Suse 9
Posts: 38

Original Poster
Rep: Reputation: 15
I don't want the world to see the linux box until i secure it...it's setup as an intranet server right now...so i don't want to forward port 80 to it yet...

i was able to surf the internet and have others internally see the intranet site on this linux box until today...

now i get unkown host when trying to go to say... google
 
Old 01-29-2005, 03:39 PM   #5
dijkstra
LQ Newbie
 
Registered: Jan 2005
Location: Madison Heights VA
Distribution: SuSe
Posts: 13

Rep: Reputation: 0
Unless you can only not get out with one machine. The issue isn't with your linux box. It's with your router. Go to the config page (probably http://192.168.1.1 and see if that gives you any indication that your WAN or Internet status, is active. I'm assuming your using your router as a DHCP server judging by the fact that you've got a 192 IP range.

Last edited by dijkstra; 01-29-2005 at 03:42 PM.
 
Old 01-29-2005, 03:41 PM   #6
compzoo
Member
 
Registered: Jan 2005
Location: Indiana
Distribution: Suse 9
Posts: 38

Original Poster
Rep: Reputation: 15
it has to be active because i am online right now with this windows box...it's hooked to the same router???

update..i checked the router and it shows 2 windows machines connected and the linux box at 192.168.1.4 where i want it.

both windows boxes can surf the net..the pingwin can't???

Last edited by compzoo; 01-29-2005 at 03:46 PM.
 
Old 01-29-2005, 03:45 PM   #7
dijkstra
LQ Newbie
 
Registered: Jan 2005
Location: Madison Heights VA
Distribution: SuSe
Posts: 13

Rep: Reputation: 0
Quote:
Unless you can only not get out with one machine.
So the problem is that only the machine you're using as a web server can't get out?
 
Old 01-29-2005, 03:46 PM   #8
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
You have a few choices, most of which have little if anything to do with your linux box.

1) Super Easy - Go into your router and tell it to alwasy give the linux box the same IP. To do this you usually need to tell the router/dhcp server the MAC address of the computer's network card. To find your MAC address, do this:
Code:
su -
(password)
ifconfig eth0 (or eth1, or whatever eth you use to get online. If you only have 1, it is eth0).
It is possible that your router won't support static IPs, particularly if you have the cheapest of cheap routers. If this is the case, you can assign a static IP to your linux box. I don't know the path to the network config files in Suse, but it is likely close to Fedora. You would change to the network config file, and edit it from dhcp to having a staic address, and then give the static. You'll need to check out 2 files actually, the network config and the resolv.conf, which gives the nameserver addresses to your linux box. You'd have to do this:

Code:
su
(password)
(actual path may vary based on distro) vim /etc/sysconfig/network-scripts/ifcfg-eth0
Change it from:
Code:
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
to be:

Code:
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.4
NETMASK=255.255.255.0
NETWORK=192.168.1.0
GATEWAY=192.168.1.1  (assuming your router is at 192.168.1.1, if elsewhere just change it)
ONBOOT=yes
TYPE=Ethernet
You'll also need to take a look at the file /etc/resolv.conf. That is where the nameservers are listed. your resolv.conf should have the current nameservers that the router is giving out. Just take a look at it, and copy the file to a backup incase it gets horked when you make this cahnge. Chances are very good your router is either giving out itself as the DNS server, or the DNS servers directly from your highspeed provider. You shouldn't have to actually make any changes to resolv.conf, just save the backup incase restarting the network services screws it up.

The only problem you might encounter in the future is if your high scpeed provider changes the address of their DNS servers in the future, and that is possible but very unlikely. You'll still have access to the net, but your computer won't be able to translate human names for websites (google.com) into IP addresses (216.239.39.99). If other computers in your LAN have connection but your linux box can't resolv names, this is what happened.

Now the final issue, restarting the network services. The other OS way to do this is to reboot the machine, and that will do it, but is a craptastic way of accomplishing what should be a 2 second solution. You have to be root again, and can give one of 2 simple commands. You can either do:
Code:
ifdown eth0                     (followed by)
ifup eth0
Or the even easier:
Code:
/etc/rc.d/init.d/network restart
That should solve your issue. It is easier to tell the router to give you the same address, but it isn't at all hard to make your linux box come up at a given address on its own.

Peace,
JimBass
 
Old 01-29-2005, 03:48 PM   #9
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
Assuming you have a router capable of reserving IP addresses...

My suggestion: return the box to using dhcp

Your router probably has the ability to assign a specific IP address to a specific MAC address. On my Red Hat box, you can see the MAC address using ifconfig:
Code:
ifconfig eth0
It's shown as "HWaddr" in that command's output. It may be slightly different for Suse.

Then you take that value, open up your router's configuration interface, punch in the MAC address, associate the IP address you want, and then reboot/reset/power cycle the router. You may need to release the IP on your box, and then renew it, but that should be it. Using DHCP, your box will get the necessary gateway/dns settings (which will likely point back to the router), and for all intents and purposes, have a static IP even though it's using DHCP.

EDIT:
Crikey... I was too slow.
 
Old 01-29-2005, 03:49 PM   #10
dijkstra
LQ Newbie
 
Registered: Jan 2005
Location: Madison Heights VA
Distribution: SuSe
Posts: 13

Rep: Reputation: 0
Is your router a linux box or a lynksis/belkin/etc.?
 
Old 01-29-2005, 03:53 PM   #11
compzoo
Member
 
Registered: Jan 2005
Location: Indiana
Distribution: Suse 9
Posts: 38

Original Poster
Rep: Reputation: 15
hmmm /etc/resolv.conf is empty???

what should be in there?
 
Old 01-29-2005, 03:55 PM   #12
compzoo
Member
 
Registered: Jan 2005
Location: Indiana
Distribution: Suse 9
Posts: 38

Original Poster
Rep: Reputation: 15
netgear router.....

this all worked yesterday... my son was surfing the net on the linux box...when the prob showed up
 
Old 01-29-2005, 03:57 PM   #13
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
/etc/resolv.conf must have the DNS server IP addresses. That is why you think it can't get on the internet. Actually it can, but it can't change human names into IP addresses. Simple solution - open a cmd prompt on the winblow$ box, and type ipconfig /all and find out the dns server addresses. Add those addresses into the resolv.conf file, and restart the network services. You should be able to resolve names then.

Peace,
JimBass
 
Old 01-29-2005, 04:38 PM   #14
dijkstra
LQ Newbie
 
Registered: Jan 2005
Location: Madison Heights VA
Distribution: SuSe
Posts: 13

Rep: Reputation: 0
Wonder how it happened? Desperate deletion? And by the way. Just because you have to pay for it doesn't mean it sucks... :-D

Last edited by dijkstra; 01-29-2005 at 04:40 PM.
 
Old 01-29-2005, 05:47 PM   #15
compzoo
Member
 
Registered: Jan 2005
Location: Indiana
Distribution: Suse 9
Posts: 38

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Dark_Helmet
Assuming you have a router capable of reserving IP addresses...

My suggestion: return the box to using dhcp

Your router probably has the ability to assign a specific IP address to a specific MAC address. On my Red Hat box, you can see the MAC address using ifconfig:
Code:
ifconfig eth0
It's shown as "HWaddr" in that command's output. It may be slightly different for Suse.

Then you take that value, open up your router's configuration interface, punch in the MAC address, associate the IP address you want, and then reboot/reset/power cycle the router. You may need to release the IP on your box, and then renew it, but that should be it. Using DHCP, your box will get the necessary gateway/dns settings (which will likely point back to the router), and for all intents and purposes, have a static IP even though it's using DHCP.

EDIT:
Crikey... I was too slow.
I set the router to always port the linux box to the ip i wanted... set the linux box back to dhcp from the router...the resolv.conf has the nameservers... everything is kewl again.

Thanks i'm kinda hooked on this linux stuff... reminds me of the old dos days..
Now if I could only load dreaweaver, fireworks and flash on a linux box i'd be completely switched over . hmmm maybe i need to get a mac for that stuff!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
in-addr-arpa HELP!! james.farrow Linux - Networking 8 10-10-2008 02:47 AM
Obtain IP addr. from MAC addr? Ryand833 Linux - Wireless Networking 3 06-30-2005 01:59 PM
Could I set a NIC running in a fixed rate?? elvafans Linux - Networking 2 04-13-2005 07:59 PM
get the IP-addr out from an int32_t value Ephracis Programming 3 02-09-2005 09:03 AM
Help, IP Addr. dolvmin Linux - Networking 3 01-23-2004 08:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration