Setting up a static IP on linux box which obtains an IP via DHCP
Hello there wonderful people who help strangers!!!
Let me get to the point:
I have 3 computers, 1 running XP with ICS turned on and 2 running FC2. Both linux machines obtain their IP's via DHCP (XP box). I'm hoping to run a web server on one linux box. (Don't worry, got all the details on setting up DDNS and port forwarding). So, first things first, I need to know how to make the DHCP server (XP box) always assign the same IP for the corresponding linux box.
p.s: Please keep in mind the fact that I'm using FC2 and there isn't much documentation for FC2. All the stuff I find won't work on FC2 b/c there is always some tiny difference from other distro's and FC's grandpa red hat.
All help is well appreciated!
Okay. I did some more research and got this far:
I su('d) to root and changed "/etc/rc.d/rc.local" and added the following line:
ifconfig eth0 192.168.0.2 netmask 255.255.255.0 up
Then I simply rebooted the machine and issued the "sbin/ifconfig" command as root to see if th IP was 192.168.0.2. Well it was, however I couldn't access the net. I think, the rc.local script runs after the DHCP server (XP box) has issued an IP, hence the DHCP server (XP box) doesn't acknowledge the new IP 192.168.0.2 .
So, what do I have to do to make it work? I'm guesing I will have to do something on the DHCP server (XP box) end. Please help, this is frustrating b/c I have been up for about 23 hours. I'll stay awake to hear from you.
use netconfig instead
I set up the linux box as rug.mshome.net and the DHCP client (XP box) as fem.mshome.net.
I can ping all the computers from each computer. Now, even though the IP's are dynamic, the computers can still communicate using th hostnames.
However, now I need to know whether a DDNS client on Linux will work behind the DHCP server (XP box). I hope it will.
Thanks for your help, and any suggestions on DDNS and port forwarding using WIndows XP is welcome!!!
If you will check out the DHCP Howtos for the dhcpd daemon it give examples of how to setup a linux box to "request" the same dhcp assigned address and to request longer lease times from the server.
Even though a dhcp server "attempts" to provide the same assigned IP to a given host it does not always do so.
I may make a suggestion to you.
On a small network go with static addressing on all your boxes. Using the hosts files you can set up a local "dns" where each box knows the other (windows hosts file is located in c:\windows\system32\drivers\etc and is the same as a linux hosts file). You can use netconfig to set you linux box's IP/mask/gateway. Also get your ISPs DNS IPs to put them in both on your windows box and linux boxs.
On your linux boxs edit resolv.conf to something like this if it is not already that way once you have ran netconfig
search yournetwork.int #your network
nameserver 100.100.100.100 # your ISPs DNS primary
nameserver 100.100.100.101 # your ISPs DNS secondary
This is a most basic set up and can be greatly expanded on with varies services.
I have a problem similar and could use some help if anybody's willing?
Trying to setup FC2 server on server box 2 p2300's 512mb ram compac 2sl scuzzy 2 NIC's (1) 3com 905 (2) compaq NC3120.
Computer 1. WinXP Pro AMD AthlonXP 2100+ 512mb ddr2100 D-link NIC
Computer 2. Win2000 Pro AMD 950 384mb ddr2100 (cant' remember NIC)
Server can obtain auto from cable DHCP no Prob. but can't get network to work with second NIC. Second NIC causes a change in gateway and first no longer connects to Internet. And if I don't start first and just start second, I can't ping server from winXP (not found).
I too have read until my eyes feel like there going to bleed. Can somebody put this networking into a step by step I can follow for these machines to talk to each other?
I will attempt to lend you a hand. I am most familiar with Slackware and BSD as I will be using them as exapmles you may have to hunt for the correct files on your system as they may be different.
Configure the nics on the server;
Find the file that configures the nics eth0 and eth1 (slackware=rc.inet1.conf) others may be in the /etc/init.d directory. Fire up your fav editor as su and tweak it....
# This file contains the configuration settings for network interfaces.
# If USE_DHCP[interface] is set to "yes", this overrides any other settings.
# If you don't have an interface, leave the settings null ("").
# Config information for eth0:
USE_DHCP="yes" # WAN (cable) assigned addy
DHCP_HOSTNAME="" # your HOSTNAME here
# Config information for eth1:
IPADDR="192.168.1.254" # This will be your LAN gateway address
NETMASK="255.255.255.0" # 24 bit netmask
USE_DHCP="no" # dhcp not used here
DHCP_HOSTNAME="" # your HOSTNAME or HOSTNAME alias here
Restart your inet1, as in ./rc.inet1 restart or ./inet1 restart
This "should" work so far as to use eth0 as your WAN and eth1 as your LAN.
Note the /etc/resolv.conf editting is not required as the eth0 dhcp will rewrite it at each new lease renewal.
If you have already assigned machine names and static addresses to your window machine edit your hosts files accordingly.
192.168.1.254 mycpu.mydomain.myint mycpu
192.168.1.100 myxpcpu.mydomain.myint myxpcpu
192.168.1.101 my2kcpu.mydomain.myint my2kcpu
Next set up the windows networking on the windows boxes under network connections
Give them static addressing unless you are running a dhcp server on your server.
If you are not running a dhcp server you will need to put in the ISPs DNS in the dns section of the TCP/IP network properties on the windows boxes. Assign the gateway to the windows boxes that of the eth1 address from your server. Finish up the network configuration on the win boxes they should reboot. Note you can edit the aforementioned windows hosts files to allow for name usage of your "private" LAN.
Open a CLI on a win box. Check the ipconfig. It should show your IP and the gateway as the addy of eth1 on the server. Give it a ping. Now ping an internet addy (ping linuxquestions.org). You should get a reply back if all went well.
Hopefully this will help....
The reason your Linux box can not get to the internet when the IP is statically assigned is that it is not getting a default gateway. You will need to add an entry in the configuration file for you default gateway (it should be 192.168.0.1 since your XP box is using ICS).
Now, about this port forwarding.... It is my understanding that XP and ICS will not provide that functionality. ICS is simply a NATing router, and that is it. It does not allow you to forward port 80 to another box. There may be registry hacks to get this sort of function or some 3rd party application you can run, but I'm not aware of any.
Regarding DDNS, you can get many clients for updating DDNS at dyndns.org. I'm using a client on my linux box to update and it works very well. There are also many clients that run on Windows too and I'm sure they are easier to set up than the linux clients. (I'm going to get flamed for that...)
Either way, I think you need to resolve your issue with port forwarding before you web server will be available via the internet. Have you given any consideration go changing your topoplogy a bit. I'd suggest using one of the Linux boxes to share you internet connection to the internal network. You can then put the webserver directly on the internet, or do port forwarding, as that functionality is easily available in Linux.
Just some suggestions.
First of all thanks everybody for the replies and sorry for the late reply on my part, I was asleep for a day. ;)
I have managed to get ddclient running on linux and it's working fine on updating my IP. ddclient also works behind a NAT.
The reason I cannot change my topology is because my adsl modem doesn't have a linux driver (Modems a Prolink Hurrican 8000 - searched everywhere but no drivers for linux.)
Anyway, I managed to get a 3rd party port forwarder called NetActiv for windows (free ware). It works fine(sort of) at forwarding connections but it doesn't update the IP (it was made with static IP in mind).
Anyway, I set up everything and set NetActiv to forward all connections to port 25 on rug.mshome.net (this is the hostname I gave linux, please bare with the mshome bit, I just did so that I don't have to change the winXP hostname). Anyway, I can connect to the SMTP server running on rug.mshome.net from god.mshome.net (which is my second "sexy/god like" linux pc) and also from fem.mshome.net (my XP box). But I cannot connect to the SMTP server (which is on rug.mshome.net) from the internet. (As in, when I connect to my dyndns.org hostname)
Just in case to check the DDNS, I set up a small VB app to accept incoming connections on port 96 and display a message once connected. So from an outside PC, I telnet to 247.homelinux.org (this is the dyndns.org domain I got) on port 96. It connected and displayed the message properly. (So the outside world can connect to my XP box across the hostname)
So my DDNS is working properly. However, either:
1.) Port forwarding isn't happening properly on my XP box or,
2.)The 3rd party port forwader or my network configuration is wrong.
I think I'll follow your advice and completely re-configure the network and this time with better hostnames. I'll get back if there are any problems.
Again, thanks for your help. It's a weird feeling you get when strangers help strangers!!! :)
PS: Once i've got this thing figured i'll be TRYING to make an on-screen keyboard for linux. My simple cotribution to the linux community.
By the way, Wolfy, I hope these links helps you:
Thanks for the links, I bookmarked them for later consumtion.
Sorry if I offended you by jumping into your thread with my BS.
I do have a curious problem now though.
I can network my linux and windows machines kindof, windows can see linux, but linux can't see windows. I can ping so that's an improvement. But eth0 won't connect or activate or anything, it's dead........It's configured for dhcp auto but still won't connect. Maybe if I remove eth1 and try to connect again, then reinstall eth1.
I know it's a config issue but I'm still learning.
Anybody out there have some advice?
Hey Wolfy and everybody else,
I think you should start over b/c it sure did a lot of good for me. I re-configured my network and now everything is okay. I even found a decent port forwarder for winblows called M2k Port Forwarder. It has basic options but atleast it works!
Wolfy, I'm new and I cannot help or advice your ethernet card issue but I may be able to help you connect everything togteher.
So my problem is solved, well not fully but now I know it works and the rest is up to me.
So Thanks For Everyones Help!!! Best I can do is give you a big smile :) and some titties for the guys:
( o Y o ) <--- Have fun!
I do have some advice:-
Since you think it's a config issue try doing this:
Startup FC2 then load up a terminal and su to root.
Then issue "cd /etc/init.d"
Next issue "./network restart"
Then try loading google or something. Basically this will reinitiate contact with the DHCP server and hopefuly will work. If it does, then you do have some sort of config problem.
Also try this:
load up a terminal and issue "cat /etc/rc.d/rc.local"
This file should be empty as in it should not contain any IP address. I think. Not too sure about the rc.local thing so you better check or make a backup copy then try removing any lines containing IP's.
This script is supposed to run after all other scripts so if you define any IP address here, it would mean there is a change in the IP (after the DHCP has issued an IP address) and the DHCP server will not identify the new IP.
Hope this helps,
Just a "small" note.
In one of your post you gave out your compters hostname, which ports you had open, your dynaddy link to a small network which seems to be only guarded by "NAT" and a swiss cheese windows box now with publicly posted open ports. I do hope you have good back-ups of your systems and have no important personal info on them..
That is about as bright as a 1 watt light bulb...
Thanks for the warning. You can actually knock out the XP box with a certain exploit :tisk: (I'm sure there are more than one) . I've been meaning to add a Firewall...but I need a good free ware wall that could also possibly do the port forwarding. Any suggestions?
Thanks for the warning,
|All times are GMT -5. The time now is 09:34 AM.|