(2015-03-04) 実験の趣旨 †Linuxでは、1つのマシン上にNICが複数し、同一ネットワークに接続している場合に、
今回、簡単な実験を行い上記の現象を確認してみます。 なお、これらが何かの役に立つかどうかはまったくもってわかりませんのであしからず(^^;)。 目次 実験の前提環境 †例によってRaspberry Piを使います。
大まかな接続図としてはこんな感じ。 [NTTルーター] | 192.168.1.0/24 +------(有線)---+-----------+------------+ | | | | | | 192.168.1.21 192.168.1.20 | [マシンA (eth0) (wlan0)] [マシンB (br0)] [無線アクセスポイント] 192.168.1.51 : : : : : :..............(電波)...........: シナリオ †複数NIC搭載マシンへのARP問い合わせのシナリオとしてはだいたいこんな感じかと。 マシンBがマシンAのIPアドレスを問い合わせるケース
実験1:現象確認 †まずは現象を確認してみます。 ネットワークインターフェースはすべて起動済みとしておきます。 準備 †マシンBでARPテーブルをクリアし、マシンAのIPアドレス、MACアドレスの組み合わせを削除します。 root@Machine-B # arp -d 192.168.1.21 root@Machine-B # arp -d 192.168.1.51 root@Machine-B # arp -n | egrep '192.168.1.[25]1 ' アドレス HWタイプ HWアドレス フラグ マスク インタフェース 192.168.1.51 (不完全) br0 192.168.1.21 (不完全) br0 pingによる確認 †マシンBからマシンAに向けて ping コマンドを発行し、ARPの実行結果を確認します。 マシンB:ping root@Machine-B # ping -c 1 192.168.1.51 PING 192.168.1.51 (192.168.1.51) 56(84) bytes of data. 64 bytes from 192.168.1.51: icmp_req=1 ttl=64 time=2.36 ms --- 192.168.1.51 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 2.361/2.361/2.361/0.000 ms マシンB:tcpdump root@Machine-B # tcpdump -i br0 -n -e arp or icmp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on br0, link-type EN10MB (Ethernet), capture size 65535 bytes 15:43:48.100167 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.1.51 tell 192.168.1.20, length 28 15:43:48.101192 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 60: Reply 192.168.1.51 is-at 11:11:11:11:11:11, length 46 15:43:48.101434 99:99:99:99:99:99 > 11:11:11:11:11:11, ethertype IPv4 (0x0800), length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 7628, seq 1, length 64 15:43:48.102417 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype IPv4 (0x0800), length 98: 192.168.1.51 > 192.168.1.20: ICMP echo reply, id 7628, seq 1, length 64 マシンB:ping後のARPテーブル root@Machine-B # arp -n アドレス HWタイプ HWアドレス フラグ マスク インタフェース 192.168.1.51 ether 11:11:11:11:11:11 C br0 192.168.1.21 (不完全) br0 実験1の結果のまとめ †マシンBからのARP(IPアドレス192.168.1.51に対するMACアドレスの問い合わせ)のブロードキャスト: 15:43:48.100167 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.1.51 tell 192.168.1.20, length 28 に対して、マシンAの eth0(MACアドレス 11:11:11:11:11:11)が応答: 15:43:48.101192 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 60: Reply 192.168.1.51 is-at 11:11:11:11:11:11, length 46 を返している。 15:43:48.101434 99:99:99:99:99:99 > 11:11:11:11:11:11, ethertype IPv4 (0x0800), length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 7628, seq 1, length 64 15:43:48.102417 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype IPv4 (0x0800), length 98: 192.168.1.51 > 192.168.1.20: ICMP echo reply, id 7628, seq 1, length 64 つまりは、192.168.1.51 を指定して通信をしても、実際にはwlan0=無線LANではなく、eth0=有線LAN側を 実験2:正しいインターフェースで通信可能か †実は無線LANの増設を紹介しているホームページ等で説明されているのですが、 準備 †具体的には、マシンAのルーティングに対して下記のルールを追加します。 root@Machine-A # ip rule add from 192.168.1.51 table 100 prio 200 root@Machine-A # ip route add dev wlan0 src 192.168.1.51 table 100 それと、実験1と同じく マシンBのARPテーブルからIPアドレスを削除しておきます。 root@Machine-B # arp -d 192.168.1.21 root@Machine-B # arp -d 192.168.1.51 pingによる確認 †マシンBからマシンAに向けて ping コマンドを発行し、ARPの実行結果を確認します。 マシンB:ping root@Machine-B # ping -c 1 192.168.1.51 PING 192.168.1.51 (192.168.1.51) 56(84) bytes of data. 64 bytes from 192.168.1.51: icmp_req=1 ttl=64 time=4.37 ms --- 192.168.1.51 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 4.377/4.377/4.377/0.000 ms マシンB:tcpdump root@Machine-B # tcpdump -i br0 -n -e arp or icmp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on br0, link-type EN10MB (Ethernet), capture size 65535 bytes 15:16:25.851843 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.1.51 tell 192.168.1.20, length 28 15:16:25.853188 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 60: Reply 192.168.1.51 is-at 11:11:11:11:11:11, length 46 15:16:25.853415 99:99:99:99:99:99 > 11:11:11:11:11:11, ethertype IPv4 (0x0800), length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 7586, seq 1, length 64 15:16:25.856669 22:22:22:22:22:22 > 99:99:99:99:99:99, ethertype IPv4 (0x0800), length 98: 192.168.1.51 > 192.168.1.20: ICMP echo reply, id 7586, seq 1, length 64 マシンB:ping後のARPテーブル root@Machine-B # arp -n アドレス HWタイプ HWアドレス フラグ マスク インタフェース 192.168.1.51 ether 22:22:22:22:22:22 C br0 192.168.1.21 (不完全) br0 マシンA:tcpdump(インターフェース eth0) root@Machine-A # tcpdump -n -e -i eth0 arp or icmp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 15:16:25.854860 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 192.168.1.51 tell 192.168.1.20, length 46 15:16:25.855135 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 42: Reply 192.168.1.51 is-at 11:11:11:11:11:11, length 28 15:16:25.856431 99:99:99:99:99:99 > 11:11:11:11:11:11, ethertype IPv4 (0x0800), length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 7586, seq 1, length 64 マシンA:tcpdump(インターフェース wlan0) root@Machine-A # tcpdump -n -e -i wlan0 arp or icmp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on wlan0, link-type EN10MB (Ethernet), capture size 65535 bytes 15:16:25.856811 22:22:22:22:22:22 > 99:99:99:99:99:99, ethertype IPv4 (0x0800), length 98: 192.168.1.51 > 192.168.1.20: ICMP echo reply, id 7586, seq 1, length 64 実験2の結果のまとめ †マシンBからのARP発行の部分および、ICMP echoの1行(下記3行)までは実験1と同じです。 15:16:25.851843 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.1.51 tell 192.168.1.20, length 28 15:16:25.853188 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 60: Reply 192.168.1.51 is-at 11:11:11:11:11:11, length 46 15:16:25.853415 99:99:99:99:99:99 > 11:11:11:11:11:11, ethertype IPv4 (0x0800), length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 7586, seq 1, length 64 すなわち、IPアドレス192.168.1.51に対応するMACアドレス11:11:11:11:11:11を取得し、ICMP echoのパケットを 11:11:11:11:11:11 に対して投げるところまでです。 異なるのは、マシンBの tcpdump の4行目: 15:16:25.856669 22:22:22:22:22:22 > 99:99:99:99:99:99, ethertype IPv4 (0x0800), length 98: 192.168.1.51 > 192.168.1.20: ICMP echo reply, id 7586, seq 1, length 64 の部分で、マシンBからマシンAの MAC=11:11:11:11:11:11 に対して投げたICMP echoパケットの応答が、 今回、マシンAでもパケットを出力してみましたが、最後のICMP echoの応答は確かに wlan0 インターフェースから 実験3:初回のARPで正しい回答をしたい †さて、実験2の設定により、通信開始時のIPアドレス->MACアドレス変換さえ我慢すれば、 具体的には、実験1,2での下記の部分: 15:16:25.851843 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.1.51 tell 192.168.1.20, length 28 15:16:25.853188 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 60: Reply 192.168.1.51 is-at 11:11:11:11:11:11, length 46 これが下記: 15:16:25.851843 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.1.51 tell 192.168.1.20, length 28 15:16:25.853188 22:22:22:22:22:22 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 60: Reply 192.168.1.51 is-at 22:22:22:22:22:22, length 46 のようにならないかな~、ということです。 いろいろとあさってみた結果、arptables というパッケージがあり、なんか使えそうな雰囲気なので、 準備 †まずはマシンAの設定。 root@Machine-A # ip route del default table 100 root@Machine-A # ip rule del table 100 arptableパッケージのインストール。デフォルトではインストールされていませんので。 root@Machine-A # apt-get install arptables さらに、arptables のコマンドで下記のようなものを走らせます。 root@Machine-A # arptables -F root@Machine-A # arptables -A OUTPUT -s 192.168.1.21 -j mangle -l 6 --mangle-mac-s 11:11:11:11:11:11 root@Machine-A # arptables -A OUTPUT -s 192.168.1.51 -j mangle -l 6 --mangle-mac-s 22:22:22:22:22:22 マシンBのARPテーブルからIPアドレスを削除しておきます。 root@Machine-B # arp -d 192.168.1.21 root@Machine-B # arp -d 192.168.1.51 これで準備完了です。 pingによる確認 †実験2と同様、マシンBからマシンAに向けて ping コマンドを発行し、ARP,ICMP echo(=ping)の実行結果を確認します。 マシンB:ping root@Machine-B # ping -c 1 192.168.1.51 PING 192.168.1.51 (192.168.1.51) 56(84) bytes of data. 64 bytes from 192.168.1.51: icmp_req=1 ttl=64 time=103 ms --- 192.168.1.51 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 103.255/103.255/103.255/0.000 ms マシンB:tcpdump root@Machine-B # tcpdump -i br0 -n -e arp or icmp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on br0, link-type EN10MB (Ethernet), capture size 65535 bytes 16:52:08.702370 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.1.51 tell 192.168.1.20, length 28 16:52:08.703887 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 60: Reply 192.168.1.51 is-at 22:22:22:22:22:22, length 46 16:52:08.704138 99:99:99:99:99:99 > 22:22:22:22:22:22, ethertype IPv4 (0x0800), length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 7794, seq 1, length 64 16:52:08.805478 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype IPv4 (0x0800), length 98: 192.168.1.51 > 192.168.1.20: ICMP echo reply, id 7794, seq 1, length 64 マシンB:ping後のARPテーブル root@Machine-B # arp -n アドレス HWタイプ HWアドレス フラグ マスク インタフェース 192.168.1.51 ether 22:22:22:22:22:22 C br0 192.168.1.21 (不完全) br0 マシンA:tcpdump(インターフェース eth0) root@Machine-A # tcpdump -n -e -i eth0 arp or icmp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 16:52:08.706401 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 192.168.1.51 tell 192.168.1.20, length 46 16:52:08.706702 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 42: Reply 192.168.1.51 is-at 22:22:22:22:22:22, length 28 16:52:08.708073 99:99:99:99:99:99 > 22:22:22:22:22:22, ethertype IPv4 (0x0800), length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 7794, seq 1, length 64 16:52:08.808324 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype IPv4 (0x0800), length 98: 192.168.1.51 > 192.168.1.20: ICMP echo reply, id 7794, seq 1, length 64 (以下の2行は不明。いつもセットで出力される。今後の課題) 16:52:10.936947 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 192.168.1.21 tell 192.168.1.20, length 46 16:52:10.937261 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 42: Reply 192.168.1.21 is-at 11:11:11:11:11:11, length 28 マシンA:tcpdump(インターフェース wlan0) root@Machine-A # tcpdump -n -e -i wlan0 arp or icmp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 16:52:08.807998 99:99:99:99:99:99 > 22:22:22:22:22:22, ethertype IPv4 (0x0800), length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 7794, seq 1, length 64 実験3の結果のまとめ †マシンBからのARP発行の部分を実験2と比較してみます。 実験2:マシンBのtcpdump 15:16:25.851843 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.1.51 tell 192.168.1.20, length 28 15:16:25.853188 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 60: Reply 192.168.1.51 is-at 11:11:11:11:11:11, length 46 実験3:マシンBのtcpdump 16:52:08.702370 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.1.51 tell 192.168.1.20, length 28 16:52:08.703887 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 60: Reply 192.168.1.51 is-at 22:22:22:22:22:22, length 46 IPアドレス 192.168.1.51 に対するMACアドレスのマシンAからの回答として、
一方、ARPによりMACアドレスを取得したマシンBは、ICMP echo(=ping)を発行するのに、宛先MACアドレスとして また、マシンA側でのICMP echo(=ping)パケット受信部分で怪しい部分があります。 16:52:10.936947 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 192.168.1.21 tell 192.168.1.20, length 46 マシンAのwlan0 16:52:08.807998 99:99:99:99:99:99 > 22:22:22:22:22:22, ethertype IPv4 (0x0800), length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 7794, seq 1, length 64 マシンAからBへのICMP echo応答を返す部分は、実験2のルーティングをクリアしたので、まあこのログの通りの動作です。 16:52:10.937261 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 42: Reply 192.168.1.21 is-at 11:11:11:11:11:11, length 28 結局、ARPの初回応答をマシンAのwlan0からやりたーい、という野望は2015-03-02現在、達成できておりません。 実験4:実験2と実験3の組み合わせ †すでに100%うまくはいかないことは分かっているのでテンションかなり下がっていますが、実験2と3の組み合わせ技で、 準備 †マシンAのルーティングに対して下記のルールを追加します(実験2より)。 root@Machine-A # ip rule add from 192.168.1.51 table 100 prio 200 root@Machine-A # ip route add dev wlan0 src 192.168.1.51 table 100 さらに、マシンAにて rptables のコマンドで下記を走らせます(実験3より)。 root@Machine-A # arptables -F root@Machine-A # arptables -A OUTPUT -s 192.168.1.21 -j mangle -l 6 --mangle-mac-s 11:11:11:11:11:11 root@Machine-A # arptables -A OUTPUT -s 192.168.1.51 -j mangle -l 6 --mangle-mac-s 22:22:22:22:22:22 マシンBのARPテーブルからIPアドレスを削除します(実験2,3共通)。 root@Machine-B # arp -d 192.168.1.21 root@Machine-B # arp -d 192.168.1.51 準備完了です。 pingによる確認 †マシンBからマシンAに向けて ping コマンドを発行し、ARP,ICMP echo(=ping)の実行結果を確認します。 マシンB:ping root@Machine-B # ping -c 1 192.168.1.51 PING 192.168.1.51 (192.168.1.51) 56(84) bytes of data. 64 bytes from 192.168.1.51: icmp_req=1 ttl=64 time=124 ms --- 192.168.1.51 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 124.918/124.918/124.918/0.000 ms マシンB:tcpdump 11:33:53.753791 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.1.51 tell 192.168.1.20, length 28 11:33:53.755293 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 60: Reply 192.168.1.51 is-at 22:22:22:22:22:22, length 46 11:33:53.755544 99:99:99:99:99:99 > 22:22:22:22:22:22, ethertype IPv4 (0x0800),length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 11123, seq 1, length 64 ※a(11:33:53.875123 22:22:22:22:22:22 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 192.168.1.20 tell 192.168.1.51, length 46) ※b(11:33:53.875418 99:99:99:99:99:99 > 22:22:22:22:22:22, ethertype ARP (0x0806), length 42: Reply 192.168.1.20 is-at 99:99:99:99:99:99, length 28) 11:33:53.878559 22:22:22:22:22:22 > 99:99:99:99:99:99, ethertype IPv4 (0x0800), length 98: 192.168.1.51 > 192.168.1.20: ICMP echo reply, id 11123, seq 1, length 64 マシンB:ping後のARPテーブル root@Machine-B # arp -n アドレス HWタイプ HWアドレス フラグ マスク インタフェース 192.168.1.51 ether 22:22:22:22:22:22 C br0 192.168.1.21 ether 11:11:11:11:11:11 C br0 マシンA:tcpdump(インターフェース eth0) 11:33:53.755356 99:99:99:99:99:99 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 192.168.1.51 tell 192.168.1.20, length 46 11:33:53.755701 11:11:11:11:11:11 > 99:99:99:99:99:99, ethertype ARP (0x0806), length 42: Reply 192.168.1.51 is-at 22:22:22:22:22:22, length 28 11:33:53.757107 99:99:99:99:99:99 > 22:22:22:22:22:22, ethertype IPv4 (0x0800), length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 11123, seq 1, length 64 ※c(11:33:53.876152 22:22:22:22:22:22 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 192.168.1.20 tell 192.168.1.51, length 46) マシンA:tcpdump(インターフェース wlan0) root@Machine-A # tcpdump -n -e -i wlan0 arp or icmp tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on wlan0, link-type EN10MB (Ethernet), capture size 65535 bytes 11:33:53.873355 99:99:99:99:99:99 > 22:22:22:22:22:22, ethertype IPv4 (0x0800), length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 11123, seq 1, length 64 ※d(11:33:53.873745 22:22:22:22:22:22 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Request who-has 192.168.1.20 tell 192.168.1.51, length 28) ※e(11:33:53.877781 99:99:99:99:99:99 > 22:22:22:22:22:22, ethertype ARP (0x0806), length 60: Reply 192.168.1.20 is-at 99:99:99:99:99:99, length 46) 11:33:53.878038 22:22:22:22:22:22 > 99:99:99:99:99:99, ethertype IPv4 (0x0800), length 98: 192.168.1.51 > 192.168.1.20: ICMP echo reply, id 11123, seq 1, length 64 上記の※a~eは、なぜかICMP echo request ~ reply の間にマシンAのwlan0から、192.168.1.20を持つ 実験4の結果のまとめ †事象だけ追っかけるとおおよそ以下のようになりました。(テンション低いっす:-)
不可解なのは、マシンAの tcpdump の出力において、マシンBからのICMP echoリクエスト(下記の行)が 11:33:53.757107 99:99:99:99:99:99 > 22:22:22:22:22:22, ethertype IPv4 (0x0800), length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 11123, seq 1, length 64 11:33:53.873355 99:99:99:99:99:99 > 22:22:22:22:22:22, ethertype IPv4 (0x0800), length 98: 192.168.1.20 > 192.168.1.51: ICMP echo request, id 11123, seq 1, length 64 理由はよくわかりません。 それと、※a~eは、なぜかICMP echo request ~ reply の間にマシンAのwlan0から、192.168.1.20を持つMACアドレスを まとめ †ネットワークカードを2枚挿し、それぞれに同一ネットワークアドレスの別IPアドレスを持たせる、という ネットワーク設定ファイルの紹介(/etc/network/interfaces) †ネットワークの設定ファイルは最終的に下記のようになりました。 $ cat /etc/network/interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.21 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 #auto wlan0 iface wlan0 inet static address 192.168.1.51 netmask 255.255.255.0 network 192.168.1.0 post-up arptables -A OUTPUT -s 192.168.1.21 -j mangle -l 6 --mangle-mac-s 11:11:11:11:11:11 post-up arptables -A OUTPUT -s 192.168.1.51 -j mangle -l 6 --mangle-mac-s 22:22:22:22:22:22 post-up ip rule add from 192.168.1.51 table 100 prio 2000 post-up ip route add dev wlan0 src 192.168.1.51 table 100 ########## # do not use following one line!! delete automatically when ifdown wlan0. # post-down ip route del dev wlan0 src 192.168.1.51 table 100 ########## post-down ip rule del table 100 prio 2000 post-down arptables -D OUTPUT -s 192.168.1.21 -j mangle -l 6 --mangle-mac-s 11:11:11:11:11:11 post-down arptables -D OUTPUT -s 192.168.1.51 -j mangle -l 6 --mangle-mac-s 22:22:22:22:22:22 broadcast 192.168.1.255 #gateway 192.168.1.1 wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf 簡単に解説しますと・・・
つぶやき:上記設定で tcpdump 見てると、なんだか余計なARPが発生したりしているような・・・謎。 終わりに †この実験はひとまずこれで終了ということにしますが、時間があればもう少し上記の問題点(wlan0についての |