サーバーとして動かすためにIPアドレスを固定したい
そんなときは設定ファイルを編集するしかない
/etc/network/interfaces
ubuntuサーバーはこのファイルをいじる
ちなみにLinuxでは基本的に /etc 以下に設定ファイルが入ってるらしい
設定ファイルを開く
sudo vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activeate 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
よく意味はわからんけど
おそらく eth0 で自動的に接続して
eth0 には dhcp を使います的な意味だろう
なので dhcp ではなく固定アドレスにしましょう
# This file describes the network interfaces available on your system
# and how to activeate 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 static
address 192.168.x.xxx
netmask 255.255.255.0
gateway 192.168.x.xxx
static ってついてる時点でかなり固定っぽい
終わったらコマンドモードに変更して(Esc)
:wq