CentOS 6.x ネットワーク管理
自分のIPアドレスを確認する - ifconfig
自分のIPアドレスを確認するには、ifconfigコマンドを使用します。NICごとに情報が表示されます。
# ifconfig eth0 Link encap:Ethernet HWaddr 9C:A3:BA:01:B2:AF inet addr:153.126.xxx.xx Bcast:153.126.xxx.xxx Mask:255.255.254.0 inet6 addr: 2401:2500:102:3002:153:126:xxx:xx/64 Scope:Global inet6 addr: fe80::9ea3:baff:xxxx:b2af/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:80956512 errors:0 dropped:0 overruns:0 frame:0 TX packets:5668260 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:6022291612 (5.6 GiB) TX bytes:5140371502 (4.7 GiB) 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:65536 Metric:1 RX packets:2975 errors:0 dropped:0 overruns:0 frame:0 TX packets:2975 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:317728 (310.2 KiB) TX bytes:317728 (310.2 KiB)
リッスンしているTCPのポートを確認する
リッスンしている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:3306 0.0.0.0:* LISTEN 3410/mysqld tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 31639/vsftpd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1391/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1241/master tcp 0 96 153.126.xxx.xx:xx 106.188.xxx.xxx:xxx ESTABLISHED 30987/sshd tcp 0 0 153.126.xxx.xx:xx 106.188.xxx.xxx:xxx ESTABLISHED 30574/sshd tcp 0 0 :::80 :::* LISTEN 30636/httpd tcp 0 0 :::22 :::* LISTEN 1391/sshd tcp 0 0 ::1:25 :::* LISTEN 1241/master
ルーティング情報を表示する
ルーティング情報を表示するには、route コマンドを使用します。
オプション -n を使用すると、出力をIPアドレスのみに抑制することができます。
# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 153.126.xxx.0 0.0.0.0 255.255.xxx.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0 0.0.0.0 153.126.xxx.1 0.0.0.0 UG 0 0 0 eth0
NICごとにリンクのUP/DOWNを確認する
NICごとにリンクのUP/DOWNを確認するには、ip コマンドの link show オプションを使用します。
# ip link show 1: lo:mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 9c:a3:ba:01:b2:af brd ff:ff:ff:ff:ff:ff 3: eth1: mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 9c:a3:ba:03:39:4f brd ff:ff:ff:ff:ff:ff 4: eth2: mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 9c:a3:ba:04:bf:ef brd ff:ff:ff:ff:ff:ff
------------------------------
作成日:2016年06月13日
更新日:2016年06月13日
------------------------------