今天早上,连接和所有事情都工作正常,直到我按照一些在线教程安装后缀并改变了/etc/主机名和/etc/主机。现在 ping 到本地路由器:198.168.3.1 工作正常,但当我尝试到达防火墙外的任何地方时却无法正常工作:
ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.3.46 icmp_seq=1 Destination Host Unreachable
ping 192.168.3.1
PING 192.168.3.1 (192.168.3.1) 56(84) bytes of data.
64 bytes from 192.168.3.1: icmp_seq=1 ttl=64 time=8.62 ms
我卸载了后缀,改变了/etc/主机名和/etc/主机,但问题依然存在。
我将使用 example.com 来覆盖真实域。这是我的如果配置例如:
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.3.46 netmask 255.255.255.0 broadcast 192.168.3.255
inet6 fe80::bacb:29ff:fea3:a598 prefixlen 64 scopeid 0x20<link>
ether b8:cb:29:a3:a5:98 txqueuelen 1000 (Ethernet)
RX packets 4377 bytes 708162 (708.1 KB)
RX errors 0 dropped 28 overruns 0 frame 0
TX packets 875 bytes 62510 (62.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 17
这是我的/etc/netplan:
# This is the network config written by 'subiquity'
network:
version: 2
renderer: networkd
ethernets:
eno1:
addresses: [192.168.3.46/24]
gateway4: 192.168.3.254
nameservers:
addresses: [8.8.4.4,8.8.8.8]
这是/etc/主机:
127.0.0.1 localhost
127.0.0.1 example.com
127.0.1.1 www.example.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
这是/etc/主机名:
example.com
服务器仍然接受请求,但无法通过 LAN 发送任何内容:
traceroute 8.8.8.8 traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 example.com (192.168.3.46) 2325.811 ms 2325.800 ms 2325.793 ms
我重置了防火墙并尽了一切努力,请有人帮忙......
答案1
这一切都归功于@icarus,只需意识到网关和路由器应该共享处理所有传入和传出流量的相同地址。之前有 2 个路由器用于不同的目的,这就是为什么今天才出现问题,因为另一个路由器的规则已更改。