How do I start hpux network service?

Use following command to start HP-UX network service:

/etc/init.d/net start
OR
/sbin/init.d/net start
Please note that your network configuration file is /etc/rc.config.d/netconf . Here is my sample /etc/rc.config.d/netconf file:

# cat /etc/rc.config.d/netconf
Output:
HOSTNAME=deephpux < --change hostname here OPERATING_SYSTEM=HP-UX LOOPBACK_ADDRESS=127.0.0.1 INTERFACE_NAME[0]=lan0 IP_ADDRESS[0]=192.168.1.100 <--change IP address here SUBNET_MASK[0]=255.255.255.0 <--change subnet mask here BROADCAST_ADDRESS[0]="" DHCP_ENABLE[0]="0" <--Do you wanna DHCP? set 1 to use DHCP

You can also set IP address using ifconfig command:
# ifconfig lan0 192.168.1.200 netmask 255.255.255.0 up

See or get current IP address information with ifconfig command:
# ifconfig lan0

For more information see the summery of HP-UX networking related tools and commands.

Removing Unwanted Startup Debian Files or Services

Under Debian Linux ( and most other distros) startup files are stored in /etc/init.d/ directory and symbolic linked between /etc/rcX.d/ directory exists. Debian Linux (Red Hat/ Fedora) uses System V initialization scripts to start services at boot time from /etc/rcX.d/ directory. Debian Linux comes with different utilities to remove unwanted startup file:

(A) rcconf
It is a console based interactive utility that allows you to control which services are started when the system boots up or reboots. It displays a menu of all the services which could be started at boot. The ones that are configured to do so are marked and you can toggle individual services on and off. To start rconf, login as root user and type rcconf
# rcconf


Debian rcconf – a console based utility to control startup services

Select the service you would like to enable or disable.

(B) sysv-rc-conf is yet another tool for for SysV like init script links under Debian Linux. To start sysv-rc-conf, login as root user and type sysv-rc-conf:
# sysv-rc-conf


Debian sysv-rc-conf – a console based advanced utility to control startup services

Select the service you would like to enable or disable.

Both sysv-rc-conf and rcconf are best tools to use on Remote Debian Linux or when GUI is not available, they are just like ntsysv command under Red Hat Linux.

(C) You can also use update-rc.d script as follows (update-rc.d removes any links in the /etc/rcX.d directories to the script /etc/init.d/service):
# update-rc.d -f {SERVICE-NAME} remove

For example to stop xinetd service at boot time, type the command as follows:
# update-rc.d -f xinetd remove

/etc/resolve.conf or resolv.conf File Example

The resolv.conf file is the resolver configuration file. It is use to configure client side access to the Internet Domain Name System (DNS). This file defines which name servers to use.

The resolver is a set of routines in the C library that provide access to the Internet Domain Name System (DNS). The resolver configuration file contains information that is read by the resolver routines the first time they are invoked by a process. The file is designed to be human readable and contains a list of keywords with values that provide various types of resolver information

Note: File name is /etc/resolv.conf and not /etc/resolve.conf.

Sample resolv.conf file

Following is an example of resolv.conf file:

search cyberciti.biz
nameserver 202.54.1.10
nameserver 202.54.1.11

Where,

  • search domain.com: The search list is normally determined from the local domain name; by default, it contains only the local domain name. So when you type nslookup www, it will be matched to www.cyberciti.biz
  • nameserver Name-server-IP-address: Point out to your your own nameserver or to ISP’s name server. Up to 3 name servers may be listed.

But how do I edit the /etc/resolv.conf file?

Use text editor such as vi or gedit from Linux desktop:
# vi /etc/resolv.conf

Default /etc/resolv.conf file

Following file should be work with any ISP in the world :)
# cat /etc/resolv.conf
Output:

For more information see How to Setup Linux as DNS client.

Linux Testing your network connection

1) First try pining your own IP address to see if your IP address is set properly, syntax is:
ping IP-ADDRESS

If your IP address is 202.54.1.10 then try:
# ping 202.54.1.10

