Operating System - Tru64 Unix
1832351 Members
2218 Online
110041 Solutions
New Discussion

Change IP without restarting services

 
SOLVED
Go to solution
Joaquin Martinez_1
Frequent Advisor

Change IP without restarting services

Hi. Here's the situation:
I have been given an assigment where I need to change the IP of one of the interfaces in our most important server here. The problem is, that this server is used frequently by our ATM network (we are a bank institution). I know I can do this with 'sysman net_wizard', but it ask me at the end whether or not I want to restart the net services in order for my new interfaces be up properly. I believe that if I say yes, it will restart every net services on the equipment, including the interface where our atm network is. Is there anyway I can restart the services only for the new configured NIC instead of all of them ?

Thanks!
10 REPLIES 10
Ivan Ferreira
Honored Contributor

Re: Change IP without restarting services

You could manually modify the /etc/rc.config file to change the ip address of your server's adapter, then the changes will take effect at next reboot. Then you can use the ifconfig command to modify the running ip address:

ifconfig down
ifconfig delete
ifconfig up
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Michael Schulte zur Sur
Honored Contributor

Re: Change IP without restarting services

Hi,

look man ifconfig

greetings,

Michael
Joaquin Martinez_1
Frequent Advisor

Re: Change IP without restarting services

Hi. I tried your suggestion with ifconfig down/up. But the interface is not changing, I already made the changes in rc.config. See below.

# ifconfig -a
ee0: flags=c63
inet 192.168.0.4 netmask ffffff00 broadcast 192.168.0.255 ipmtu 1500
inet 192.168.0.26 netmask ffffff00 broadcast 192.168.0.255 ipmtu 1500

ee1: flags=c63

lo0: flags=100c89
inet 127.0.0.1 netmask ff000000 ipmtu 4096

sl0: flags=10

tun0: flags=80

tun1: flags=80

# ifconfig ee1 down
# ifconfig ee1 up
# ifconfig -a
ee0: flags=c63
inet 192.168.0.4 netmask ffffff00 broadcast 192.168.0.255 ipmtu 1500
inet 192.168.0.26 netmask ffffff00 broadcast 192.168.0.255 ipmtu 1500

ee1: flags=c63

lo0: flags=100c89
inet 127.0.0.1 netmask ff000000 ipmtu 4096

sl0: flags=10

tun0: flags=80

tun1: flags=80

#

See, it stays up no matter if I tell it to shutdown.
Ivan Ferreira
Honored Contributor

Re: Change IP without restarting services

Use the ifconfig command as described in my last post. You need to remove the old ip address (ifconfig remove) and add the new ip address (ifconfig ip_addr). Is not just a down and up.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Joaquin Martinez_1
Frequent Advisor

Re: Change IP without restarting services

Thanks David. I have another question:
I added my ip and a new gateway for this ip on the /etc/routes file as default. It then had two default gateways. My question is: If I try to send a package outside of my network, which gateway should it use ? the one that correspond to the same class of the interface i'm using or just one aleatory ?
Joaquin Martinez_1
Frequent Advisor

Re: Change IP without restarting services

I tried using traceroute to see how the packets are being transfered, but nowhere I see any of my gateways being used.
Ivan Ferreira
Honored Contributor
Solution

Re: Change IP without restarting services

You should use only one default gateway, verify the current default gateway with netstat -nr:

netstat -nr
Routing tables
Destination Gateway Flags Refs Use Interface

default 1.2.3.4 UGS 0 12287 nr1

The /etc/routes is used at network start time. If you want to change your default gateway, you must remove your current gateway and add the new one:

route delete default
route add default
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Michael Schulte zur Sur
Honored Contributor

Re: Change IP without restarting services

Hi,

# ifconfig ee1 down
# ifconfig ee1 up
# ifconfig -a

why should the device show as down if you start it up again before you do the show?
There can only be one default gateway. The default gateway is tp be used in the absence of any other routing informations. As Ivan showed the route is the right command to use.
Read route man pages.
It goes like
route [-nqvC] add [-net | -host] [family] destination[/bitmask] gateway [-link] [modifiers[args]]

Michael
Joaquin Martinez_1
Frequent Advisor

Re: Change IP without restarting services

Thanks all for your help. I have solved the problem.
Al Licause
Trusted Contributor

Re: Change IP without restarting services

RE: multiple default routes.....actually there has been support for this since v4.0f of Tru64unix. Though trying to make sense of it is a difficult mental exercise.

RE: ifconfig down/up after rc.config changes.
You need to understand that rc.config is only read when the various startup/shutdown scripts run. They usually run the ifconfig utility to do the actual configuration.

RE: rcinet restart......very drastic and often not necessary. It does attempt to stop and restart "all" network services that have been started in run state 3.