web-dev-qa-db-ja.com

静的IPアドレスでGoogleにpingできないのはなぜですか?

アスタリスクを含むOpenSUSEディストリビューションである vicibox をインストールしようとしています。 fine manual は、静的IPアドレスをyast lanで設定することを示しています。

違いは何ですか:

  ││[ ] Change Hostname via DHCP                                                                                                                                               ││ 
  ││[x] Assign Hostname to Loopback IP 

ホスト名を設定しました:

YaST2 - lan @ arrakis

  Network Settings                                                                               
  ┌Global Options──Overview──Hostname/DNS──Routing──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ 
  │┌Hostname and Domain Name───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│ 
  ││Hostname                                                                            Domain Name                                                                            ││ 
  ││arrakis▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ bounceme.net▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ││ 
  ││[ ] Change Hostname via DHCP                                                                                                                                               ││ 
  ││[x] Assign Hostname to Loopback IP                                                                                                                                         ││ 
  │└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘│ 
  │Modify DNS configuration Custom Policy Rule                                                                                                                                  │ 
  │Use Default Policy▒▒▒▒▒↓ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒↓                                                                                                                                  │ 
  │┌Name Servers and Domain Search List────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│ 
  ││Name Server 1                                                                         ┌Domain Search──────────────────────────────────────────────────────────────────────┐││ 
  ││8.8.8.8▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ │google.com                                                                         │││ 
  ││Name Server 2                                                                         │                                                                                   │││ 
  ││8.8.4.4▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ │                                                                                   │││ 
  ││Name Server 3                                                                         │                                                                                   │││ 
  ││▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ └───────────────────────────────────────────────────────────────────────────────────┘││ 
  │└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘│ 
  │                                                                                                                                                                             │ 
  │                                                                                                                                                                             │ 
  │                    

良好な接続性:

arrakis:~ # 
arrakis:~ # uname -a
Linux arrakis 3.11.10-21-default #1 SMP Mon Jul 21 15:28:46 UTC 2014 (9a9565d) x86_64 x86_64 x86_64 GNU/Linux
arrakis:~ # 
arrakis:~ # cat /etc/hosts
#
# hosts         This file describes a number of hostname-to-address
#               mappings for the TCP/IP subsystem.  It is mostly
#               used at boot time, when no name servers are running.
#               On small systems, this file can be used instead of a
#               "named" name server.
# Syntax:
#    
# IP-Address  Full-Qualified-Hostname  Short-Hostname
#

127.0.0.1       localhost

# special IPv6 addresses
::1             localhost ipv6-localhost ipv6-loopback

fe00::0         ipv6-localnet

ff00::0         ipv6-mcastprefix
ff02::1         ipv6-allnodes
ff02::2         ipv6-allrouters
ff02::3         ipv6-allhosts
127.0.0.2       arrakis.bounceme.net arrakis
arrakis:~ # 
arrakis:~ # hostname
arrakis
arrakis:~ # 
arrakis:~ # ping arrakis.bounceme.net
PING arrakis.bounceme.net (127.0.0.2) 56(84) bytes of data.
64 bytes from arrakis.bounceme.net (127.0.0.2): icmp_seq=1 ttl=64 time=0.040 ms
64 bytes from arrakis.bounceme.net (127.0.0.2): icmp_seq=2 ttl=64 time=0.050 ms
64 bytes from arrakis.bounceme.net (127.0.0.2): icmp_seq=3 ttl=64 time=0.049 ms
^C
--- arrakis.bounceme.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.040/0.046/0.050/0.007 ms
arrakis:~ # 
arrakis:~ # 
arrakis:~ # ping arrakis
PING arrakis.bounceme.net (127.0.0.2) 56(84) bytes of data.
64 bytes from arrakis.bounceme.net (127.0.0.2): icmp_seq=1 ttl=64 time=0.036 ms
64 bytes from arrakis.bounceme.net (127.0.0.2): icmp_seq=2 ttl=64 time=0.041 ms
64 bytes from arrakis.bounceme.net (127.0.0.2): icmp_seq=3 ttl=64 time=0.041 ms
c64 bytes from arrakis.bounceme.net (127.0.0.2): icmp_seq=4 ttl=64 time=0.040 ms
64 bytes from arrakis.bounceme.net (127.0.0.2): icmp_seq=5 ttl=64 time=0.043 ms
^C
--- arrakis.bounceme.net ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3996ms
rtt min/avg/max/mdev = 0.036/0.040/0.043/0.004 ms
arrakis:~ # 
arrakis:~ # 
arrakis:~ # ifconfig
enp5s0    Link encap:Ethernet  HWaddr 50:E5:49:C2:C8:05  
          inet addr:192.168.0.21  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::52e5:49ff:fec2:c805/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2632 errors:0 dropped:0 overruns:0 frame:0
          TX packets:278 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:173852 (169.7 Kb)  TX bytes:38509 (37.6 Kb)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:40 errors:0 dropped:0 overruns:0 frame:0
          TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3248 (3.1 Kb)  TX bytes:3248 (3.1 Kb)

arrakis:~ # 

しかし、IPアドレスを静的に設定したい:

