我们的服务器有 2 张网卡,FreeBSD一张卡用于互联网(工作正常),另一张用于本地网络连接(192.168.227.0/24net)。当我尝试使用 ip ping 本地网络的网关时192.168.227.1我收到消息“ping:发送至:主机已关闭。”网关正常且在线 - 所有其他服务器(安装有 Ubuntu)都可以轻松连接到该网络。所以也许我的配置文件中存在一些错误。
ifconfig:
igb0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=1bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM, TSO4>
ether 3c:d9:2b:f2:d1:f6
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
igb1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=1bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM, TSO4>
ether 3c:d9:2b:f2:d1:f7
media: Ethernet autoselect
status: no carrier
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_ MAGIC>
ether 00:26:55:ea:e3:a6
inet 77.195.133.102 netmask 0xffffffe0 broadcast 77.195.133.127
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=19b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4>
ether 00:26:55:ea:e3:a7
inet 192.168.227.24 netmask 0xffffff00 broadcast 192.168.227.255
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=3<RXCSUM,TXCSUM>
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
网络状态-r
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 77.195.133.97 UGS 9 2874633 em0
10.6.200.0 192.168.227.1 UGS 0 0 em1
77.195.133.96/27 link#3 U 3 3808304 em0
77.195.133.102 link#3 UHS 0 0 lo0
localhost link#5 UH 0 2101 lo0
192.168.227.0 link#4 U 0 59 em1
192.168.227.24 link#4 UHS 0 0 lo0
Internet6:
Destination Gateway Flags Netif Expire
localhost localhost UH lo0
fe80::%lo0 link#5 U lo0
fe80::1%lo0 link#5 UHS lo0
ff01:5:: fe80::1%lo0 U lo0
ff02::%lo0 fe80::1%lo0 U lo0
/etc/rc.conf
defaultrouter="77.195.133.97"
hostname="bd-mor-online.myhost.ru"
ifconfig_em0="inet 77.195.133.102 netmask 255.255.255.224"
ifconfig_em1="inet 192.168.227.24 netmask 255.255.255.0"
static_routes="net1 net2"
route_net1="-net 192.168.227.0/24 192.168.227.1"
route_net2="-net 10.6.200.0/24 192.168.227.1"
keymap="ru.koi8-r"
sshd_enable="YES"
inetd_enable="YES"
linux_enable="YES"
ping -c5 192.168.227.24 正常 - 100%。
还有网络10.6.200.0我需要通过哪里路由这个服务器192.168.227.1,但主要目标是从网关获取 PING。
答案1
您需要使用以下设置打开 IP 转发/etc/rc.conf
gateway_enable="YES"