- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: default gateway chages
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2003 05:53 AM
04-14-2003 05:53 AM
2) clear
echo "Enter the new IP Address"
read new_ip_add
echo "Enter the new Gateway"
read new_gateway
echo "Enter the new Netmask"
read new_netmask
cp /etc/rc.config.d/netconf /tmp/netconf.$dt
cp /etc/hosts /tmp/hosts.$dt
cp /var/adm/inetd.sec /tmp/inetd.sec.$dt
############### Changing netconf ##############################
sed 's/^IP_ADDRESS\[0\]=.*/IP_ADDRESS\[0\]='$new_ip_add'/g' /tmp/netconf
.$dt > /tmp/netconf.tmp
sed 's/^ROUTE_GATEWAY\[0\]=.*/ROUTE_GATEWAY\[0\]='$new_gateway'/g' /tmp/
netconf.tmp > /tmp/netconf.tmp.1
sed 's/^SUBNET_MASK\[0\]=.*/SUBNET_MASK\[0\]=255.255.255.0/g' /tmp/netco
nf.tmp.1 > /etc/rc.config.d/netconf
############## Changing /etc/hosts ##############################
ip=`grep "ISP Ether" /tmp/hosts.$dt | awk '{print $1}'`
sed 's/'$ip'/'$new_ip_add' /g' /tmp/hosts.$dt > /etc/hosts
############## Changing actual addresses ###########################
gw=`netstat -nr | grep default | awk '{print $2}'`
echo gateway is $gw
/etc/route delete net default $gw
/etc/route add net default $new_gateway
/usr/sbin/ifconfig lan0 inet $new_ip_add netmask $new_netmask
;;
Ideas ??? It defaults to the old network for some reason. These machines are still on HPUX 10.20
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2003 05:55 AM
04-14-2003 05:55 AM
Re: default gateway chages
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2003 06:07 AM
04-14-2003 06:07 AM
Re: default gateway chages
I prefer using set_parms or changing in the files(/etc/rc.config.d) it self rather than using script.
which will be permanent after a reboot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2003 06:12 AM
04-14-2003 06:12 AM
Re: default gateway chages
use /sbin/set_parms ip_address and /sbin/set_parms addl_netwrk
Goodluck
-USA..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2003 09:27 AM
04-14-2003 09:27 AM
Solution/etc/route add net default $new_gateway
it should be:
/etc/route add net default $new_gateway 1
Note the "1" which indicates that the default gateway is remote. The command will fail without the 1 since the default gateway's ip address is not local.
You might also want to restart inetd with
inetd -c
This should cause it to reread your netconf file and pick up the changes.
Ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2003 01:19 AM
04-15-2003 01:19 AM
Re: default gateway chages
do not use set_parms
you will need reboot :)
This is very funy ==> unix and reboot :)
If you want ot setup
default gateway for temporaly
usage:
# route add net default
If you want parmanently change or set gateway ==>
edit /etc/rc.config.d/netconf
and it's ENOUGH (but will work after reboot)
ROUTE_DESTINATION[0]="default"
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]=
ROUTE_COUNT[0]=1
ROUTE_ARGS[0]=""
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2003 08:26 AM
04-15-2003 08:26 AM
Re: default gateway chages
Good Luck.
Steve