切換到特定靜態 IP 時出錯

切換到特定靜態 IP 時出錯

我有一個 Fedora 盒子,使用我的靜態 IP 69.169.136.6 等運行,所有配置都是根據 ISP 的要求進行的。就在最近,硬碟出現故障(我應該保留更好的備份) - 在恢復期間,我想在我的 Archlinux PC 上放置一個網頁來解釋問題 - 我目前沒有足夠的訪問權限來更改 DNS 記錄分配給域。

當我在系統運行時將 IP 位址更改為 69.169.136.6 時,ifconfig 會報告新的 IP 位址,但是http://whatismyip.com/才不是。當我更改它並重新啟動時,我無法 ping - 我收到的訊息是「connect: Network is unreachable」(當給定 google.com 的 IP 位址之一時 - 主機名稱給我ping: unknown host xxx)。在我能夠存取 DNS 系統之前,我該怎麼做才能使其正常工作?

編輯:使用新的 IP 位址,同樣的問題,IP 現在是 69.169.136.29。一些命令可能有用:

#ping 69.169.136.1
PING 69.169.136.1 (69.169.136.1) 56(84) bytes of data.
64 bytes from 69.169.136.1: icmp_seq=1 ttl=64 time=0.377 ms

#ping 69.169.190.211
connect: Network is unreachable
#ping 208.72.160.67
connect: Network is unreachable

#ifconfig
eth0      Link encap:Ethernet  HWaddr 00:E0:4D:97:23:9B  
          inet addr:69.169.136.29  Bcast:69.169.137.255  Mask:255.255.254.0
          inet6 addr: fe80::2e0:4dff:fe97:239b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:132091 errors:0 dropped:0 overruns:0 frame:0
          TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9635179 (9.1 Mb)  TX bytes:1322 (1.2 Kb)
          Interrupt:29 Base address:0x6000 

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:16436  Metric:1
          RX packets:48 errors:0 dropped:0 overruns:0 frame:0
          TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2480 (2.4 Kb)  TX bytes:2480 (2.4 Kb)

#ip route
69.169.136.0/23 dev eth0  proto kernel  scope link  src 69.169.136.29 

#cat /etc/resolv.conf
# Generated by dhcpcd
#nameserver 208.67.222.222
#nameserver 208.67.220.220
nameserver 69.169.190.211
nameserver 208.72.160.67

# /etc/resolv.conf.tail can replace this line

更新:擁有新的靜態 IP 位址,已驗證可在 Windows 中運作.../etc/rc.conf 的相關部分如下:

#Static IP example
#eth0="eth0 69.169.136.6 netmask 255.255.254.0 broadcast 69.169.136.1"
#eth0="eth0 69.169.136.29 netmask 255.255.254.0 broadcast 69.169.137.255"
eth0="eth0 69.169.136.32 netmask 255.255.254.0 broadcast 69.169.137.255"
#eth0="dhcp"
INTERFACES=(eth0)

# Routes to start at boot-up (in this order)
# Declare each route then list in ROUTES
#   - prefix an entry in ROUTES with a ! to disable it
#
#gateway="default gw 192.168.0.1"
gateway="default gw 69.169.136.1"
#gateway="69.169.136.1"
ROUTES=(!gateway)
#ROUTES=()

答案1

從 ip 路由的輸出來看,您沒有設定預設閘道 - 嘗試執行:

ip route add default via 69.169.136.1

我不確定它在 archlinux 上是否有所不同,但在 Redhat 變體上為了使其永久化,您可以將以下內容添加到 /etc/sysconfig/network 中:

GATEWAY=69.169.136.1

答案2

檢查您的網路設定:

  • 您的網路遮罩和廣播位址設定正確嗎?
  • 您的預設網關設定正確嗎?

相關內容