Ubuntu Serverインストール後にネットワークの設定を行った時の備忘録 †Ubuntu14.04でも同様の操作で設定が可能でした。 Ubuntu16.04については、ネットワーク名称が変わったので別記事として書き直しました。 VirtualBoxを使用しゲストOSとしてUbuntu12.04 Serverをインストールした時のネットワーク設定の備忘録です。
関連資料 †
ネットワーク設定を行うための設定ファイル †ネットワーク設定を行うために以下のファイルを編集しIPアドレスなどを設定します。 /etc/network/interfaces 編集するためのエディタを使用します。
本備忘録で/etc/network/interfacesの編集前・編集後 †/etc/network/interfacesの内容を以下に記します。 設定は以下のようにしました。
編集前の/etc/network/interfaces †以下は編集前の/etc/network/interfacesの内容です。 sakura@ubuntu:~$ 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). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp sakura@ubuntu:~$ 編集後の/etc/network/interfaces †以下は編集後の/etc/network/interfacesの内容です。 #Host Only network interfaceの行以下が新規に追加した行になります。 sakura@ubuntu:~$ 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). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp # Host Only network interface auto eth1 iface eth1 inet static address 192.168.56.12 netmask 255.255.255.0 sakura@ubuntu:~$ 設定を反映するためにネットワークの再起動 †変更した内容を反映させるため以下のコマンドでネットワークの再起動をすることができます。 sudo /etc/init.d/networking restart 上記のネットワーク再起動後のifconfigを確認してみると、設定が反映されていることが確認できます。 Ubuntu14.04では上記のrestartを動かしても何も変化がありませんでした。 以上、Ubuntu ServerをVirtualBoxにインストール後にネットワーク設定をした時の備忘録でした。 |