Tip use ifconfig command to see IP address for eth0 or any other interface.

2) Try pinging neighboring machines IP addresses:
# ping 192.168.1.2
# ping 202.54.1.12

If you need to setup/configure network or connecting to the network under Linux use following tools:
Under Red Hat use neat OR system-config-network (Fedora core) command
Uder Debian Linux use network-admin command.

You can also start above command from GUI. Using above GUI tools you should able to configure DNS, hosts, IP address etc. For more information see:
List of LINUX troubleshooting commands/tools part # 1

How do I print or make hard copies of Linux man and info pages?

Very simple, here is the command to convert man page of ls command to text file:

man ls | col -b > ls.txt

Then use lpr print command to print ls.txt file i.e. it sends a print job to the default system queue/printer connected to Linux/UNIX:
cat ls.txt | lpr
OR
lpr ls.txt

You can also try:
man ls | col -b | lpr

You can also print GNU Linux info pages:

info ls | col -b| lpr

Please note col command filter reverse line feeds from input i.e it removes \r \n like character.

How do I force linux to change (forcefully) user password?

passwd command changes passwords for user accounts. A normal user may only change the password for his/her own account, while the super user may change the password for any account. passwd also changes account information, such as the full name of the user, the user’s login shell, or his/her password expiry date and interval.

If you wish to immediately expire an account’s password, you can pass the -e option to passwd command. This in effect can force a user to change his/her password at the user’s next login.

Let us assume user name is raj, then login as root user and type following command:

# passwd -e raj

Next time when raj tries to login
server login:raj
Password:
You are required to change your password immediately (root enforced)
Changing password for raj
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
Linux debian 2.6.13 #2 Sun Oct 2 20:07:57 IST 2005 i686 GNU/Linux

Last login: Thu Oct 6 01:24:15 2005

How do I restart Linux network service?

RedHat Linux command to reload or restart network (login as root user):

# service network restart
OR
# /etc/init.d/network restart

To start Linux network service:
# service network start

To stop Linux network service:
# service network stop

Debian Linux command to reload or restart network:
# /etc/init.d/networking restart

To start Linux network service:
# /etc/init.d/networking start

To stop Linux network service:
# /etc/init.d/networking stop

Ubuntu Linux user use sudo command with above Debian Linux command:
# sudo /etc/init.d/networking restart

To start Linux network service:
# sudo /etc/init.d/networking start

To stop Linux network service:
# sudo /etc/init.d/networking stop

How do I restart inetd service under Linux?

inetd is a daemon on Linux (BSD/Unix) systems that manages Internet services. inetd listens on all ports used by internet services such as FTP, POP3, and telnet. When a TCP packet or UDP packet comes in with a particular port number, inetd launches the appropriate server program to handle the connection. This uses memory more efficiently, as the other daemons do not run constantly.

Under old version of RedHat Linux you can restart inetd (login as root user):
# killall -HUP inetd

Note above command should work with almost any Linux distrobution.

New version of RedHat Linux (Fedora) comes with xinetd daemon, which can be restarted as follows:
# service xinetd restart

See also:

=> How to restart inetd under FreeBSD

Resetting RX and TX counters

You need to remove driver related to Ethernet card. Under Linux use following commands:

1) Find out driver attached to eth0 using following command
lsmod | less

2) Remove the driver using rmmod command:
rmmod driver-name

3) Again insert driver into kernel using
modprobe driver-name

For example, let us assume your driver name is 8139too , then your command should be (log in as root user):
# rmmod 8139too
# modprobe 8139too

Verify that RX and TX couters reset:
ifconfig

Under FreeBSD use following the commands:

Get list of loaded drivers, and find out ID of device driver related to Ethernet
# kldstat

Remove driver
# kldunload driver-ID

Load driver into kernel:
# kldload -v driver-name

Don’t try this command on remote server via telnet or ssh, at it will take down your connection. For more information please see
FreeBSD : How to unload (remove) device driver (module) from kernel
FreeBSD How to list device drivers (modules) loaded in memory?
FreeBSD : How to unload (remove) device driver (module) from kernel