切换到特定静态 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

检查您的网络设置:

  • 您的网络掩码和广播地址设置正确吗?
  • 您的默认网关设置正确吗?

相关内容