Operating System - HP-UX
1745830 Members
4102 Online
108723 Solutions
New Discussion юеВ

Unable to disable the default gateway in HPUX 11.31

 
rohithroki
Frequent Advisor

Unable to disable the default gateway in HPUX 11.31

Dear TEam,

I am trying to isolate one of my server from WAN by disabling the default gateway from the config file in the path.How ever i can still ping my server from differenet network.Blow are the steps i followed

edited /etc/rc.config.d/netcont

Disabled the below line

#ROUTE_GATEWAY[0]="x.x.x.x"

/sbin/init.d net stop

/sbin/init.d net start

How ever when i give the below command i can still find the gateway in the routing table

#netstat -nr

Wierd thing is that even though i stop the net service i am able to ping the ip from different network.Kindly help me in fixing this issue. As its stopping my in proceeding with my activity which needs the server to be isolated from the network.

Regards,

RKJ

6 REPLIES 6
Steven Schweda
Honored Contributor

Re: Unable to disable the default gateway in HPUX 11.31

> [...] i can still find the gateway in the routing table [...]

   Does "route delete [...]" remove it?  Does it reappear after a full
reboot?

rohithroki
Frequent Advisor

Re: Unable to disable the default gateway in HPUX 11.31

i have rebooted the server and tried editing the netconf file and stopped the net service howver still i am facing the same issue

rohithroki
Frequent Advisor

Re: Unable to disable the default gateway in HPUX 11.31

why is that even if i stop the net service i am able to ping the ip from the different VLAN

Steven Schweda
Honored Contributor

Re: Unable to disable the default gateway in HPUX 11.31

> > [...] i can still find the gateway in the routing table [...]
>
> Does "route delete [...]" remove it? [...]

   Still wondering.


> why is that even if i stop the net service i am able to ping the ip
> from the different VLAN

   I don't know.  I can't see what you're doing.  I don't know which
"the ip" address you're testing, or what is in your
"/etc/rc.config.d/netcont" file.

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

   Do you mean commands like the following?:

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

Or did you actually do what you said you did?

   As usual, showing actual commands with their actual output can be
more helpful than vague descriptions or interpretations.  Hiding
important details (such as "x.x.x.x") may be less than helpful, too.

rohithroki
Frequent Advisor

Re: Unable to disable the default gateway in HPUX 11.31

HI,

Yes i was able to delete the default gateway through route delete.

I have edited the netconf file located in the path /sbin/init.d/netconf and commented the below entries

#ROUTE_DESTINATION[0]="default"

  #ROUTE_MASK[0]=""

  #ROUTE_GATEWAY[0]="16.148.240.1"

  #ROUTE_COUNT[0]="1"

  #ROUTE_ARGS[0]=""

  #ROUTE_SOURCE[0]=""

saved the file and executed the below commands

#/sbin/init.d/net stop

#/sbin/init.d/net start

but when i went a printed the command # netstat -nr

i was able to get the below output

         # netstat -rn

         Routing tables

         Destination           Gateway            Flags Refs Interface  Pmtu

         127.0.0.1             127.0.0.1          UH    0    lo0       32808

         16.148.253.170        16.148.253.170     UH    0    lan0      32808

         16.148.248.0          16.148.253.170     U     2    lan0       1500

         127.0.0.0             127.0.0.1          U     0    lo0       32808

         default               16.148.248.1       UG    0    lan0       1500

I am using HP-UX 11.31

Re: Unable to disable the default gateway in HPUX 11.31

(boy it's a long time since I posted on here!)

First point I'd make is there is no such file as /sbin/init.d/netconf - I presume you mean /etc/rc.config.d/netconf ??

Secondly the /sbin/init.d/net command doesn't do anything on "net stop"

Probably because it's a shutdown script and tearing down an IP interafce and routes doesn't really need to happen during shutdown. We could aregue the sense of that all day, but it doesn't do it, so removing that line and running net stop/net start isn't going to remove that route entry. Here's the main code snippet code from /sbin/init.d/net:

##########
#  main  #
##########

case $1 in
   start_msg)
      print "Configure LAN interfaces"
      exit $OKAY
      ;;

   stop_msg)
      print "Unconfigure LAN interfaces"
      exit $OKAY
      ;;

   stop)
      exit $OKAY
      ;;

   start)
      ;;  # fall through

   *)
      print "USAGE: $0 {start_msg | stop_msg | start | stop}" >&2
      exit $ERROR
      ;;
   esac

As you can see, net stop doesn't do anything. And running net start is only going to *add* any routes listed in the /etc/rc.config.d/net config file, not delete any existing ones.

So theere are 2 ways to acheive what you want:

1. Follow Steven's advice and use the route delete command

2. Reboot your system - then it will come back up with an empty route table and the commented out entry in /etc/rc.config.d/netconf won't get added

 


I am an HPE Employee
Accept or Kudo