やりたい事とか ・RAID ・LPIC-201 ・自転車を買う(買っちゃった~) ・サイト作成

2009年8月6日木曜日

tracepath

trancepath
 …traces path to a network host discovering MTU along this path
  →経路上からMTUを調べるのに使用するのかしら。




# tracepath google.com
1: 192.168.1.10 (192.168.1.10) 3.058ms pmtu 1500
1: 192.168.1.1 (192.168.1.1) 1.911ms
2: yx-in-f100.google.com (74.125.45.100) asymm 1 8.021ms reached
Resume: pmtu 1500 hops 2 back 1
#


一行目が自分のIPアドレスです(もちろん書き換えてます。)
3.058msは応答速度
pmtuは経路上で見つかったMTUか?

二行目はゲートウェイ
応答速度は、1.911ms
asymmは異なる経路から帰ってきたことを示す
reachedは接続が完了したとかそういう意味みたい。

三行目は目的のサーバ

ネットワークの疎通が!!!!!!!!!!!!!

(((((((( ;゚Д゚))))))))ガクガクブルブルガタガタブルブル



1.落ち着きます



2.LANケーブルが正常に接続されているか確認します。
 →あ…、抜けてた…
  →よくあります。



3.pingで疎通確認を行う
 →IPアドレス
 →必要があればホスト名
   →DNSが原因であるかも知れないから
  →応答が無ければ、DNS稼動確認
  →DNS稼動していれば、/etc/resolv.conf
 →LAN内は可能であっても、インターネットに接続できない場合
  →GWのIPアドレスの確認
  →ルータに問題はないか確認



4.routeコマンドで経路の確認
 →GWは間違っていないか
 →間違ったルートを設定していないか



5.traceroute・trancepathで経路を確認

Linuxのネットワークファイル

/etc/hostname
 →ホスト名を記述

/etc/hosts
 →ホスト名とIPアドレスとの対応が記述

/etc/networks
 →ネットワーク名とネットワークアドレスの対応が記述

/etc/nsswitch.conf
 →名前解決の順番を記述
 →files…/etc/hostsファイルを使用
 →ldap…ldapサーバに問い合わせる
 →dns…dnsサーバに問い合わせる

/etc/resolv.conf
 →問い合わせ先のDNSサーバやドメイン名を記述
 →searchはドメイン名が省略されている時に、補完するドメイン名を記述する
 →domainは自分の端末が属するドメイン名を記述する。
  →search行かdomain行をいづれか指定する
  →両方指定した場合、下に書いたほうが優先させる
 → nameserverはDNSのIPアドレスを記述する



/etc/sysconfig/network
 →ネットワーク機能の使用・ホスト名・GWアドレスを記述



/etc/sysconfig/network-scripts/ifcfg-eth0
 →インターフェイスの設定情報
 →インターフェイス毎にある

無線ネットワーク (Linuxだよ)

無線ネットワーク。
#Linuxで無線なんて使ったことがない…。



無線の規格
  IEEE802.11a…伝送速度 54Mbps
旧 IEEE802.11b…伝送速度 11Mbps
↓ IEEE802.11g…伝送速度 54Mbps
新 IEEE802.11n…伝送速度 126/130Mbps



無線のセキュリティ
WEP…標準だが、脆弱性がある
WPA…新しいセキュリティ規格
 WPA-TKIP < セキュリティ強度 < WPA-AES


アクセスポイント識別子
32文字からなるSSIDをアクセスポイントと端末に設定し、
マッチしないと通信を行わない仕組み。
でも、どこのアクセスポイントでも接続できるanyがあるのでセキュリティが低い。

ESSIDは複数のアクセスポイントがあっても接続できるように
SSIDを拡張したもの。



無線LANインターフェイス
wlanN
(N>=0)



無線LANインターフェイス
iwconfig



ESSIDの設定方法
iwconfig wlan0 essid "kokko"



WEPキーの設定方法
iwconfig wlan0 key s:kokko
nc…ポートスキャンだったり、通信状態を確認できる

v … 詳細な。
z … ポートスキャンをする
u … UDPポートも(できなかったんだけどなぁ・・・?)