YaST2 - lan @ arrakis

  Network Card Setup                                                                              
  ┌General──Address──Hardware───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ 
  │ Device Type                                                                  Configuration Name                                                                             │ 
  │ Ethernet▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒↓  enp5s0▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ │ 
  │( ) No Link and IP Setup (Bonding Slaves) [ ] Use iBFT values                                                                                                                │ 
  │( ) Dynamic Address  DHCP▒▒▒▒▒▒▒▒▒▒↓  DHCP both version 4 and 6▒↓                                                                                                            │ 
  │(x) Statically assigned IP Address                                                                                                                                           │ 
  │IP Address                                    Subnet Mask                                    Hostname                                                                        │ 
  │192.168.0.21▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 255.255.255.0▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ arrakis.bounceme.net▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒                                     │ 
  │┌Additional Addresses───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│ 
  ││   ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐   ││ 
  ││   │Alias Name│IP Address│Netmask                                                                                                                                      │   ││ 
  ││   │                                                                                                                                                                   │   ││ 
  ││   │                                                                                                                                                                   │   ││ 
  ││   │               

それでも、そうするとすぐに接続が失われます。

arrakis:~ # yast lan
arrakis:~ # 
arrakis:~ # 
arrakis:~ # ifconfig
enp5s0    Link encap:Ethernet  HWaddr 50:E5:49:C2:C8:05  
          inet addr:192.168.0.21  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::52e5:49ff:fec2:c805/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4027 errors:0 dropped:0 overruns:0 frame:0
          TX packets:858 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:271734 (265.3 Kb)  TX bytes:265009 (258.7 Kb)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:40 errors:0 dropped:0 overruns:0 frame:0
          TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3248 (3.1 Kb)  TX bytes:3248 (3.1 Kb)

arrakis:~ # 
arrakis:~ # 
arrakis:~ # ping google.com
ping: unknown Host google.com
arrakis:~ # 

googleにpingできないのはなぜですか?

参照:

http://www.vicidial.org/VICIDIALforum/viewtopic.php?f=4&t=34261

-------------------------------------------------- - - - - - - - 更新

静的IPアドレスに変更した後。動的な場合と同じIPアドレスです。

静的IPの場合:

arrakis:~ # 
arrakis:~ # ifconfig
enp5s0    Link encap:Ethernet  HWaddr 50:E5:49:C2:C8:05  
          inet addr:192.168.0.21  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::52e5:49ff:fec2:c805/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10438 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1133 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:671095 (655.3 Kb)  TX bytes:300227 (293.1 Kb)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:40 errors:0 dropped:0 overruns:0 frame:0
          TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3248 (3.1 Kb)  TX bytes:3248 (3.1 Kb)

arrakis:~ # 
arrakis:~ # ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope Host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope Host 
       valid_lft forever preferred_lft forever
2: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 50:e5:49:c2:c8:05 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.21/24 brd 192.168.0.255 scope global enp5s0
       valid_lft forever preferred_lft forever
    inet6 fe80::52e5:49ff:fec2:c805/64 scope link 
       valid_lft forever preferred_lft forever
arrakis:~ # 
arrakis:~ # ip route
127.0.0.0/8 dev lo  scope link 
192.168.0.0/24 dev enp5s0  proto kernel  scope link  src 192.168.0.21 
arrakis:~ # 
arrakis:~ # ping www.google.com
ping: unknown Host www.google.com
arrakis:~ # 
arrakis:~ # yast lan
arrakis:~ # 

次に、DHCPに戻すと、Googleにpingを実行できるようになります。

arrakis:~ # 
arrakis:~ # ping www.google.com
ping: unknown Host www.google.com
arrakis:~ # 
arrakis:~ # ip route
127.0.0.0/8 dev lo  scope link 
192.168.0.0/24 dev enp5s0  proto kernel  scope link  src 192.168.0.21 
arrakis:~ # 
arrakis:~ # ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope Host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope Host 
       valid_lft forever preferred_lft forever
2: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 50:e5:49:c2:c8:05 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.21/24 brd 192.168.0.255 scope global enp5s0
       valid_lft forever preferred_lft forever
    inet6 fe80::52e5:49ff:fec2:c805/64 scope link 
       valid_lft forever preferred_lft forever
arrakis:~ # 
arrakis:~ # ifconfig
enp5s0    Link encap:Ethernet  HWaddr 50:E5:49:C2:C8:05  
          inet addr:192.168.0.21  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::52e5:49ff:fec2:c805/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11178 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1490 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:723997 (707.0 Kb)  TX bytes:415085 (405.3 Kb)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:40 errors:0 dropped:0 overruns:0 frame:0
          TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3248 (3.1 Kb)  TX bytes:3248 (3.1 Kb)

arrakis:~ # 

どうやらそうではありません。

1
Thufir

出力から:

arrakis:~ # ip route
127.0.0.0/8 dev lo  scope link 
192.168.0.0/24 dev enp5s0  proto kernel  scope link  src 192.168.0.21
arrakis:~ # 

デフォルトルートはありません。したがって、127.0.0.0/8(ローカルホスト)または192.168.0.0/24(ローカルサブネット)でのみアクセスできます。

デフォルトルートを追加すれば、うまくいくはずです。

2
Celada