Link to home
Start Free TrialLog in
Avatar of 940961sl
940961sl

asked on

IP-address change...

Here's the situation :
I've got a linuxbox connected to my ISP (cable modem) using dhcp to get my ip-address. The box is used as a firewall and an ip-masq box for the rest of the network. This setup worked fine for about 3 weeks, until yesterday. My ISP changed the ip-address given to linux, but linux didn't see?, accept? reject? the change.

rebooting the system solved the problem. But why isn't this new ip-address accepted automatically?? How can I make sure I don't have to reboot my linuxbox next time my ISP changes the ip-addresses?

Comments only please. I will reject all answers. (And rejected answers don't have a "accept comment as answer" button)
ASKER CERTIFIED SOLUTION
Avatar of j2
j2
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AGB
AGB

If you are just a regular user you need a DCHP client daemon. The package you need to download and to install is called dhcpcd.

In RedHat start Control Panel by typing control-panel.
Select Network Configuration;
Click on Interfaces;
Click Add;
Select Ethernet;
In the Edit Ethernet/Bus Interface select "Activate interface at boot time" as well as select DHCP as Interface configuration protocol.
When you are finished go the "last step"
Avatar of 940961sl

ASKER

Thanks for the responce.
The distribution is RedHat 6.0
I don't know anything about the client deamon... I just installed the networkcards, configured them and it worked fine. I didn't install any dhcp client.
I will check out the link above and see if I can get it to work.

What services need to restart if the ip changes?? I've got a telnet and an ftp server.

I'll be back in a couple of days...
AGB :
Thats what I did in the first place to configure the network. So doing it again wont change very much I'm afraid...

j2 :
I donwloaded dhcpxd and compiled it using the commands :

../configure
make
make install

and i restarted the system. a ps -aux doesn't show me anything like dhcpxd. but I did see a /sbin/pump -i eth running so I guess the old dhcp client is still installed and running? How do I continue from here, and as important, how do I test everything when it's installed? Do I have to wait another 3 weeks until my ISP changes ip-addresses again?
Sorry, ../configure should be ./configure. Just 1 .
dchpcd but not dchpxd
You also need to edit /sbin/ifup and /sbin/ifdown

replace

if /sbin/pump $PUMPARGS -i $DEVICE ; then

with

if /sbin/dhcpxd -w -c -n $DEVICE ; then

in ifup.

and replace

pump -r -i ${DEVICE}

with

dhcpxd --kill ${DEVICE}

in ifdown
dhcpxd has everything dhcpcd has, and more. dhcpxd even gives _useful_ logs when something fails. Which is more then i can say for dhcpcd.

also, unless you want dhcpxd to log to a console (tty7 by default) do this

rm /etc/dhcpxd/out ; touch /etc/dhcpxd/out

this will log to file instead.
But, you could also just run

ifdown eth0
/sbin/dhcpxd -w -c -n eth0

to see all activities. If it still can not bring the interface up, the output here will most likely be helpful in troubleshooting.


(note, you will still have to edit ifup and ifdown for the system to work right in the end. the above is for troubleshooting)
Thanks j2, It looks like everything is working fine. I didn't check the commands in your last comment, because I'm doing everything from a remote computer with a telnet client. So bringing down the ethernet card would not be a good idee. That's why I reboot all the time :-).

I'll guess I'll have to believe you If you say that this will solve my problem with the changing ip-addresses.

Just 1 last question : How do I restart my telnet and ftp server whenever i get a new ip-address, or is this not neccessary??
Once you have modified the ifup and ifdown that will be automatic. ASSUMING that the daemons are "aware" of how to listen for such events nicely. I've never had any problem with apache / sshd / proftpd / etc / etc.

actually, if you do a

ifdown eth0 ; ifup eth0

it should work, as the _whole_ string is sent before the first command executes, ive done that remotely and its never failed. Tho, i wouldnt try it until i have seen that it _really_ works to bring the system back up again :)

Another thing you could do (i always do this) is to logon to a screened tty (screen is not installed by default) as this allows you to reconnect to a tty process and continue where you left off.
Thanks a lot. I hope this will help :-)

BTW. I didn't understand the last comment on the tty kind of thing... but then... I don't understand tty at all. What is it all about?
Ok, when you log off you kill all your processes, right? (same thing happens when you kill the eth interface, right?)

screen "keeps all your processes running"... Uhm, like this

1. Log on
2. start 'screen'
[now everything is run trough screen]
3. launch an ftp program
4. disconnect
5. Log back on later
6. screen -r
7. Voila, there is your ftp process still running.

And of cource you can create "new" screens (CTRL-a c) and then switch between them (CTRL-a p & CTRL-a n) and do all sorts of great things.

I use this to "move" all my processes around, since i just disconnect / reconnect to my screen when i am at home / work / firends place. And its especially great if you have a bad line, just because the modem / router goes down, you dont loose what you were doing.

Screen isnt installed by default, but it is available in .rpm format on your CD.
Thanks for the tip j2. Your a great expert.