自機のアドレスを調べるには、ifconfigコマンド を実行します。
# ifconfig eth0 Link encap:Ethernet HWaddr D8:XX:85:XX:76:E4 inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::dad3:XXXX:feaf:76e4/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:142549747 errors:0 dropped:0 overruns:0 frame:0 TX packets:160209316 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:856657764 (816.9 MiB) TX bytes:3617788941 (3.3 GiB) Interrupt:169 Memory:fe9f0000-fea00000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:32487138 errors:0 dropped:0 overruns:0 frame:0 TX packets:32487138 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:2639017666 (2.4 GiB) TX bytes:2639017666 (2.4 GiB)
上記出力から、eth0 に 192.168.1.100 のIPアドレスが割り振られていることが確認できます。
なお、lo の出力部分は、TCP/IPで利用可能な ローカルループバック についての内容となります。
TCPポートを開いているプロセスを確認するには、netstat コマンドでオプションに -tanp を指定します。
# netstat -tanp Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:901 0.0.0.0:* LISTEN 2411/xinetd tcp 0 0 127.0.0.1:199 0.0.0.0:* LISTEN 2374/snmpd tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2647/mysqld tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 2940/smbd tcp 0 0 0.0.0.0:683 0.0.0.0:* LISTEN 2197/rpc.statd tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2157/portmap tcp 0 0 127.0.0.1:54321 0.0.0.0:* LISTEN 3107/avgtcpd tcp 0 0 127.0.0.1:54322 0.0.0.0:* LISTEN 3107/avgtcpd tcp 0 0 0.0.0.0:4949 0.0.0.0:* LISTEN 2794/munin-node tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 2470/vsftpd tcp 0 0 192.168.xx.xxx:53 0.0.0.0:* LISTEN 2129/named tcp 0 0 192.168.xx.xxx:53 0.0.0.0:* LISTEN 2129/named tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 2129/named tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2747/master tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 2129/named tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 2940/smbd tcp 0 0 192.168.xx.xxx:445 192.168.xx.xxx:49159 ESTABLISHED 2423/smbd tcp 0 0 192.168.xx.xxx:445 192.168.xx.xxx:49156 ESTABLISHED 2089/smbd tcp 0 0 192.168.xx.xxx:445 192.168.xx.xxx:49160 ESTABLISHED 4154/smbd tcp 0 0 :::80 :::* LISTEN 12254/httpd tcp 0 0 :::22 :::* LISTEN 2392/sshd tcp 0 0 :::443 :::* LISTEN 12254/httpd tcp 0 0 ::ffff:192.168.xx.xxx:22 ::ffff:192.168.xx.xxx:49401 ESTABLISHED 2810/0 tcp 0 0 ::ffff:192.168.xx.xxx:22 ::ffff:192.168.xx.xxx:65043 ESTABLISHED 11976/1
なお、今回使用した netstatコマンド オプションの詳細を以下に記載します。
◆netstatコマンド オプション一覧-a 全てのソケットを表示する。 -n ホスト名などを解決せずに数字で表示する。 -p 各ソケットを利用しているプログラムのプロセスIDを表示する。 -t | -u | -w TCP(「-t」)、UDP(「-u」)、そのほかIPとICMP(「-w」)のみ表示する。
ルーティング情報を表示するには、route コマンドのオプション -n を使用します。
-n は、出力をIPアドレスのみに抑制するオプションとなります。
# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 133.xxx.xxx.xxx 0.0.0.0 255.255.255.xxx U 0 0 0 eth0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 169.xxx.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth1 169.xxx.0.0 0.0.0.0 255.255.0.0 U 1003 0 0 eth0 0.0.0.0 133.242.125.xxx 0.0.0.0 UG 0 0 0 eth0
自機のNICを指定し、pingを実行するには、ping コマンドのオプション -I を使用します。
# ping -I eth1 192.168.0.x PING 192.168.0.x (192.168.0.x) from 192.168.0.x eth1: 56(84) bytes of data. 64 bytes from 192.168.0.x: icmp_seq=1 ttl=64 time=0.476 ms 64 bytes from 192.168.0.x: icmp_seq=2 ttl=64 time=0.459 ms
ARPキャッシュを確認するには、ip コマンドの neigh show オプションを使用します。
# ip neigh show 192.168.xx.xxx dev eth0 lladdr 00:26:2d:49:b4:xx STALE 192.168.xx.xxx dev eth0 lladdr 00:09:41:c4:17:xx REACHABLE 192.168.xx.xxx dev eth0 lladdr 00:26:2d:49:b6:xx DELAY 192.168.xx.xxx dev eth0 lladdr 00:23:df:a7:25:xx STALE 192.168.xx.xxx dev eth0 lladdr 00:26:2d:49:b5:xx REACHABLE 192.168.xx.xxx dev eth0 lladdr 00:1f:e2:66:40:xx STALE 192.168.xx.xxx dev eth0 lladdr 50:e5:49:ce:4f:xx STALE
設定しているリンクのUP/DOWNを確認するには、ip コマンドの link show オプションを使用します。
# ip link show 1: lo:mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: mtu 1500 qdisc pfifo_fast qlen 1000 link/ether d8:d3:85:af:xx:xx brd ff:ff:ff:ff:ff:ff 3: sit0: mtu 1480 qdisc noop link/sit 0.0.0.0 brd 0.0.0.0
スポンサーリンク