# nc -vz 192.168.1.10 1-1000
nc: connect to 192.168.1.10 port 1 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 2 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 3 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 4 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 5 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 6 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 7 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 8 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 9 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 10 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 11 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 12 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 13 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 14 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 15 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 16 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 17 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 18 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 19 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 20 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 21 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 22 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 23 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 24 (tcp) failed: Connection refused
Connection to 192.168.1.10 25 port [tcp/smtp] succeeded!
nc: connect to 192.168.1.10 port 26 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 27 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 28 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 29 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 30 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 31 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 32 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 33 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 34 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 35 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 36 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 37 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 38 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 39 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 40 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 41 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 42 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 43 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 44 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 45 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 46 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 47 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 48 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 49 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 50 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 51 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 52 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 53 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 54 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 55 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 56 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 57 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 58 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 59 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 60 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 61 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 62 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 63 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 64 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 65 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 66 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 67 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 68 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 69 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 70 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 71 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 72 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 73 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 74 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 75 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 76 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 77 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 78 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 79 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 80 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 81 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 82 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 83 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 84 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 85 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 86 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 87 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 88 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 89 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 90 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 91 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 92 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 93 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 94 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 95 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 96 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 97 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 98 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 99 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 100 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 101 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 102 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 103 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 104 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 105 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 106 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 107 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 108 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 109 (tcp) failed: Connection refused
Connection to 192.168.1.10 110 port [tcp/pop3] succeeded!
nc: connect to 192.168.1.10 port 111 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 112 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 113 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 114 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 115 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 116 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 117 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 118 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 119 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 120 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 121 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 122 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 123 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 124 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 125 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 126 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 127 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 128 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 129 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 130 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 131 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 132 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 133 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 134 (tcp) failed: Connection refused
Connection to 192.168.1.10 135 port [tcp/epmap] succeeded!
nc: connect to 192.168.1.10 port 136 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 137 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 138 (tcp) failed: Connection refused
Connection to 192.168.1.10 139 port [tcp/netbios-ssn] succeeded!
nc: connect to 192.168.1.10 port 140 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 141 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 142 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 143 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 144 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 145 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 146 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 147 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 148 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 149 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 150 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 151 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 152 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 153 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 154 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 155 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 156 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 157 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 158 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 159 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 160 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 161 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 162 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 163 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 164 (tcp) failed: Connection refused
nc: connect to 192.168.1.10 port 165 (tcp) failed: Connection refused


おほほおぉ…
他のパソコンの空いてているポートまるわかりですかぁ…

netstat

netstat -l
 →接続待ち状態のソケットを表示

# netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost.localdomain:ipp *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
udp 0 0 *:bootpc *:*
udp 0 0 *:ipp *:*
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 4150 /var/run/cups/cups.sock


tcp 0 0 localhost.localdomain:ipp *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
ここから、印刷とSSHサーバが稼動していることが分かる。
 →ippはcupsが開いている。





netstat -i# netstat -i
 →インターフェイス毎の情報を表示する

Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 63719 0 0 0 34413 0 0 0 BMRU
lo 16436 0 0 0 0 0 0 0 0 0 LRU

Iface … インターフェイス名
MTU … インターフェイスのMTU値。MTU…一回に送信できる最大値
Met … メトリック数。メトリック…経路制御の基準となるネットワークコスト。
RX-OK … 正常パケット数(受信)
RX-ERR … エラーパケット数(受信)
RX-DRP … 破棄パケット数(受信)
RX-OVR … オーバーロードパケット数(受信)
TX-OK … 正常パケット数(送信)
TX-ERR … エラーパケット数(送信)
TX-DRP … 破棄パケット数(送信)
TX-OVR … オーバーロードパケット数(送信)
Flg … フラグ
 →B…ブロードキャスト
 →L…ループバックデバイス
 →R…動作中
→U…使用可能






netstat -r
ルーティングテーブルの表示(routeコマンドと同じ表示)

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

Destination … 宛て先IPアドレス
Gateway … GWIPアドレス
Genmask … GWのネットマスク
Flags … フラグ
 →U…ルートがup状態 
 →G…ゲートウェイのルート
 →H…完全ホスト指定アドレス
Metric … メトリック(説明は上で) 
Ref … 有効なユーザ数
Use … 送信パケット量
Iface … インターフェイス

traceroute

パケットの伝送経路を調べる

参考:http://www.soi.wide.ad.jp/class/20050022/slides/04/51.html


コマンドを打つ。
# traceroute www.google.com
traceroute to www.google.com (72.14.203.104), 30 hops max, 40 byte packets
1 XXX.XXX.XXX.XXX (XXX.XXX.XXX.XXX) 7.031 ms 6.042 ms 5.062 ms
2 tx-in-f104.google.com (72.14.203.104) 29.941 ms 34.969 ms 35.057 ms



traceroute to www.google.com (72.14.203.104),
www.google.comまで伝送経路を表示するよ。


30 hops max,
30ホップ、つまり、ゲートウェイを30回までしか通過しないよ。
これは、ネットワーク網がループするようになっている場合、無限に回り続け
ネットワークに負荷をかけないようにするため。

40 byte packets
よく分からん。


1 XXX.XXX.XXX.XXX (XXX.XXX.XXX.XXX) 7.031 ms 6.042 ms 5.062 ms
2 tx-in-f104.google.com (72.14.203.104) 29.941 ms 34.969 ms 35.057 ms
ホスト名(IPアドレス) まで三つのパケットを送り、それぞれの往復時間が
7.031 ms 6.042 ms 5.062 msをいうように表示されている

フォロワー

ブログ アーカイブ