前回、以下の記事にて、VirtualBoxへのインストールが完了した。
今回は、ネットワークなど、普通に使うための設定を書いていく。
path
$ vim .profile
以下を記入。
export PATH=$PATH:$HOME/bin:/sbin:/usr/sbin:/usr/local/bin
ついでに以下も実行。
sudo apt install net-tools
これで、network関連のコマンドが叩けるようになる。
network
次に、networkの設定を行っていく。
スタンスは以下の参考URLの通りにする。
ただ、この記事にあるような方法をやると動かない、なぜなら、NICの名前が変わったためだ。
参考:Ubuntu 16.04 LTSにしたらeth0がなくなっていた件について
今までは、eth0
,eth1
のようになっていた。しかし、今手元にあるのは、enpなんとか
である。手元の環境の場合は、
enp0s3
と、enp0s8
だったため、以下のように記載した。
$ sudo vim /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 allow-hotplug enp0s3 auto enp0s3 iface enp0s3 inet dhcp allow-hotplug enp0s8 auto enp0s8 iface enp0s8 inet static address 192.168.33.17 network 192.168.33.0 netmask 255.255.255.0 broadcast 192.168.33.255
変更が完了したら、以下のコマンドを叩いて、設定を反映させる。
$ sudo systemctl restart networking
その結果が、以下である。
root@debian:~# route # カーネルIP経路テーブル # 受信先サイト ゲートウェイ ネットマスク フラグ Metric Ref 使用数 インタフェース # default gateway 0.0.0.0 UG 0 0 0 enp0s3 # 10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s3 # link-local 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s3 # 192.168.33.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s8 root@debian:~# ping 8.8.8.8 # PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. # 64 bytes from 8.8.8.8: icmp_seq=1 ttl=63 time=17.6 ms # 64 bytes from 8.8.8.8: icmp_seq=2 ttl=63 time=14.8 ms # 64 bytes from 8.8.8.8: icmp_seq=3 ttl=63 time=11.0 ms
ネットワークの疎通ができていることが確認できた。