2个局域网之间的vyatta静态路由

网络工程 路由 linux
2021-07-07 23:45:02

我有 vyatta 6.2 的问题 - 静态路由 在此处输入图片说明

我想在网络 192.168.0 中有互联网。, 我可以 ping 例如 192.168.0.59 但我在网络 192.168.0 中没有互联网连接。. 我尝试添加静态路由,但什么也没发生,set protocols static route 192.168.1.0/24 next-hop 192.168.0.100

我的配置

 ethernet eth0 {
     address 192.168.1.220/24
     description LAN_01
     hw-id 00:23:54:da:d8:2e
 }
 ethernet eth1 {
     address 192.168.0.100/24
     description LAN_02
     hw-id 10:fe:ed:04:12:db
 }

gateway-address 192.168.1.1

root@ROUTER2# ping google.pl
PING google.pl (46.134.212.153) 56(84) bytes of data.
64 bytes from public103577.xdsl.centertel.pl (46.134.212.153): icmp_req=1 ttl=128 time=18.5 ms
64 bytes from public103577.xdsl.centertel.pl (46.134.212.153): icmp_req=2 ttl=128 time=18.9 ms

root@ROUTER2# ping 192.168.0.59
PING 192.168.0.59 (192.168.0.59) 56(84) bytes of data.
64 bytes from 192.168.0.59: icmp_req=1 ttl=128 time=10.7 ms
64 bytes from 192.168.0.59: icmp_req=2 ttl=128 time=0.300 ms

root@ROUTER2# show service nat rule 10 
 outbound-interface eth0
 source {
     address 192.168.0.0/24
 }
 type masquerade

预先感谢您的帮助

1个回答

在这种情况下,您不需要静态路由。您的路由器在两个 /24 网络中都有一个接口,因此它们会作为直接连接的接口自动添加到其路由表中。

您的配置看起来应该可以工作,所以我会检查您帖子中没有的任何内容,例如:

  • 192.168.0.0/24 客户端 IP 设置
    • 默认网关应该是 192.168.0.100
    • 我会先看这里。您对 0.59 的第一次 ping 需要 10 毫秒(与 0.3 毫秒相比),这可能意味着发出了 arp 请求。这是不寻常的,因为主机之前应该已经联系过您的路由器以尝试访问互联网,并且应该已经在路由器 arp 缓存中。除非它没有配置为使用路由器作为其 GW。
    • 他们可以 ping 192.168.1.0 网络中的主机吗?
  • 路由器上的防火墙设置
  • 域名系统
  • NAT 设置冲突。您只需要一个 NAT 规则即可进行基本转换。