1833873 Members
2504 Online
110063 Solutions
New Discussion

Re: adding gateway

 
Mike_108
Advisor

adding gateway

i got problem with my gateway setting. after reboot my server, the default gateway for this server become "default gateway not set"

i try to add this gateway manually using "route add net 192.168 192.168.1.251" but when i view back using "netstat -rn" there is no gateway defined reported...

11 REPLIES 11
Wilfred Chau_1
Respected Contributor

Re: adding gateway

You can set the default gateway in the /etc/rc.config.d/netconf file.

Then /sbin/init.d/net start, next netstat -rn
should show your gateway.
T G Manikandan
Honored Contributor

Re: adding gateway

Hello,
If it is the default gateway
route add net default 1
else

route add 192.168.0.0 1

The last parameter '1' tells whether the gateway is a remote host or a local host.If it is the local host use 0 instead of 1.If the gateway is a remote host then give 1.
If you want to make permanent entries then
edit your /etc/rc.config.d/netconf file .
Sanjay_6
Honored Contributor

Re: adding gateway

Hi,

you can add the gateway manually by adding the /etc/rc.config.d/netconf file or you can add this through sam. If you want to add this through sam, do this

sam --> Networking and communication --> Local hosts file --> TAB and select action --> Configure default gateway

Hope this helps.

Regds
Darrell Allen
Honored Contributor

Re: adding gateway

Hi,

Routes added "on the fly" with the route command are not saved when rebooting. You have to set them every time you boot. The preferred method in HPUX is to edit /etc/rc.config.d/netconf with a stanza similar to this:
ROUTE_DESTINATION[0]="net 192.168.0.0"
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]=192.168.1.251
ROUTE_COUNT[0]=1
ROUTE_ARGS[0]=""

If 192.168.1.251 is the IP address for the NIC on the HPUX box itself, change "ROUTE_COUNT[0]=1" to "ROUTE_COUNT[0]=0".

If you want to add a default route use a stanza like:
ROUTE_DESTINATION[1]=default
ROUTE_MASK[1]=""
ROUTE_GATEWAY[1]=xx.xx.xx.xx
ROUTE_COUNT[1]=1
ROUTE_ARGS[1]=""

Substitute your gateway's IP address for xx.xx.xx.xx.

If adding multiple stanzas, be sure the instance number inside the [] symbols are unique for each stanze.

I suggest you try adding the routes in SAM then look at /etc/rc.config.d/netconf to see what it did.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Mike_108
Advisor

Re: adding gateway

after done all the changes in the "/etc/rc.netconfig.d/netconf" file, should i reboot the server or not.
one thing, after i did all the changes, i tried "route add -net 192.168 192.168.1.251" then when i view the the configuration "netstat -rn" still cannot get the default gateway for this server.i also run "/sbin/init.d/net start" then "netstat -rn", still the same,
what should i do?

server info:
IP No. : 192.168.1.2
Gateway : 192.168.1.251
Darrell Allen
Honored Contributor

Re: adding gateway

You may be okay just to run "/sbin/init.d/net start" but the most complete test is to reboot.

Are you subnetting? If you are using the default class C subnet mask, your netconf should have the following (at a minimum):

INTERFACE_NAME[0]=lan0
IP_ADDRESS[0]=192.168.1.2
SUBNET_MASK[0]=""
BROADCAST_ADDRESS[0]=""
INTERFACE_STATE[0]=""
DHCP_ENABLE[0]=0

ROUTE_DESTINATION[0]=default
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]=192.168.1.251
ROUTE_COUNT[0]=1
ROUTE_ARGS[0]=""

To add the default route "on the fly" do:
route add default 192.168.1.251 1

If you are still having problems, please post the output of the following:
netstat -rn
lanscan
netstat -ni

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Sanjay_6
Honored Contributor

Re: adding gateway

Hi,

If you can reboot the system after doing the changes, it would be good.

Hope this helps.

Regds
MANOJ SRIVASTAVA
Honored Contributor

Re: adding gateway

Hi Noor


There are many ways to go about it. First check by netstat -nr command and if there is any default gateway delete it by route delete command.

The ping the gateway you should be able to receive reply back.

Adding can be done wither by

route add default No. of hops

and add entry to the /etc/rc.config.d/netconf file and stop and start the net by /sbin/init.d/net stop < start>

or go the SAM way.


Manoj Srivastava
Mike_108
Advisor

Re: adding gateway

Hi all,
I already reboot the server, but still cannot get that default server when I run "netstat -rn"

the output of netstat -rn :
s01amy02 #>netstat -rn
Routing tables
Dest/Netmask Gateway Flags Refs Use Interface Pmtu
127.0.0.1 127.0.0.1 UH 0 2815 lo0 4136
192.168.1.2 192.168.1.2 UH 0 925877 lan0 4136
192.168.1.0 192.168.1.2 U 2 0 lan0 1500
127.0.0.0 127.0.0.1 U 0 0 lo0 4136

output of lanscan :

s01amy02 #>lanscan
Hardware Station Crd Hdw Net-Interface NM MAC HP-DLPI DLPI
Path Address In# State NamePPA ID Type Support Mjr#
0/0/0/0 0x001083FAF51B 0 UP lan0 snap0 1 ETHER Yes 119

output of netstat -ni :
s01amy02 #>netstat -ni
Name Mtu Network Address Ipkts Opkts
lan0 1500 192.168.1.0 192.168.1.2 1029667 1029541
lo0 4136 127.0.0.0 127.0.0.1 2815 2815

fyi, there is nothing to do with the IP class, because this server & gateway is in same LAN (not connected to outside/internet).
One thing, before this, the server is working fine,
the only problem is, because this server is in VLAN 1(gateway : 192.168.1.251), but workstations is in VLAN 2(gateway : 192.168.2.251), so, which ever PC in VLAN 2 can't connect to this server.
There is also another 2 servers in the same VLAN, with same configuration in netconf file as this server, with IP : 192.168.1.1 & 192.168.1.3, both is working fine.
attach is netconf files for those server.
Darrell Allen
Honored Contributor

Re: adding gateway

Hi again,

Can 192.168.1.2 communicate with 192.168.1.251? Is "ping 192.168.1.251" successful?

Please post the output from:
ifconfig lan0
route add default 192.168.1.251 1

Back to your original post...
"route add net 192.168 192.168.1.251" is an invalid route command for your system. Your network is 192.168.1.0 (vlan1). The other network is 192.168.2.0. If you want to add a route just to 192.168.2.0 use:
route add net 192.168.2.0 192.168.1.251 1

Perhaps you should attach your netconf file.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Mike_108
Advisor

Re: adding gateway

Hi,

I can ping this gateway(192.168.1.251),
reply seccussfully.

"route add net 192.168.2.0 192.168.1.251 1" I already tried, still cannot view the default gateway when i run "netstat -rn"

attach is ifconfig lan0 output for 192.168.1.2
and also netconf for :

192.168.1.2 (problem)

192.168.1.1 (working fine)

192.168.1.3 (working fine)

hope this info. can help me to solve the problem.