Your Ad Here

IBM AIX/UNIX system storage administration ksh/perl scripting

Showing posts with label TCPIP. Show all posts
Showing posts with label TCPIP. Show all posts

Friday, March 20, 2009

Using netstat and rmsock to Identify Processes Using the Default Gateway

Question

Is there a way to use netstat to find processes that are heavily using the default gateway?

Answer

You can use netstat and rmsock in combination to help find processes that are actively using the default gateway.

If path MTU discover is not enabled then temporarily enable it so you can get more information when using netstat. These are commands to enable the path MTU discover:

no -o tcp_pmtu_discover=1
no -o udp_pmtu_discover=1

The next step involves running netstat -rn and looking for the highest use count on the cloned route entries (those with a W flag - reference example 1).

Example 1

$ netstat -rn | grep -E "Use|UGHW"
Destination Gateway Flags Refs Use If PMTU Exp
Groups
9.0.7.1 9.41.166.1 UGHW 1 7 en2 - -
9.12.136.110 9.41.166.1 UGHW 2 123 en2 - -
9.17.183.166 9.41.166.1 UGHW 1 5 en2 1500 -
9.41.167.106 9.41.166.1 UGHW 1 3 en2 - -
9.41.167.182 9.41.166.1 UGHW 1 3373 en2 1500 -

In example 1 above, the destination address 9.41.167.182 has the highest use count (3373).

Next, check for any active sockets related to IP address 9.41.167.182 using the netstat -Aan command (see example 2):

Example 2

$ netstat -Aan | grep 9.41.167.182
705b21e4 tcp4 0 0 9.41.166.74.139 9.41.167.182.1039 ESTABLISHED

Use the process control block address (705b21e4) from the netstat -Aan output in example 2 with the rmsock command to find a process ID associated with the socket.

Example 3

# rmsock 705b21e4 tcpcb
The socket 0x705b2000 is being held by proccess 9394 (smbd).

With the help of netstat and rmsock in the preceding three examples, you were able to find a specific smbd process that had the most activity relative to sending data over the default gateway.

Wednesday, March 18, 2009

Adding New telnet Service to Different Port


Adding New telnet Service to Different Port

Technote (FAQ)
Problem

Client would like to add new telnetd with different port.
Solution

Environment

AIX Version 5.x
  1. Using your preferred editor, edit the file /etc/inetd.conf by adding the following:
    telnet80  stream  tcp6    nowait  root    /usr/sbin/telnetd      telnetd
    Note: Port number 80 is being used in this example.
  2. Using your preferred editor, edit the file /etc/services by adding the following:
    telnet80        80/tcp
  3. Now run the following command:
         refresh -s inetd

Historical Number
isg1pTechnote1404

Monday, March 16, 2009

AIX using chdev to add/change/remove routing

# route delete default <IP>
# lsattr -El inet0 -a route
# chdev -l inet0 -a delroute="net,,0,<IP that is listed above>"
# chdev -l inet0 -a route="net,,0,<IP that it should be>"
# lsattr -El inet0 -a route
# netstat -nr


After updating the routing, you need to use mkdev to refresh it.


# mkdev -l inet0

Why you should NOT put two interfaces in same subnet

There are couple of reasons as an AIX system administrator you should NOT configure IP addresses that are in the same subnet in different interfaces.


1.Having two interfaces on the same network is a violation of TCP/IP
architecture.
.
In TCP/IP architecture, a host machine with two network adapters is
defined as an IP router. Differentnetwork adapters must be attached
to different physical networks. In the case of token-ring, TCP/IP
addresses multiple rings bridged together as a single logical ring
(as if it were a single physical ring).

2.Having two interfaces on the same network can cause broadcast storms.

Whenever an IP host sees traffic for a network whose IP address is diffe
rent from its own network, it generates an Internet Control Message
Protocol (ICMP) packet announcing this conflict. Since every host
on the network sees the traffic that is misaddressed, every host
generates ICMP Packets. If the amount of misaddressed traffic is signif
the ICMP traffic can grow to the point that network performance degrades



3 Having two interfaces on the same network can cause routing confusion.

If system has two interfaces on same subnet, inbound traffic will
from either interface, but for outbound traffic you need to set up
specific routes to use both otherwiese system will use one of them.

How to do a iptrace

# startsrc -s iptrace -a " -a -d remote_host -b /tmp/iptrace.out"
... Recreate the problem
# stopsrc -s iptrace

..Generate report from the trace file.
# ipreport /tmp/iptrace.out > /tmp/iptrace.report.file

Labels

BlogCatalog