0
1

More than 3 years have passed since last update.

ハッキング・ラボの構築で詰まったところ 第一夜

Last updated at Posted at 2020-09-26

前枠

ハッキング・ラボのつくりかた」の環境構築で詰まった部分についてのまとめ。
同じところ(Kindle版(初版)の位置ナンバーも一緒に載せたいと思います。)で詰まる人もいるのでは、という思いでQiitaに投稿します。

また、初回投稿時点で「ハッキング・ラボの構築で困ったら読む本」も発売されており、そちらは著者さん自身が詰まりやすい部分を解説されております。私としてはそちらを「なるべく読まない」スタイルで行こうと思いますが、記載されていた場合は確認後注記しようと思います。

5つくらいまで随時追記していこうと思っています。
解決のたびに気になることが出てくるので追記はなしで。
また詰まるところがあったら記事書きます。

ネットワークの設定

位置No.922 あたり

概要

eth0 と eth1 の設定を /etc/network/interfaces に入れ込んだけれど、再起動後にifconfig で確認しても認識してくれていない!

解決方法(?)

Kaliの再起動とは別に、設定の反映が必要なのか、反映コマンド入力後しばらくして接続確認できました。

反映コマンド(位置No.846あたり)
# auto の場合
/etc/init.d/networking restart

# allow-hotplug の場合
ifdown eth0 && ifup eth0
ifdown eth1 && ifup eth1
root@kali:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.101  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::a00:27ff:fe5c:6526  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:5c:65:26  txqueuelen 1000  (イーサネット)
        RX packets 262  bytes 79841 (77.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12  bytes 1480 (1.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.3.15  netmask 255.255.255.0  broadcast 10.0.3.255
        inet6 fe80::a00:27ff:feba:9a76  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:ba:9a:76  txqueuelen 1000  (イーサネット)
        RX packets 4  bytes 1380 (1.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13  bytes 1535 (1.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (ローカルループバック)
        RX packets 10  bytes 478 (478.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10  bytes 478 (478.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

気づき

何度かKali自体を再起動するとifconfig でみるとlo しか出てこないことがある。そのたびに起動しなきゃなのだろうか…?
「allow-hotplug」を「auto」にするとどうだろうか。

実験1

「allow-hotplug」利用のままで、「LANアダプターを認識すると起動」するらしいので、Kaliを再起動後にeth0 とeth0 をifup せずに、pingを打ってみる。
⇒ 通信の発生=LANアダプターの認識、であるかを確認する。


root@kali:/home/kali# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hostplug eth0
#auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 10.0.0.2
netmask 255.255.255.0

# The secondary network interface
allow-hostplug eth1
#auto eth1
iface eth1 inet dhcp
root@kali:/home/kali# 
root@kali:/home/kali# 
root@kali:/home/kali# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (ローカルループバック)
        RX packets 8  bytes 400 (400.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 400 (400.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@kali:/home/kali# 
root@kali:/home/kali# 
root@kali:/home/kali# ping 10.0.0.1
ping: connect: ネットワークに届きません

むむむ。違うらしい。
ここはいったん後回し…。

実験2

「auto」利用に変えてみる。

これは再起動後に起動を確認。このままのほうが楽そう。

root@kali:/home/kali# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hostplug eth0
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 10.0.0.2
netmask 255.255.255.0

# The secondary network interface
#allow-hostplug eth1
auto eth1
iface eth1 inet dhcp
root@kali:/home/kali# 
root@kali:/home/kali# 
root@kali:/home/kali# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.2  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::a00:27ff:fe5c:6526  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:5c:65:26  txqueuelen 1000  (イーサネット)
        RX packets 112  bytes 32084 (31.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 18  bytes 1348 (1.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.3.15  netmask 255.255.255.0  broadcast 10.0.3.255
        inet6 fe80::a00:27ff:feba:9a76  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:ba:9a:76  txqueuelen 1000  (イーサネット)
        RX packets 4  bytes 1380 (1.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 27  bytes 2586 (2.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (ローカルループバック)
        RX packets 10  bytes 478 (478.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10  bytes 478 (478.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

後枠

ネットワーク設定のいまのところ「auto」にしたほうがよさそう…?
また詰まったりしたら追記します。

疑問に思うともやもやするタイプなのでなかなか進まないですが、ゆるりと頑張ります。

番外編

別の日に起動したら、ログインはでき起動できたものの、黒い画面のままデスクトップが表示されなくなった。
いろいろ調べた結果、解決できた方法がこの記事。
VirtualBox上のLinuxにGuestAdditionsをインストールして、共有フォルダを設定する

海外のフォーラムとかをあさってたら、「Guest AdditionsのCDイメージ」が関係ありそうなことが分かったので実行。

実行して、デスクトップに行けるようになってからもエラーメッセージが出てきてましたがとりあえず無視して進む。
詳しい話を知っている方がいたら教えてください。

0
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1