Operating System - HP-UX
1833276 Members
3140 Online
110051 Solutions
New Discussion

Re: Changing dafault gateway and IP with command.

 
SOLVED
Go to solution
nck2pg2
Advisor

Changing dafault gateway and IP with command.

One old machine 9000/780 running HP-UX 9.07.
I want to change the default gateway, IP address and subnet mask as well by using command. Please advise.

Please note that my SAM is having some problem and need to be reinstalled (I can say forget this way).
9 REPLIES 9
Armin Feller
Honored Contributor

Re: Changing dafault gateway and IP with command.

Hi,

to change IP address and/or default gateway, please use the command:

# set_parms initial

Regards,
Armin
BFA6
Respected Contributor

Re: Changing dafault gateway and IP with command.

Hi

set_parms ip_address will change the ip address, have a look at the man page for other options.

Regards,

Hilary
Armin Feller
Honored Contributor

Re: Changing dafault gateway and IP with command.

Hi,

to change the default gateway you have to do following:

# vi /etc/rc.config.d/netconf
---> and edit the default gateway

# /sbin/init.d/net stop
# /sbin/init.d/net start

Best regards,
Armin
Marek Bednarczyk
Occasional Advisor
Solution

Re: Changing dafault gateway and IP with command.

Unfortunately I can not confirm that the following commands would work on your version of hpux (see man pages for details).

To add/delete default gateway:
route add default DEFAULT_GATEWAY_IP_ADDRESS
route delete default DEFAULT_GATEWAY_IP_ADDRESS

To change IP address/netmask:
First check the name of the interface for which you want to change the address:
netstat -in
To change the IP address for interface lan0:
ifconfig lan0 IP_ADDRESS up netmask NETMASK

Hope it would work.

Marek
Ravi_8
Honored Contributor

Re: Changing dafault gateway and IP with command.


Hi,

HP doesn't supporting 9.07 , if get into any kind of problem, so using the command line is the better way.

#set_parms initial

will do your job
never give up
eran maor
Honored Contributor

Re: Changing dafault gateway and IP with command.

Hi

you can also change the /etc/rc.config.d/netconf the params
of the ip adress and the getway .

you will need to reboot the system or to do it from the console .

exam:
INTERFACE_NAME[0]=lan0
IP_ADDRESS[0]=15.18.12.37
SUBNET_MASK[0]=255.255.248.0
BROADCAST_ADDRESS[0]=""
INTERFACE_STATE[0]=""
DHCP_ENABLE[0]=0

ROUTE_DESTINATION[0]=default
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]=15.18.12.1
ROUTE_COUNT[0]=1
ROUTE_ARGS[0]=""
love computers
nck2pg2
Advisor

Re: Changing dafault gateway and IP with command.

Thank you.
I can't find /etc/rc.config.d/netconf in 9.07 but there is in 10.20
I get it done through Marek advise.
route add default ......
ifconfig lan0 .....



Adam J Markiewicz
Trusted Contributor

Re: Changing dafault gateway and IP with command.

Ok, but please remember that with this commands you've changed only CURRENT setting. This will work untill the next booting.

Good luck

Adam
I do everything perfectly, except from my mistakes
Armin Feller
Honored Contributor

Re: Changing dafault gateway and IP with command.

Please edit /etc/netlinkrc to keep the informations about gateway also after a reboot.

Regards,
Armin