linux:ubuntu:network_setting

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
linux:ubuntu:network_setting [2013/11/07 12:19] ともやんlinux:ubuntu:network_setting [2019/05/18 02:23] (現在) – 外部編集 非ログインユーザー
行 3: 行 3:
 $ sudo vi /etc/network/interfaces $ sudo vi /etc/network/interfaces
 </code> </code>
-<code ausoconf>+ 
 +DHCPの場合 
 +<code autoconf> 
 +auto lo 
 +iface lo inet loopback 
 + 
 +auto eth0 
 +iface eth0 inet dhcp 
 +</code> 
 + 
 +固定IPの場合 
 +<code autoconf>
 auto lo auto lo
 iface lo inet loopback iface lo inet loopback
行 18: 行 29:
 設定反映。 設定反映。
 <code> <code>
-$ sudo /etc/init.d/networking restart+$ sudo ifdown eth0 && sudo ifup eth0 
 +</code> 
 + 
 +===== NIC に複数IPを設定 ===== 
 +<code> 
 +auto lo 
 +iface lo inet loopback 
 + 
 +auto eth0 
 +iface eth0 inet static 
 +    address 192.168.1.1 
 +    netmask 255.255.255.0 
 +    gateway 192.168.1.254 
 +    dns-nameservers 192.168.1.254 
 + 
 +auto eth0:0 
 +iface eth0:0 inet static 
 +    address 192.168.2.1 
 +    netmask 255.255.255.0 
 +</code> 
 + 
 +===== 複数NICの設定 ===== 
 +<code> 
 +auto lo 
 +iface lo inet loopback 
 + 
 +auto eth0 
 +iface eth0 inet static 
 +    address 192.168.1.1 
 +    netmask 255.255.255.0 
 +    gateway 192.168.1.254 
 +    dns-nameservers 192.168.1.254 
 + 
 +auto eth1 
 +iface eth1 inet static 
 +    address 192.168.2.1 
 +    netmask 255.255.255.0 
 +    post-up /sbin/ip route del default dev eth1 
 +</code> 
 +====== トラブルシューティング ====== 
 +digコマンドで名前解決できるが、pingコマンドではunknown hostと言われる。 
 +<code> 
 +$ dig blue-dc.fireball.local 
 + 
 +; <<>> DiG 9.9.3-rpz2+rl.13214.22-P2-Ubuntu-1:9.9.3.dfsg.P2-4ubuntu1 <<>> blue-dc.fireball.local 
 +;; global options: +cmd 
 +;; Got answer: 
 +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35008 
 +;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 
 + 
 +;; QUESTION SECTION: 
 +;blue-dc.fireball.local. IN A 
 + 
 +;; ANSWER SECTION: 
 +blue-dc.fireball.local. 900 IN A 192.168.1.10 
 + 
 +;; Query time: 0 msec 
 +;; SERVER: 192.168.1.10#53(192.168.1.10) 
 +;; WHEN: Thu Nov 07 13:45:23 JST 2013 
 +;; MSG SIZE  rcvd: 56 
 +</code> 
 +<code> 
 +$ ping blue-dc.fireball.local 
 +ping: unknown host blue-dc.fireball.local 
 +</code> 
 + 
 +nsswitch.confを修正して名前解決まわりをシンプル設定にする。 
 +<code> 
 +$ sudo vi /etc/nsswitch.conf 
 +</code> 
 +<code> 
 +#hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4 
 +hosts:          files dns
 </code> </code>
  • linux/ubuntu/network_setting.1383794365.txt.gz
  • 最終更新: 2019/05/18 02:23
  • (外部編集)