From: linuxlover992000 on
I have a Fedora Core 4 server which usually is assigned the IP address
of 192.168.0.160.

I would like to be able to changed it *temporarily* (i.e. for a special
session until I restore it manually) to 192.168.0.31.

At the command line, as root, I type:

ifconfig eth0 192.168.0.31

The IP address indeed changes as expected, but for some strange reason
it no longer has connection to the internet via the router
(192.168.0.1). When I try to ping some known Internet host, it says:

"connect: Network is unreachable"

(it disn't say so before executing the "ifconfig eth0" command).

Now the interesting thing is that if I type "ifconfig eth0
192.168.0.160", to (supposedly) restore it to its original state, is
remains in the problematic state of "connect: Network is unreachable"
(until I reboot).

It appears that there is something else that needs to be re-configured
along with the IP address (which is on the same subnet), in order for
this "innocent change" to work. But what is it?

Do I really have to shutdown the interface entirely ("ifconfig eth0
down") before changing the IP address?

I am interested in changing the IP address *without rebooting* the
server.

Thanks!
Lynn

From: slackware guy on

linuxlover992000(a)yahoo.com wrote:
> I have a Fedora Core 4 server which usually is assigned the IP address
> of 192.168.0.160.
>
> I would like to be able to changed it *temporarily* (i.e. for a special
> session until I restore it manually) to 192.168.0.31.
>
> At the command line, as root, I type:
>
> ifconfig eth0 192.168.0.31
>
> The IP address indeed changes as expected, but for some strange reason
> it no longer has connection to the internet via the router
> (192.168.0.1). When I try to ping some known Internet host, it says:
>
> "connect: Network is unreachable"
>
> (it disn't say so before executing the "ifconfig eth0" command).
>
> Now the interesting thing is that if I type "ifconfig eth0
> 192.168.0.160", to (supposedly) restore it to its original state, is
> remains in the problematic state of "connect: Network is unreachable"
> (until I reboot).
>
> It appears that there is something else that needs to be re-configured
> along with the IP address (which is on the same subnet), in order for
> this "innocent change" to work. But what is it?
>
> Do I really have to shutdown the interface entirely ("ifconfig eth0
> down") before changing the IP address?
>
> I am interested in changing the IP address *without rebooting* the
> server.
>
> Thanks!
> Lynn

Red Hat EL (and I assume fedora) has scripts for handling the interface
confguration under
/etc/sysconfig/network-scripts.

The normal practice is to down the interface before making
configuration changes. I haven't
tried reconfiguring an active interface myself but I would prefer (if
not using the scripts) 'ifconfig eth0 down' then make the change then
'ifconfig eth0 up'.

Dean

From: linuxlover992000 on
slackware guy wrote:
>
> Red Hat EL (and I assume fedora) has scripts for handling the interface
> confguration under
> /etc/sysconfig/network-scripts.
>
> The normal practice is to down the interface before making
> configuration changes. I haven't
> tried reconfiguring an active interface myself but I would prefer (if
> not using the scripts) 'ifconfig eth0 down' then make the change then
> 'ifconfig eth0 up'.
>

Dean, thanks for your quick reply. What I forgot to mention was that I
am doing this remotely (i.e. via telnet), so the operation has to be
"atomic". That is, by the end of the execution of the command, I have
to be able to access the server again, albeit via a new telnet session
(to the new IP address).

I actually tried just that. I typed in one line:

~> ifconfig eth0 down; ifconfig eth0 192.168.0.31; ifconfig eth0 up

and indeed I was able to telnet again - but the problem I described in
my original posting still persists!

I knew about about RedHat's network-scrips (some of these files are not
really scripts, just plain configuration data such as ifcfg-eth0), but
I thought these are more appropriate for permanent changes.

Any idea how I can *dynamically* (i.e. without needing to reboot and
without needing to use an interactive tool) change the IP address
(within the same subnet - everything else remains the same, including
gateway and DNS) in Fedora?

Please notice that the problem exists only in regard to connecting to
the Internet. Connection within LAN remains OK in any of the ways I
described so far.

In the meanwhile I will continue to explore...

Thanks!
Lynn

From: Philipp Pagel on
linuxlover992000(a)yahoo.com wrote:
> At the command line, as root, I type:

> ifconfig eth0 192.168.0.31

> The IP address indeed changes as expected, but for some strange reason
> it no longer has connection to the internet via the router
> (192.168.0.1). When I try to ping some known Internet host, it says:

> "connect: Network is unreachable"

Your routing is messed up. Have a look at the output of

route -n

before and after your IP change.

cu
Philipp

--
Dr. Philipp Pagel Tel. +49-8161-71 2131
Dept. of Genome Oriented Bioinformatics Fax. +49-8161-71 2186
Technical University of Munich
http://mips.gsf.de/staff/pagel
From: Paul Black on
linuxlover992000(a)yahoo.com wrote:
> It appears that there is something else that needs to be re-configured
> along with the IP address (which is on the same subnet), in order for
> this "innocent change" to work. But what is it?

The default route.


--
Paul