メイン コンテンツに進む
  • すばやく簡単にご注文が可能
  • 注文内容の表示、配送状況をトラック
  • 会員限定の特典や割引のご利用
  • 製品リストの作成とアクセスが可能
  • 「Company Administration(会社情報の管理)」では、お使いのDell EMCのサイトや製品、製品レベルでのコンタクト先に関する情報を管理できます。

文書番号: 000146536


Ubuntu Server Networking

概要: In Ubuntu Server, configuring network interfaces is surprisingly straight-forward. As opposed to other Linux distributions, where there is a configuration

文書の内容


現象

In Ubuntu Server, configuring network interfaces is surprisingly straight-forward. As opposed to other Linux distributions, where there is a configuration file per each interface (which can be hard to manage), there is only one network interface configuration file in Ubuntu:

/etc/network/interfaces

Here is a basic example:

# The loopback network interface
auto lo
iface lo inet loopback

# Built-in NIC, port 1
auto em1
iface em1 inet dhcp

As you can see, the loopback interface and only one NIC port is defined, which is using DHCP. This file will be automatically populated when the OS is installed.

Say that you want to change from DHCP to a static IP address. How do you do it? Easy, though there is an extra step that may not be obvious:

1. Edit config file to look like this:

# The loopback network interface
auto lo
iface lo inet loopback

# Built-in NIC, port 1
auto em1
iface em1 inet static
address 192.168.1.7
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.254 # Your DNS server, if any
dns-search dlr.com # Your DNS search domain, if any

2. Restart networking service:

$ sudo /etc/init.d/networking restart

If using 12.04 or earlier, ignore the 'deprecated' warning message. If using 12.10 or later, you can instead use:

$ sudo restart networking

3. Shutdown the dhclient daemon, otherwise you will get an IP address from DHCP when the lease is renewed, regardless of what's specified in the configuration file:

$ sudo killall dhclient
$ sudo apt-get -y purge isc-dhcp-client

文書のプロパティ


最後に公開された日付

21 2月 2021

バージョン

3

文書の種類

Solution