1819801 Members
3037 Online
109607 Solutions
New Discussion юеВ

configuring a gateway

 
Glenn W. Beatty
Occasional Contributor

configuring a gateway

I need help. Our system administrator is off on business travel and I need to configure the lan0 interface on a HP 700 series workstation running HP-UX 10.20. So far I've used the ifconfig command to set the IP address and subnet mask and I'm able to ping the workstation. I now need to know how to configure the gateway. My knowledge of Unix is limited so please explain in English as best as you can.
6 REPLIES 6
Victor BERRIDGE
Honored Contributor

Re: configuring a gateway

Hi,
What about using the command set_parms?
Usage: set_parms
Where can be:
hostname
timezone
date_time
root_passwd
ip_address
addl_netwrk
font_c-s


All the best

Victor
Victor BERRIDGE
Honored Contributor

Re: configuring a gateway

Otherwise you would have to edit /etc/rc.config.d/netconf and modify the correct fields for lan0

.. and reboot ..

All the best
Victor
Ron Cornwell
Trusted Contributor

Re: configuring a gateway

"route add" is the command you are looking for. Here are some examples.

route add default 10.0.0.1 1
route add net 10.0.0.0 netmask 255.0.0.0 10.0.0.1 1
route add host 10.0.1.2 10.0.0.1 1

These are different commands for adding different types of routes for more information see the man page on route. "man route"
Balaji N
Honored Contributor

Re: configuring a gateway

hi,
ifconfig configuration is temporary and when you reboot your box, the ip address will be gone.

use

set_parms ip_address

and
set_parms addl_netwrk


or use sam.

-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
John Bolene
Honored Contributor

Re: configuring a gateway

Easiest to use SAM for this.
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com
Ron Kinner
Honored Contributor

Re: configuring a gateway

As Ron Cornwall said you can simply add the default gateway with:

route add default A.B.C.D 1
where A.B.C.D is the IP address of the gateway router.

This will work fine until the next reboot.

If you want it to remain after a reboot you need to modify the /etc/rc.config.d.

You do this using vi. I assume you may not know how to use it so will throw in some of the commands. You will need to be root for this to work. You might want to practice a little on another text file just to get the hang of it. (You can exit without changing anything by typing :q!)

vi /etc/rc.config.d

This will bring up the file. Now just hit or j until the cursor moves to the line you need to edit. k will move the cursor up. h left and l right. I don't think it really matters where you put the default route stuff but for safety's sake I always put it right after the comments about the routes. Comments start with #. On an 11.0 system the comments just before where my route statement are:

"# For each additional route, add a set of variable assignments like the ones
# below, changing the index to "[1]", "[2]" et cetera.
#
# IMPORTANT: for 9.x-to-10.0 transition, do not put blank lines between
# the next set of statements"

I like to leave a few spaces then:



ROUTE_DESTINATION[0]="default"
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]="A.B.C.D"
ROUTE_COUNT[0]="1"
ROUTE_ARGS[0]=""

Where A.B.C.D is the gateway's IP address. You need to type an "a" to get into the append mode. Then type what you need and when finished hit the key. If the entry already exists and you need to make a change, position the cursor over the letter and press "r" then the new letter. You can also use "x" to remove one letter. "i" allows you to add text at the insertion point. When finished hit the to leave the insert/append mode then :w! to save the file even tho it is write protected then :q to exit.

While there you might want to check that your ip address and mask setup has been saved correctly. You will need:


LANCONFIG_ARGS[0]="ether"
DHCP_ENABLE[0]=0


somewhere before the default route statement and the following at the end.

GATED=0
GATED_ARGS=""

#
# Router Discover Protocol daemon configuration. See rdpd(1m)
#
# RDPD: Set to 1 to start rdpd daemon
#

RDPD=0


IP_ADDRESS[0]=A.B.C.E
SUBNET_MASK[0]=255.255.255.0
INTERFACE_NAME[0]=lan0
BROADCAST_ADDRESS[0]=A.B.C.255
INTERFACE_STATE[0]=up

Where A.B.C.E is the address of you assigned.



You can view the finished product with
cat /etc/rc.config.d/netconf

inetd -c

will cause it to reread the netconf file.

Ron